public static bool reportCourseDetail(string course_designation) { // check if student_id is valid Course course = new Course(course_designation); if (course.GetCourseInformation(GLOBALS.current_semester)) { List <Student> student_list = Registration.getStudentsFromCourseCurrentSemester(course.course_id); List <string> lines = new List <string>(); lines.Add(String.Format("Report for course ID: {0}", course.course_id)); lines.Add(course.ToString()); lines.Add("===============================" + Environment.NewLine); lines.Add("Students who are in this course: " + Environment.NewLine); lines.Add(String.Format("Student ID\t\t First name\t\t Last name" + Environment.NewLine)); foreach (var student in student_list) { lines.Add(String.Format("{0}\t\t\t {1}\t\t\t {2}", student.student_id, student.first_name, student.last_name)); lines.Add(Environment.NewLine); } //string file_name = AppDomain.CurrentDomain.BaseDirectory + String.Format("Report: Student ID {0}.txt", student_id); string file_path = @".\..\..\Reports\Report_Course_Detail.txt"; System.IO.File.WriteAllLines(file_path, lines); System.Diagnostics.Process.Start("notepad.exe", @".\..\..\Reports\Report_Course_Detail.txt"); return(true); } return(false); }
public static bool reportCourseDetail(string course_designation) { // check if student_id is valid Course course = new Course(course_designation); if (course.GetCourseInformation(GLOBALS.current_semester)) { List<Student> student_list = Registration.getStudentsFromCourseCurrentSemester(course.course_id); List<string> lines = new List<string>(); lines.Add(String.Format("Report for course ID: {0}", course.course_id)); lines.Add(course.ToString()); lines.Add("===============================" + Environment.NewLine); lines.Add("Students who are in this course: " + Environment.NewLine); lines.Add(String.Format("Student ID\t\t First name\t\t Last name" + Environment.NewLine)); foreach (var student in student_list) { lines.Add(String.Format("{0}\t\t\t {1}\t\t\t {2}", student.student_id, student.first_name, student.last_name)); lines.Add(Environment.NewLine); } //string file_name = AppDomain.CurrentDomain.BaseDirectory + String.Format("Report: Student ID {0}.txt", student_id); string file_path = @".\..\..\Reports\Report_Course_Detail.txt"; System.IO.File.WriteAllLines(file_path, lines); System.Diagnostics.Process.Start("notepad.exe", @".\..\..\Reports\Report_Course_Detail.txt"); return true; } return false; }
public static string dropCourse(string student_id, string course_designation) { Student student = new Student(student_id); student.getStudentInformation(); Course course = new Course(course_designation); course.GetCourseInformation(GLOBALS.current_semester); // check limit credit hours int new_credit_hour = student.current_credit_hour - course.credit_hours; if (new_credit_hour < 0) { return("Your credit hours is negative. Seems like your database is corrupted!"); } // check course capacity if (course.enrolled_student == 0) { return("Course database is corrupted!"); } // Update Registration Table if (Registration.dropRegistration(student, course)) { student.updateCreditHour(new_credit_hour); course.updateEnrolledStudent(course.enrolled_student - 1); return("ok"); } return("This course conflicts with your Registration. Please contact the admin for more information"); }
public static Course searchCourse(string course_designation, string year_semester) { Course course = new Course(course_designation); if (course.GetCourseInformation(year_semester)) { return(course); } return(course); }
public string searchCourse(string course_designation) { Course course = new Course(course_designation); string result = "No course found in this semester"; if (course.GetCourseInformation(GLOBALS.current_semester)) { result = course.ToString(); } return result; }
public string searchCourse(string course_designation) { Course course = new Course(course_designation); string result = "No course found in this semester"; if (course.GetCourseInformation(GLOBALS.current_semester)) { result = course.ToString(); } return(result); }
public static List <Course> getCoursesFromFaculty(string faculty_id) { List <Course> course_list = new List <Course>(); DataTable course_table = GLOBALS.db_query("select * from course where instructor_id=" + faculty_id); foreach (DataRow row in course_table.Rows) { Course course = new Course(row["course_designation"].ToString()); course.GetCourseInformation(GLOBALS.current_semester); course_list.Add(course); } return(course_list); }
public string addCourse(string student_id, string course_designation) { Student student = new Student(student_id); student.getStudentInformation(); Course course = new Course(course_designation); if (!course.GetCourseInformation(GLOBALS.current_semester)) { return("This course is not offered this semester. Sorry!"); } if (Registration.checkCoursePrereqNotTaken(student, course)) { return("Pre requisite is not taken"); } if (Registration.checkCourseTaken(student, course)) { return("You already took this course!"); } // check limit credit hours int new_credit_hour = student.current_credit_hour + course.credit_hours; if (new_credit_hour > student.max_credit_hour_allowed) { return("Maximum credit hours reached!"); } // check course capacity if (course.enrolled_student >= course.capacity) { return("This course is full!"); } // Update Registration Table if (Registration.addRegistration(student, course)) { student.updateCreditHour(new_credit_hour); course.updateEnrolledStudent(course.enrolled_student + 1); return("ok"); } return("This course conflicts with your Registration. Please contact the admin for more information"); }
public static List<Course> getCoursesFromStudent(string student_id, string year_semester) { List<Course> course_list = new List<Course>(); string query = "select * from registration where student_id=" + student_id + " and year_semester='" + year_semester + "'"; DataTable registration_table = GLOBALS.db_query(query); foreach (DataRow row in registration_table.Rows){ DataTable course_table = GLOBALS.db_query("select course_designation from course where course_id=" + row["course_id"].ToString()); Course course = new Course(course_table.Rows[0]["course_designation"].ToString()); if (course.GetCourseInformation(GLOBALS.current_semester)) { course_list.Add(course); } } return course_list; }
public static List <Course> getCoursesFromStudent(string student_id, string year_semester) { List <Course> course_list = new List <Course>(); string query = "select * from registration where student_id=" + student_id + " and year_semester='" + year_semester + "'"; DataTable registration_table = GLOBALS.db_query(query); foreach (DataRow row in registration_table.Rows) { DataTable course_table = GLOBALS.db_query("select course_designation from course where course_id=" + row["course_id"].ToString()); Course course = new Course(course_table.Rows[0]["course_designation"].ToString()); if (course.GetCourseInformation(GLOBALS.current_semester)) { course_list.Add(course); } } return(course_list); }
public string addCourse(string student_id, string course_designation) { Student student = new Student(student_id); student.getStudentInformation(); Course course = new Course(course_designation); if (!course.GetCourseInformation(GLOBALS.current_semester)) { return "This course is not offered this semester. Sorry!"; } if (Registration.checkCoursePrereqNotTaken(student, course)) { return "Pre requisite is not taken"; } if (Registration.checkCourseTaken(student, course)) { return "You already took this course!"; } // check limit credit hours int new_credit_hour = student.current_credit_hour + course.credit_hours; if (new_credit_hour > student.max_credit_hour_allowed) { return "Maximum credit hours reached!"; } // check course capacity if (course.enrolled_student >= course.capacity ) { return "This course is full!"; } // Update Registration Table if (Registration.addRegistration(student, course)) { student.updateCreditHour(new_credit_hour); course.updateEnrolledStudent(course.enrolled_student + 1); return "ok"; } return "This course conflicts with your Registration. Please contact the admin for more information"; }
public static List<Course> getCoursesFromFaculty(string faculty_id) { List<Course> course_list = new List<Course>(); DataTable course_table = GLOBALS.db_query("select * from course where instructor_id=" + faculty_id); foreach (DataRow row in course_table.Rows) { Course course = new Course(row["course_designation"].ToString()); course.GetCourseInformation(GLOBALS.current_semester); course_list.Add(course); } return course_list; }
public static Course searchCourse(string course_designation, string year_semester) { Course course = new Course(course_designation); if (course.GetCourseInformation(year_semester)) { return course; } return course; }