Beispiel #1
0
 public static void save(P6004 course) {
   SQLiteDatabase db = DALHelper.getInstance().getWritableDatabase();
   db.execSQL(
       "insert into "
           + TABLE_NAME
           + " ("
           + COLUMN_WEEKTIME
           + ","
           + COLUMN_DAYTIME
           + ","
           + COLUMN_COURSETIME1
           + ","
           + COLUMN_COURSETIME2
           + ","
           + COLUMN_STARTTIME
           + ","
           + COLUMN_ENDTIME
           + ","
           + COLUMN_NAME
           + ","
           + COLUMN_TEACHER
           + ","
           + COLUMN_SITE
           + ","
           + COLUMN_STATU
           + ","
           + COLUMN_SERVERID
           + ")"
           + "  values (?,?,?,?,?,?,?,?,?,?,?)",
       new Object[] {
         course.getWeektime(),
         course.getDaytime(),
         course.getCoursetime1(),
         course.getCoursetime2(),
         course.getStarttime(),
         course.getEndtime(),
         course.getName(),
         course.getTeacher(),
         course.getSite(),
         course.getStatu(),
         course.getServerid()
       });
   db.close();
 }
Beispiel #2
0
 public static void update(P6004 course) {
   SQLiteDatabase db = DALHelper.getInstance().getWritableDatabase();
   db.execSQL(
       "update "
           + TABLE_NAME
           + " set "
           + COLUMN_WEEKTIME
           + "=?,"
           + COLUMN_DAYTIME
           + "=?,"
           + COLUMN_COURSETIME1
           + "=?,"
           + COLUMN_COURSETIME2
           + "=?,"
           + COLUMN_STARTTIME
           + "=?,"
           + COLUMN_ENDTIME
           + "=?,"
           + COLUMN_NAME
           + "=?,"
           + COLUMN_TEACHER
           + "=?,"
           + COLUMN_SITE
           + "=?,"
           + COLUMN_STATU
           + "=?,"
           + COLUMN_SERVERID
           + "=? where "
           + COLUMN_ID
           + "=?",
       new Object[] {
         course.getWeektime(),
         course.getDaytime(),
         course.getCoursetime1(),
         course.getCoursetime2(),
         course.getStarttime(),
         course.getEndtime(),
         course.getName(),
         course.getTeacher(),
         course.getSite(),
         course.getStatu(),
         course.getServerid(),
         course.getId()
       });
   db.close();
 }
Beispiel #3
0
 private static P6004 cursorToModel(Cursor cursor) {
   P6004 model = new P6004();
   model.setId(cursor.getInt(cursor.getColumnIndex(COLUMN_ID)));
   model.setServerid(cursor.getInt(cursor.getColumnIndex(COLUMN_SERVERID)));
   model.setWeektime(cursor.getInt(cursor.getColumnIndex(COLUMN_WEEKTIME)));
   model.setDaytime(cursor.getInt(cursor.getColumnIndex(COLUMN_DAYTIME)));
   model.setCoursetime1(cursor.getInt(cursor.getColumnIndex(COLUMN_COURSETIME1)));
   model.setCoursetime2(cursor.getInt(cursor.getColumnIndex(COLUMN_COURSETIME2)));
   model.setStarttime(cursor.getInt(cursor.getColumnIndex(COLUMN_STARTTIME)));
   model.setEndtime(cursor.getInt(cursor.getColumnIndex(COLUMN_ENDTIME)));
   model.setName(cursor.getString(cursor.getColumnIndex(COLUMN_NAME)));
   model.setTeacher(cursor.getString(cursor.getColumnIndex(COLUMN_TEACHER)));
   model.setSite(cursor.getString(cursor.getColumnIndex(COLUMN_SITE)));
   model.setStatu(cursor.getInt(cursor.getColumnIndex(COLUMN_STATU)));
   return model;
 }