示例#1
0
 public void save(SQLiteDatabase db, long idMessage, long idWhiteList, boolean isUpdate) {
   Card card = new Card();
   long l = -1;
   ContentValues cv = new ContentValues();
   cv.put("begtime", this.beg.getTime());
   cv.put("endtime", this.end.getTime());
   cv.put("is1", this.days[0] ? 1 : 0);
   cv.put("is2", this.days[1] ? 1 : 0);
   cv.put("is3", this.days[2] ? 1 : 0);
   cv.put("is4", this.days[3] ? 1 : 0);
   cv.put("is5", this.days[4] ? 1 : 0);
   cv.put("is6", this.days[5] ? 1 : 0);
   cv.put("is7", this.days[6] ? 1 : 0);
   if (isUpdate) {
     String[] qcols = {"idDream"};
     String[] qargs = {String.valueOf(getID())};
     Cursor c = db.query("cards", qcols, "id=?", qargs, null, null, null);
     if (c.moveToFirst()) {
       l = c.getLong(0);
       db.update("quieties", cv, "id=?", new String[] {String.valueOf(l)});
     }
     card.setID(getID());
     card.setType(CardType.Dream);
     card.setQuiet(l);
     card.setSMS(idMessage);
     card.setWhiteList(idWhiteList);
     card.setOnOff(isOn());
     card.save(db, true);
   } else {
     l = db.insert("quieties", null, cv);
     card.setType(CardType.Dream);
     card.setQuiet(l);
     card.setSMS(idMessage);
     card.setWhiteList(idWhiteList);
     card.setOnOff(isOn());
     card.save(db, false);
   }
 }
示例#2
0
 public void save(SQLiteDatabase db) {
   Card card = new Card();
   ContentValues cv = new ContentValues();
   cv.put("begtime", this.beg.getTime());
   cv.put("endtime", this.end.getTime());
   cv.put("is1", this.days[0] ? 1 : 0);
   cv.put("is2", this.days[1] ? 1 : 0);
   cv.put("is3", this.days[2] ? 1 : 0);
   cv.put("is4", this.days[3] ? 1 : 0);
   cv.put("is5", this.days[4] ? 1 : 0);
   cv.put("is6", this.days[5] ? 1 : 0);
   cv.put("is7", this.days[6] ? 1 : 0);
   long l = db.insert("quieties", null, cv);
   card.setType(CardType.Dream);
   card.setQuiet(l);
   card.save(db);
 }