/* * Method: GenerateGridData * Areguments: none * Return: none * Des: this method is to fill the GridView with data */ protected void GenerateGridData() { DataTable table = new DataTable(); // declare and instantiate DataTable object /* * Add Columns to the data table */ table.Columns.Add("Course Id"); table.Columns.Add("Section Id"); table.Columns.Add("Course Name"); table.Columns.Add("Instructor Name"); table.Columns.Add("Mark"); foreach (SectionStudent sectionStudent in sectionStudentList.List) { /* * Foreach Element in the sectionStudentList */ section = new Section(sectionStudent.SectionID); // create new section object and pass the section id to it sectionList.Populate(section); // populate the section object instructor = new Instructor(section.InstructorID); // create new instructor object and pass the id to it instructorList.Populate(instructor); // populate the instructor object taughtCourses = new TaughtCourse(section.TaughtCourseID); // create new TaughtCourse object and pass the TaughtCourse id to it taughtCoursesList.Populate(taughtCourses); // populate TaughtCourse course = new Course(taughtCourses.CourseID); // create new course object and pass the course id to it courseList.Populate(course); //populate the course object table.Rows.Add(course.getID(), section.getID(), course.Title, instructor.FirstName + " " + instructor.LastName, sectionStudent.Grade); // add a row to the dataTable object with the information from the above objects } MarksGrid.DataSource = table; // set the dataTable object as the dataSource of the GidView element MarksGrid.DataBind(); // bind the data }
private void AddSection_Load(object sender, EventArgs e) { nextID(); instructors.Populate(); this.cmbInstructor.DataSource = instructors.List; this.cmbInstructor.SelectedIndex = -1; tCourses.Populate(); this.cmbTCourse.DataSource = tCourses.List; this.cmbTCourse.SelectedIndex = -1; }
/* * Method: GenerateGridView * Areguments: none * Return: none * Des: this method is to fill the GridView with data */ protected void GenerateGridView() { DataTable table = new DataTable(); // create new DataTable object /* Fill the table with Columns and rows */ table.Columns.Add("Time"); table.Columns.Add("Saturday"); table.Columns.Add("Sunday"); table.Columns.Add("Monday"); table.Columns.Add("Tuesday"); table.Columns.Add("Wednesday"); table.Columns.Add("Thursday"); table.Columns.Add("Friday"); table.Rows.Add("8", "", "", "", "", "", "", ""); table.Rows.Add("9", "", "", "", "", "", "", ""); table.Rows.Add("10", "", "", "", "", "", "", ""); table.Rows.Add("11", "", "", "", "", "", "", ""); table.Rows.Add("12", "", "", "", "", "", "", ""); table.Rows.Add("1", "", "", "", "", "", "", ""); table.Rows.Add("2", "", "", "", "", "", "", ""); table.Rows.Add("3", "", "", "", "", "", "", ""); table.Rows.Add("4", "", "", "", "", "", "", ""); table.Rows.Add("5", "", "", "", "", "", "", ""); timeTableGridView.DataSource = table; // add the table as data source for the gridview timeTableGridView.DataBind(); // bind the data foreach (SectionStudent sectionStudent in SectionStudentList.List) { /* ForEach element in the sectionstudentList */ Section section = new Section(sectionStudent.getID()); // create new student object and pass the id SectionList.Populate(section); // populate the section object TaughtCourse taught = new TaughtCourse(section.TaughtCourseID); // create new TaughtCourse object and pass the id taughtCoursesList.Populate(taught); // populate the TaughtCourse object Course course = new Course(taught.CourseID); // create new Course object and pass the id courseList.Populate(course); // populate the Course object scheduleList.Filter("SectionID", sectionStudent.getID()); // filter the schedule list according to section id foreach (Schedule schedule in scheduleList.List) { /* ForEeach Element in sechedule List */ AddToGridByDayAndTime(section, course, schedule); // call AddToGridByDayAndTime to add the schedule information to the gridView while (Convert.ToInt32(schedule.Duration) > 1) { /* While the schedule duration is more than 1 do*/ int newTime = Convert.ToInt32(schedule.Time) + 1; //get the old time and add 1 and assign it to var schedule.Time = newTime.ToString(); // set the schedule object time to the new time AddToGridByDayAndTime(section, course, schedule); // call AddToGridByDayAndTime to add the schedule information to the gridView int duration = Convert.ToInt32(schedule.Duration) - 1; // get the duration and abstract 1 schedule.Duration = duration.ToString(); // assign the new duration to the schedule duration } } } }
private void EditTaughtCourse_Load(object sender, EventArgs e) { //populate the lists and combo oxes taughtCourses.Populate(); this.cmbTaughtCourse.DataSource = taughtCourses.List; this.cmbTaughtCourse.SelectedIndex = -1; courses.Populate(); this.cmbCourse.DataSource = courses.List; this.cmbCourse.SelectedIndex = -1; this.txtYear.Text = ""; this.cmbSemester.SelectedIndex = -1; }
private void EditSection_Load(object sender, EventArgs e) { sections.Populate(); this.cmbSecID.DataSource = sections.List; this.cmbSecID.SelectedIndex = -1; instructors.Populate(); this.cmbInstructor.DataSource = instructors.List; this.cmbInstructor.SelectedIndex = -1; tCourses.Populate(); this.cmbTCourse.DataSource = tCourses.List; this.cmbTCourse.SelectedIndex = -1; this.txtCapacity.Text = ""; }
void loadTCourses() { taughtCourses.Populate(); this.cmbTaughtID.DataSource = taughtCourses.List; }