Example #1
0
 public AddTaughtCourse()
 {
     //instantiating the objects to be used in the
     InitializeComponent();
     taughtCourses = new TaughtCourseList();
     courses       = new CourseList();
 }
Example #2
0
 public DeleteTaughtCourse()
 {
     InitializeComponent();
     taughtCourses      = new TaughtCourseList();
     scheduleList       = new ScheduleList();
     sectionStudentList = new SectionStudentList();
     sectionList        = new SectionList();
 }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null && Session["Account"].ToString() == "Student")
            {
                /*
                 * check if the user session exist and Account session value is student
                 */

                /*
                 * instantiate classes when the page loads
                 */
                sectionsList       = new SectionList();
                taughtList         = new TaughtCourseList();
                locationList       = new LocationList();
                courseList         = new CourseList();
                scheduleList       = new ScheduleList();
                sectionStudentList = new SectionStudentList();
                studentList        = new StudentList();
                scheduleList.Populate();           // populate the sechuleList
                instructorList = new InstructorList();
                GenerateGridData();                // call GenerateGridData method to fill the gridview element with data
            }
            else if (Session["User"] != null && Session["Account"].ToString() != "Student")
            {
                /*
                 * else if the user session exist but the account session value is not student show error message
                 */
                Response.Write("Error You are not allowed to be here");
                Response.End();
            }
            else
            {
                /*
                 * else show error message
                 */
                Response.Write("Error please log in before trying to Access this page..!");
                Response.End();
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null && Session["Account"].ToString() == "Student")
            {
                /*
                 * check if the user session exist and Account session value is student
                 */

                /*
                 * instantiate classes when the page loads
                 */
                sectionList        = new SectionList();
                sectionStudentList = new SectionStudentList();
                studentList        = new StudentList();
                taughtCoursesList  = new TaughtCourseList();
                courseList         = new CourseList();
                instructorList     = new InstructorList();
                string studentID = Session["User"].ToString();     //declare , get the id of the student from the session and assign it to variable
                sectionStudentList.Filter("StudentID", studentID); // filter the section student list using the studentID
                GenerateGridData();                                //call GenerateGridData method to add data to the gridView
            }
            else if (Session["User"] != null && Session["Account"].ToString() != "Student")
            {
                /*
                 * else if the user session exist but the account session value is not student show error message
                 */
                Response.Write("Error You are not allowed to be here");
                Response.End();
            }
            else
            {
                /*
                 * else show error message
                 */
                Response.Write("Error please log in before trying to Access this page..!");
                Response.End();
            }
        }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     /*
      * check if the user session exist and Account session value is Instructor
      */
     if (Session["User"] != null && Session["Account"].ToString() == "Instructor")
     {
         /*
          * instantiate classes when the page loads
          */
         sectionsList = new SectionList();
         taughtList   = new TaughtCourseList();
         locationList = new LocationList();
         courseList   = new CourseList();
         scheduleList = new ScheduleList();
         scheduleList.Populate();                     //populate schedule list
         instructorList = new InstructorList();
         InsId          = Session["User"].ToString(); // get the id of the instructor from the session
         GenerateAllClassessGridData();               // call GenerateAllClassessGridData method to fill the all classess grid view
         GenerateMyClassessGridData();                // call GenerateMyClassessGridData method to fill the my classess grid view
     }
     else if (Session["User"] != null && Session["Account"].ToString() != "Instructor")
     {
         /*
          * else if the user session exist but the account session value is not student show error message
          */
         Response.Write("Error You are not allowed to be here");
         Response.End();
     }
     else
     {
         /*
          * else show error message
          */
         Response.Write("Error please log in before trying to Access this page..!");
         Response.End();
     }
 }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null && Session["Account"].ToString() == "Student")
            {
                /*
                 * check if the user session exist and Account session value is student
                 */

                /*
                 * instantiate classes when the page loads
                 */
                scheduleList       = new ScheduleList();
                SectionList        = new SectionList();
                SectionStudentList = new SectionStudentList();
                taughtCoursesList  = new TaughtCourseList();
                courseList         = new CourseList();
                id = Session["User"].ToString();            //get the id of the student from the session and assign it to variable
                SectionStudentList.Filter("StudentID", id); // filter the sectionstudentList usign the student id
                GenerateGridView();                         // call the GenerateGridView method to fill the gridView element with data
            }
            else if (Session["User"] != null && Session["Account"].ToString() != "Student")
            {
                /*
                 * else if the user session exist but the account session value is not student show error message
                 */
                Response.Write("Error You are not allowed to be here");
                Response.End();
            }
            else
            {
                /*
                 * else show error message
                 */
                Response.Write("Error please log in before trying to Access this page..!");
                Response.End();
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["cls"] == null)
            {
                /* check if there is no query string then */
                Response.Write("Error No class requested"); // show error message
                Response.End();                             // stop page excution
            }
            else
            {
                sectionList = new SectionList();                             // this is needed to check if the section id is valid so we instantiate it before the rest
                sectionList.Filter("SectionID", Request.QueryString["cls"]); //  filter the section with the section id to check if the section id exist
            }

            /*
             * check if the user session exist and Account session value is Instructor and the sectionID is valid
             */
            if (Session["User"] != null && Session["Account"].ToString() == "Instructor" && sectionList.List.Count != 0)
            {
                /*
                 * instantiate classes when the page loads
                 */
                sectionStudentList = new SectionStudentList();
                studentList        = new StudentList();
                taughtCoursesList  = new TaughtCourseList();
                courseList         = new CourseList();
                sectionId          = Request.QueryString["cls"];                    // get the section id passed in the page url and assign it to secionId var
                sectionList.Filter("SectionID", sectionId);                         // filter the sectionList with the sectionID
                section = (Section)sectionList.List.ElementAt(0);                   // get the first element in the list and cast it to (Section)
                taughtCoursesList.Filter("TaughtCourseID", section.TaughtCourseID); // filter the taughtCoursesList with the TaughtCourseID
                taughtCourses = (TaughtCourse)taughtCoursesList.List.ElementAt(0);  // get the first element in the list and cast it to (TaughtCourse)
                course        = new Course();                                       // create new Course object
                course.setID(taughtCourses.CourseID.ToString());                    // set the id of the course object to the value from the taughtCourse object
                courseList.Populate(course);                                        //populate object
                sectionStudentList.Filter("SectionID", sectionId);                  //filter the sectionstudentList with sectionId
                SectionIdLbl.Text = section.getID();                                // set the sectionLable text to the section id
                CourseID.Text     = taughtCourses.CourseID;                         // set the courseid lable text to the course id
                CourseName.Text   = course.Title;                                   // set courseName lable text to the course title
                GenerateTable();                                                    // call GenerateTable method to fill the grid view with data
            }
            else if (Session["User"] != null && Session["Account"].ToString() != "Instructor")
            {
                /*
                 * else if the user session exist but the account session value is not student show error message
                 */
                Response.Write("Error You are not allowed to be here"); // show error message
                Response.End();                                         // stop page excution
            }
            else if (Session["User"] != null && Session["Account"].ToString() == "Instructor" && sectionList.List.Count == 0)
            {
                /* else if the user session exist and Account session value is Instructor and the sectionID is not valid */
                Response.Write("Error Class not found"); // show error message
                Response.End();                          // stop page excution
            }
            else
            {
                /*
                 * else show error message
                 */
                Response.Write("Error please log in before trying to Access this page..!"); // show error message
                Response.End();                                                             // stop page excution
            }
        }