// Getting course's Gradebook
 public Gradebook getGradebok(int cid) {
   String selectQuery = "SELECT * FROM Gradebook" + " WHERE cid = " + cid;
   SQLiteDatabase db = this.getWritableDatabase();
   Cursor cursor = db.rawQuery(selectQuery, null);
   cursor.moveToFirst();
   Gradebook gradebook = new Gradebook();
   gradebook.setgrid(cursor.getInt(0));
   gradebook.setcid(cursor.getInt(1));
   gradebook.setgrade_type(cursor.getString(2));
   gradebook.setparameter(getParameters(gradebook.getcid()));
   gradebook.setgrade(getGrades(gradebook.getcid()));
   return gradebook;
 }
 public int updateGradebook(Gradebook gradebook) {
   SQLiteDatabase db = this.getWritableDatabase();
   ContentValues values = new ContentValues();
   values.put(GRADETYPE, gradebook.getgrade_type());
   if (gradebook.getparameters() != null) updateParameters(gradebook.getparameters());
   return db.update(
       TABLE_GRADEBOOK, values, C_ID + "= ?", new String[] {String.valueOf(gradebook.getcid())});
 }
 // Adding a Gradebook
 public void addGradebook(Gradebook gradebook) {
   SQLiteDatabase db = this.getWritableDatabase();
   ContentValues values = new ContentValues();
   values.put(C_ID, gradebook.getcid());
   values.put(GRADETYPE, gradebook.getgrade_type());
   db.insert(TABLE_GRADEBOOK, null, values);
   db.close();
   addParameters(gradebook.getparameters());
 }
 public void deleteGradebook(Gradebook gradebook) {
   SQLiteDatabase db = this.getWritableDatabase();
   db.delete(TABLE_GRADEBOOK, C_ID + "=?", new String[] {String.valueOf(gradebook.getcid())});
   db.close();
   deleteParameters(gradebook.getparameters());
 }