// displays an info box containing information about a course string getCalendarPopupString(int id) { // Gets all courses with same course code: List <int> ids = new List <int>(); for (int i = 0; i < DB.getNumCourses(); i++) { if (DB.getCourseCode(i) == DB.getCourseCode(id)) { ids.Add(i); } } string val = DB.getCourseCode(ids[0]) + "\n"; val += DB.getLongName(ids[0]) + "\n"; val += "with " + DB.getProf(ids[0]).first + " " + DB.getProf(ids[0]).last + "\n\n"; int credits = 0; foreach (int course_id in ids) { val += DB.getCourse(course_id).getTimeString().Item1 + " to " + DB.getCourse(course_id).getTimeString().Item2; val += " on " + getDays(DB.getCourse(course_id)) + " in " + DB.getBuilding(course_id) + " " + DB.getRoom(course_id) + "\n"; credits += DB.getCredits(course_id); } val += "\n" + credits.ToString() + " total credits\n"; val += DB.getEnrollment(ids[0]).ToString() + " seats taken out of " + DB.getCapacity(ids[0]).ToString() + "\n"; return(val); }
//adds a course to the candidate schedule based on course object, //along with any courses with the same course code public void addCourse(Course c) { if (schedule.Contains(c)) { return; } creditCount += c.getCredits(); schedule.Add(c); int id = c.getCourseID(); //adds courses with same name recursivly if (id < DB.getNumCourses() - 1 && DB.getCourseCode(id + 1) == DB.getCourseCode(id)) { addCourse(DB.getCourse(id + 1)); } else if (id > 0 && DB.getCourseCode(id - 1) == DB.getCourseCode(id)) { addCourse(DB.getCourse(id - 1)); } addToCalendar(id); }