Ejemplo n.º 1
0
        /*
         * Method: GenerateAllClassessGridData
         * Areguments: none
         * Return: none
         * Des: this method is to fill the all classes GridView with data
         */
        protected void GenerateAllClassessGridData()
        {
            DataTable table = new DataTable();             // create data table object

            // add the table columns
            table.Columns.Add("Course Id");
            table.Columns.Add("Section Id");
            table.Columns.Add("Course Title");
            table.Columns.Add("Location");
            table.Columns.Add("Time");
            table.Columns.Add("Date");
            table.Columns.Add("Instructor Name");

            foreach (Schedule schedule in scheduleList.List)
            {
                /* foreach element in the scheduleList
                 */
                sectionsList.Filter("SectionID", schedule.SectionID);                                                                                                               // filter the sectionList with sectionID
                Section section = (Section)sectionsList.List.ElementAt(0);                                                                                                          // get the first element in the list and cast it to ( section )
                taughtList.Filter("TaughtCourseID", section.TaughtCourseID);                                                                                                        // filter the taughtCourseList with taughtcourseID from the section object
                TaughtCourse taughtcourse = (TaughtCourse)taughtList.List.ElementAt(0);                                                                                             // get the first element in the list and cast it to ( TaughtCourse )
                courseList.Filter("CourseID", taughtcourse.CourseID);                                                                                                               //filter the CoursList with courseID from taughCourse object
                Course course = (Course)courseList.List.ElementAt(0);                                                                                                               // get the first element in the list and cast it to ( Course )
                locationList.Filter("LocationID", schedule.LocationID);                                                                                                             // filter the locationList with locationID from the section object
                Location location = (Location)locationList.List.ElementAt(0);                                                                                                       // get the first element in the list and cast it to ( Location )
                instructorList.Filter("InstructorID", section.InstructorID);                                                                                                        // filter the instructorList with the instructorID from section object
                Instructor instructor = (Instructor)instructorList.List.ElementAt(0);                                                                                               // get the first element in the list and cast it to ( Instructor )
                table.Rows.Add(taughtcourse.CourseID, section.getID(), course.Title, location.Name, schedule.Time, schedule.Day, instructor.FirstName + " " + instructor.LastName); // add information as row to the table object
            }
            allclassListGrid.DataSource = table;                                                                                                                                    // set table as the dataSource of the grid view
            allclassListGrid.DataBind();                                                                                                                                            // bind the data
        }
Ejemplo n.º 2
0
        /*
         * 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 Title");
            table.Columns.Add("Location");
            table.Columns.Add("Time");
            table.Columns.Add("Date");
            table.Columns.Add("Instructor Name");
            foreach (Schedule schedule in scheduleList.List)
            {
                /*
                 * Foreach Element in the scheduleList
                 */
                sectionsList.Filter("SectionID", schedule.SectionID);                   // filter the sectionList using the section id from the element of scheduleList
                Section section = (Section)sectionsList.List.ElementAt(0);              // get the section object from the sectionList

                taughtList.Filter("TaughtCourseID", section.TaughtCourseID);            // filter the taughtCourseList usign the taughtCourse id from the section object
                TaughtCourse taughtcourse = (TaughtCourse)taughtList.List.ElementAt(0); // get the taughtCourse object from the list
                courseList.Filter("CourseID", taughtcourse.CourseID);                   //filter the courseList using the CourseId from the taughtCourse object
                Course course = (Course)courseList.List.ElementAt(0);                   // get the course object fom the couseList
                locationList.Filter("LocationID", schedule.LocationID);                 //filter the locationList using the location id from the element
                Location location = (Location)locationList.List.ElementAt(0);           // get location object
                instructorList.Filter("InstructorID", section.InstructorID);            // filter the instructor id form the
                Instructor instructor = (Instructor)instructorList.List.ElementAt(0);   // get the instructor object form the instructorList
                table.Rows.Add(taughtcourse.CourseID, section.getID(), course.Title, location.Name, schedule.Time, schedule.Day, instructor.FirstName + " " + instructor.LastName);
                // add a row to the dataTable object with the information from the above objects
            }
            classListGrid.DataSource = table;     // set the dataTable object as the dataSource of the GidView element
            classListGrid.DataBind();             // bind the data
        }