Ejemplo n.º 1
0
 public boolean update(Context context, ActionEvent ae) {
   ContentValues target = new ContentValues();
   target.put(KEY_STATE, ae.getEventState());
   target.put(KEY_BREAK_TIMESTAMP, ae.getBreakTimestamp());
   target.put(KEY_IS_HISTORY, getBooleanToLong(ae.isHistory()));
   target.put(KEY_BREAK_DEALY, ae.getBreakDelay());
   return update(context, ae, target);
 }
Ejemplo n.º 2
0
  public boolean insert(Context context, ActionEvent ae) {
    DatabaseHelper dh = new DatabaseHelper(context, TABLE_NAME);
    SQLiteDatabase db = dh.getWritableDatabase();

    ContentValues target = null;
    if (db.isOpen()) {
      target = new ContentValues();
      target.put(KEY_ACTION_NAME, ae.getActionEventName());
      target.put(KEY_START_TIMESTAMP, ae.getStartTimestamp());
      target.put(KEY_STATE, ae.getEventState());
      target.put(KEY_BREAK_TIMESTAMP, ae.getBreakTimestamp());
      target.put(KEY_IS_HISTORY, getBooleanToLong(ae.isHistory()));
      target.put(KEY_ACTION_NOTE, ae.getNoteContent());
      target.put(KEY_START_DEALY, ae.getStartDelay());
      target.put(KEY_BREAK_DEALY, ae.getBreakDelay());
      db.insert(TABLE_NAME, null, target);
    } else {
      db.close();
      return false;
    }
    target = null;
    return isInsert(db, ae);
  }