コード例 #1
0
ファイル: AlarmDS.java プロジェクト: phantomk/QingTingCheat
 public IDataToken doCommand(
     DataCommand paramDataCommand, IDataRecvHandler paramIDataRecvHandler) {
   String str = paramDataCommand.getCurrentCommand();
   if (str.equalsIgnoreCase("insertdb_alarm_info")) return doInsertCommand(paramDataCommand);
   if (str.equalsIgnoreCase("getdb_alarm_info")) return doAcquireCommand(paramDataCommand);
   if (str.equalsIgnoreCase("deletedb_alarm_info")) return doDeleteCommand(paramDataCommand);
   return null;
 }
コード例 #2
0
ファイル: AlarmDS.java プロジェクト: phantomk/QingTingCheat
 private boolean insertAlarmInfos(DataCommand paramDataCommand) {
   List localList = (List) paramDataCommand.getParam().get("alarmInfos");
   if ((localList == null) || (localList.size() == 0)) return false;
   try {
     SQLiteDatabase localSQLiteDatabase = DBManager.getInstance().getWritableDB("alarmInfos");
     localSQLiteDatabase.beginTransaction();
     Gson localGson = new Gson();
     for (int i = 0; i < localList.size(); i++)
       localSQLiteDatabase.execSQL(
           "insert into alarmInfos(alarmInfo) values(?)",
           new Object[] {localGson.toJson((AlarmInfo) localList.get(i))});
     localSQLiteDatabase.setTransactionSuccessful();
     localSQLiteDatabase.endTransaction();
     return true;
   } catch (Exception localException) {
   }
   return false;
 }
コード例 #3
0
 private boolean delInsertPlayHistory(DataCommand paramDataCommand) {
   List localList = (List) paramDataCommand.getParam().get("playhistory");
   if ((localList == null) || (localList.size() == 0)) return false;
   int i = 0;
   try {
     SQLiteDatabase localSQLiteDatabase = DBManager.getInstance().getWritableDB("playhistory");
     localSQLiteDatabase.beginTransaction();
     localSQLiteDatabase.execSQL("delete from playhistory");
     Gson localGson = new Gson();
     int j = 0;
     while (j < localList.size()) {
       PlayHistoryNode localPlayHistoryNode = (PlayHistoryNode) localList.get(j);
       long l1 = localPlayHistoryNode.playTime;
       String str1 = localGson.toJson(localPlayHistoryNode.playNode);
       int k = localPlayHistoryNode.channelId;
       int m = localPlayHistoryNode.categoryId;
       long l2 = localPlayHistoryNode.playContent;
       String str2 = localPlayHistoryNode.channelName;
       String str3 = localPlayHistoryNode.channelThumb;
       int n = i + 1;
       Object[] arrayOfObject = new Object[10];
       arrayOfObject[0] = Integer.valueOf(n);
       arrayOfObject[1] = ((PlayHistoryNode) localList.get(j)).playNode.nodeName;
       arrayOfObject[2] = str1;
       arrayOfObject[3] = Long.valueOf(l1);
       arrayOfObject[4] = Integer.valueOf(k);
       arrayOfObject[5] = Integer.valueOf(m);
       arrayOfObject[6] = Integer.valueOf(localPlayHistoryNode.subCatId);
       arrayOfObject[7] = Long.valueOf(l2);
       arrayOfObject[8] = str2;
       arrayOfObject[9] = str3;
       localSQLiteDatabase.execSQL(
           "insert into playhistory(id,nodename,playNode,time,channelId,catId,subCatId,playPosition,channelName,channelThumb) values(?,?,?, ?, ?,?,?,?,?,?)",
           arrayOfObject);
       j++;
       i = n;
     }
     localSQLiteDatabase.setTransactionSuccessful();
     localSQLiteDatabase.endTransaction();
     return true;
   } catch (Exception localException) {
   }
   return false;
 }