public static bool addRegistration(Student student, Course course) { string query = "insert into REGISTRATION (course_id, student_id, year_semester)" + "values (" + course.course_id + ", " + student.student_id + ", '" + GLOBALS.current_semester + "')"; return(GLOBALS.db_command(query)); }
public bool updateCreditHour(int new_credit_hour) { current_credit_hour = new_credit_hour; string query = "update STUDENT set current_credit_hr = " + current_credit_hour + " where student_id = " + student_id; return(GLOBALS.db_command(query)); }
public bool updateEnrolledStudent(int new_enrolled_student) { enrolled_student = new_enrolled_student; string query = "update COURSE_DETAILS set students_enrolled = " + enrolled_student + " where course_id = " + course_id + " and year_semester= '" + GLOBALS.current_semester + "'"; return(GLOBALS.db_command(query)); }
public static bool delete(string course_id) { string query = "delete from COURSE_DETAILS where " + "course_id= " + course_id + " and year_semester='" + GLOBALS.current_semester + "'"; return(GLOBALS.db_command(query)); }
public static bool dropRegistration(Student student, Course course) { string query = "delete from REGISTRATION where " + "course_id= " + course.course_id + " and student_id =" + student.student_id + " and year_semester='" + GLOBALS.current_semester + "'"; return(GLOBALS.db_command(query)); }
public static bool update( string course_id, string title, string course_designation, string instructor_id, string department_id, string num_credit, string course_description, string pre_req_course_id, string max_capacity, string enrolled_student, string semester) { string query; if (pre_req_course_id == null) { pre_req_course_id = "Null"; } query = "update COURSE set course_title = '" + title + "', " + "course_designation = '" + course_designation + "', " + "instructor_id = " + instructor_id + ", " + "description = '" + course_description + "', " + "prereq_course = " + pre_req_course_id + ", " + "dept_id = " + department_id + ", " + "credit_hour = " + num_credit + " " + " where course_id = " + course_id; if (!GLOBALS.db_command(query)) { return(false); } query = "update COURSE_DETAILS set " + "max_capacity = " + max_capacity + ", " + "students_enrolled = " + enrolled_student + " " + "where course_id = " + course_id + " " + "and year_semester = '" + semester + "'"; if (!GLOBALS.db_command(query)) { return(false); } return(true); }
public static bool add( string course_id, string title, string course_designation, string instructor_id, string department_id, string num_credit, string course_description, string pre_req_course_id, string max_capacity, string enrolled_student, string semester) { string query; if (pre_req_course_id == null) { query = "insert into COURSE (course_id, course_title, course_designation, instructor_id, dept_id, credit_hour, description) " + "values (" + course_id + ", '" + title + "', '" + course_designation + "', " + instructor_id + ", " + department_id + ", " + num_credit + ", '" + course_description + "')"; } else { query = "insert into COURSE (course_id, course_title, course_designation, instructor_id, dept_id, credit_hour, description, prereq_course) " + "values (" + course_id + ", '" + title + "', '" + course_designation + "', " + instructor_id + ", " + department_id + ", " + num_credit + ", '" + course_description + "', " + pre_req_course_id + ")"; } if (!GLOBALS.db_command(query)) { return(false); } query = "insert into COURSE_DETAILS (course_id, max_capacity, students_enrolled, year_semester) " + "values (" + course_id + ", " + max_capacity + ", " + "0" + ", '" + semester + "')"; if (!GLOBALS.db_command(query)) { return(false); } return(true); }