public void FillCourses() { //Clear courses lcCourses = null; cbCourse.Items.Clear(); //Get all courses lcCourses = CourseManager.GetAllCourses(); //Only if there are any courses if (lcCourses.Count > 0) { //Current course's id decimal curCourseID = cSelectedSchedule.GetCourse().Course_ID; //Fill the course combo box for (int i = 0; i < lcCourses.Count; i++) { cbCourse.Items.Add(lcCourses[i].Course_Name); //Set selection if (lcCourses[i].Course_ID.Equals(curCourseID)) { cbCourse.SelectedIndex = i; } } } //Refresh course cbCourse.Refresh(); }
public void FillGridView() { //Get all schedules lcSchedules = ScheduleManager.GetAllSchedules(); //For each entry, add to data grid view for (int i = 0; i < lcSchedules.Count; i++) { Course_Schedule curSchedule = lcSchedules[i]; Course curCourse = curSchedule.GetCourse(); User curTutor = curSchedule.GetTutor(); dgvSchedules.Rows.Add(curSchedule.CourseSchedule_ID, curCourse.Course_Name, curTutor.FullName, curSchedule.DT_From, curSchedule.DT_To); } dgvSchedules.Refresh(); }