|
|
@@ -567,4 +567,65 @@ public class dbUtil
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public static void deleteResultFields() {
|
|
|
+
|
|
|
+// String booking_sql = "delete from fields_info where behavior = 1 and function_name = 'Ocean Booking' and name in ('booking_no','shipper','consignee','po_no','f_etd,m_eta','place_of_receipt_uncode','place_of_delivery_uncode');";
|
|
|
+//
|
|
|
+// String bl_sql = "delete from fields_info where behavior = 1 and function_name = 'Ocean B/L info.' and name in ('last_status_315_code','shipper,consignee','h_bol,etd','eta,po_no','place_of_receipt_un','place_of_delivery_un');";
|
|
|
+//
|
|
|
+// String cn_sql = "delete from fields_info where behavior = 1 and function_name = 'Container detail' and name in ('shipper','consignee','ctnr','file_no','po_no','etd','eta','fport_of_loading_un','mport_of_discharge_un');";
|
|
|
+
|
|
|
+
|
|
|
+ SQLiteDatabase db = OpenDB(ApexTrackingApplication.get_instance(), null, true);
|
|
|
+
|
|
|
+ deleteResultFields(db);
|
|
|
+
|
|
|
+ CloseDB(db);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void updateResultDisplayFields() {
|
|
|
+
|
|
|
+ SQLiteDatabase db = OpenDB(ApexTrackingApplication.get_instance(), null, true);
|
|
|
+
|
|
|
+ updateResultDisplayFields(db);
|
|
|
+
|
|
|
+ CloseDB(db);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void deleteResultFields(SQLiteDatabase db) {
|
|
|
+
|
|
|
+ db.delete("fields_info", "behavior = 1 and function_name = 'Ocean Booking' and name in ('booking_no','shipper','consignee','po_no','f_etd,m_eta','place_of_receipt_uncode','place_of_delivery_uncode')", null);
|
|
|
+ db.delete("fields_info", "behavior = 1 and function_name = 'Ocean B/L info.' and name in ('last_status_315_code','shipper,consignee','h_bol,etd','eta,po_no','place_of_receipt_un','place_of_delivery_un')", null);
|
|
|
+ db.delete("fields_info", "behavior = 1 and function_name = 'Container detail' and name in ('shipper','consignee','ctnr','file_no','po_no','etd','eta','fport_of_loading_un','mport_of_discharge_un')", null);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void updateResultDisplayFields(SQLiteDatabase db) {
|
|
|
+
|
|
|
+ ArrayList<String> users = new ArrayList<>();
|
|
|
+
|
|
|
+ String user_sql = "select distinct user from fields_info;";
|
|
|
+
|
|
|
+ Cursor cursor = db.rawQuery(user_sql, null);
|
|
|
+ while (cursor.moveToNext()) {
|
|
|
+
|
|
|
+ String user = cursor.getString(0);
|
|
|
+ users.add(user);
|
|
|
+ }
|
|
|
+
|
|
|
+ int maxDisplay = 3;
|
|
|
+
|
|
|
+ String[] functions_arr = {"Ocean Booking", "Ocean B/L info.", "Container detail"};
|
|
|
+ for (String user : users) {
|
|
|
+
|
|
|
+ for (String function : functions_arr) {
|
|
|
+
|
|
|
+ String sql = String.format("update fields_info set show = 0 where behavior = 1 and show = 1 and user = '%s' and function_name = '%s' and name in (select name from fields_info where function_name='%s' and user = '%s' and behavior=1 and show=1 order by priority,aname limit %d offset %d);", user, function, function, user, Integer.MAX_VALUE, maxDisplay);
|
|
|
+ db.execSQL(sql);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|