/** 修改班级 */
 public boolean modifyClass(Classes classes, String id) {
   ContentValues values = new ContentValues();
   values.put("class_id", classes.getClass_id());
   values.put("class_name", classes.getClass_name());
   values.put("class_date", classes.getClass_date());
   long l = db.update("class", values, "class_id=?", new String[] {id});
   return l == 1;
 }
 /**
  * 保存classes到数据库
  *
  * @param classes
  */
 public boolean saveClass(Classes classes) {
   if (classes != null) {
     ContentValues values = new ContentValues();
     values.put("class_id", classes.getClass_id());
     values.put("class_name", classes.getClass_name());
     values.put("class_date", classes.getClass_date());
     values.put("major_id", classes.getMajor_id());
     long l = db.insert("class", null, values);
     if (l == -1) {
       return false;
     } else {
       return true;
     }
   }
   return false;
 }
 /**
  * 返回对应专业的所有班级
  *
  * @param major_name
  * @return
  */
 public List<Classes> getClasses(String major_id) {
   List<Classes> list = new ArrayList<Classes>();
   Cursor cursor =
       db.query("class", null, "major_id=?", new String[] {major_id}, null, null, null);
   while (cursor.moveToNext()) {
     Classes classes = new Classes();
     classes.setClass_id(cursor.getString(cursor.getColumnIndex("class_id")));
     classes.setClass_date(cursor.getString(cursor.getColumnIndex("class_date")));
     classes.setClass_name(cursor.getString(cursor.getColumnIndex("class_name")));
     list.add(classes);
   }
   if (cursor != null) {
     cursor.close();
   }
   return list;
 }