public bool Edit(Class editClass) { string sql = "UPDATE " + TBL_CLASSES + " SET " + CLASS_NAME + "='" + editClass.name + "' " + "WHERE " + CLASS_ID + "=" + editClass.id + ";"; return _db.ExecuteInsertUpdateDelete(sql); }
public bool Add(Class newClass) { string sql = "INSERT INTO " + TBL_CLASSES + " (" + CLASS_NAME + ") " + "VALUES ('" + newClass.name + "');"; return _db.ExecuteInsertUpdateDelete(sql); }
public Student(long id, String name, double grade, int height, Class class_id) { this._id = id; this._name = name; this._grade = grade; this._height = height; this._class_id = class_id; }
public bool Delete(Class editClass) { string sql = "DELETE FROM " + TBL_CLASSES + " WHERE " + CLASS_ID + "=" + editClass.id + ";"; return _db.ExecuteInsertUpdateDelete(sql); }
public List<Student> GetStudentsInClass(Class fromClass) { List<Student> studentsList = new List<Student>(); String sql = "SELECT * FROM " + TBL_STUDENTS + " WHERE " + CLASS_ID + "=" + fromClass.id + ";"; DataTableReader records = _db.ExecuteSelect(sql); while (records.Read()) { studentsList.Add(new Student( Convert.ToInt32(records[STUD_ID]), (String)records[STUD_NAME], Convert.ToDouble(records[STUD_GRADE]), Convert.ToInt32(records[STUD_HEIGHT]), fromClass )); } records.Close(); return studentsList; }