예제 #1
0
 private void cmbTaughtCourse_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.cmbTaughtCourse.SelectedIndex != -1)
     {
         TaughtCourse tCourse = (TaughtCourse)this.cmbTaughtCourse.SelectedItem;
         int          count   = 0;
         //searches and sets the course in combobox
         foreach (Course cou in cmbCourse.Items)
         {
             if (cou.getID() == tCourse.CourseID)
             {
                 this.cmbCourse.SelectedIndex = count;
             }
             count++;
         }
         count = 0;
         //searches and sets the semester in combobox
         foreach (String sem in cmbSemester.Items)
         {
             if (sem == tCourse.Semester)
             {
                 this.cmbSemester.SelectedIndex = count;
             }
             count++;
         }
         this.txtYear.Text = tCourse.Year;
     }
 }
예제 #2
0
        public datosInscripcion(BusinessController control, Student alumno, TaughtCourse tc, Enrollment enrollment)
        {
            InitializeComponent();
            this.businessControl = control;
            this.student         = alumno;
            this.tc     = tc;
            this.enroll = enrollment;
            student     = alumno;
            enroll      = enrollment;


            this.estudianteAnadir = alumno;
            this.cursoImAnadir    = tc;
            dal = GestAcaDAL.getGestAcaDAL();

            nameLabel.Text        = alumno.Name;
            infoIdLabel.Text      = alumno.Id;
            infoAddressLabel.Text = alumno.Address;
            infoZipCodeLabel.Text = alumno.ZipCode.ToString();
            infoIBANLabel.Text    = alumno.IBAN;

            //infoIdEnrollment.Text = enrollment.Id.ToString();

            infoCourseLabel.Text     = tc.Course.Name;
            infoIDCourseLabel.Text   = tc.Id.ToString();
            infoTimesLabel.Text      = "During  " + tc.TeachingDay.ToString() + "  from  " + tc.StartDateTime.ToString() + "  to  " + tc.EndTime.ToString();
            infoDurationLabel.Text   = tc.SessionDuration.ToString() + " minutes";
            infoQuotaLabel.Text      = tc.Quota.ToString();
            infoTotalPriceLabel.Text = tc.TotalPrice.ToString();
        }
        public void addEnrollment(Enrollment enrollment)
        {
            Enrollment e = null;

            if (enrollment.TaughtCourse == null)
            {
                return;
            }
            TaughtCourse tg = enrollment.TaughtCourse;

            try
            {
                foreach (Enrollment en in tg.Enrollments)
                {
                    if (en != null && en.Id == enrollment.Id)
                    {
                        e = en;
                    }
                }
            }
            catch (TargetInvocationException ex)
            {
            }
            if (e != null)
            {
                throw new BusinessLogicException("este enrollment ya existe!!");
            }
            dal.enrollmentDAO.addEnrollment(enrollment);
        }
예제 #4
0
        private void enroll(object sender, EventArgs e)
        {
            DateTime initDate        = Convert.ToDateTime(dtInicio.Text);
            DateTime endDate         = Convert.ToDateTime(dtFin.Text);
            int      id              = Convert.ToInt16(numID.Value);
            string   day             = numSesiones.Value.ToString();
            int      quota           = Convert.ToInt16(numCuota.Value);
            int      sessionDuration = Convert.ToInt16(numDuracionSesion.Value);
            int      totalPrice      = Convert.ToInt16(numPrecio.Value);
            Course   courseAux       = (Course)taughtCourseCB.SelectedItem;

            if (courseAux == null)
            {
                MessageBox.Show("No se ha seleccionado ningun curso.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Course course = businessController.findCourseById(courseAux.Id);

            try
            {
                TaughtCourse taughtCourse = new TaughtCourse(initDate, endDate, id, day, quota, sessionDuration, totalPrice, course);
                businessController.addTaughtCourse(taughtCourse);
                this.Close();
            } catch (Exception ex)
            {
                MessageBox.Show("Error insertando curso. " + ex.Message, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        public void addEnrollment(Enrollment enrollment)
        {
            TaughtCourse tc = dal.taughtcourseDAO.findTaughtCourseById(enrollment.TaughtCourse.Id);

            if (tc == null)
            {
                throw new BusinessLogicException("TaughtCourse no existe");
            }
            Student est = dal.studentDAO.findStudentById(enrollment.Student.Id);

            if (est == null)
            {
                throw new BusinessLogicException("Estudiante no existe");
            }
            foreach (Enrollment en in tc.Enrollments)
            {
                Student est2 = dal.studentDAO.findStudentById(en.Student.Id);
                if (est2 == est)
                {
                    throw new BusinessLogicException("Estudiante ya en el curso");
                }
            }
            if (dal.enrollmentDAO.findEnrollmentByID(enrollment.Id) == null)
            {
                dal.enrollmentDAO.addEnrollment(enrollment);
            }
            else
            {
                throw new BusinessLogicException("Enrollment ya existe");
            }
        }
예제 #6
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
        }
예제 #7
0
        public void assignTeacherToTaughtCourse(string teacherId, int taughtCourseId)
        {
            Teacher      teacher      = dal.teacherDAO.findTeacherById(teacherId);
            TaughtCourse taughtCourse = dal.taughtcourseDAO.findTaughtCourseById(taughtCourseId);

            if (teacher == null)
            {
                throw new BusinessLogicException("Este Profesor no existe");
            }

            if (taughtCourse == null)
            {
                throw new BusinessLogicException("Este Grupo no existe");
            }

            foreach (TaughtCourse tc in teacher.TaughtCourses)
            {
                if (tc.TeachingDay == taughtCourse.TeachingDay && (

                        (taughtCourse.StartDateTime == tc.StartDateTime || taughtCourse.EndTime == tc.EndTime) ||
                        (taughtCourse.StartDateTime < tc.StartDateTime && taughtCourse.EndTime > tc.StartDateTime) ||
                        (taughtCourse.StartDateTime < tc.EndTime && taughtCourse.EndTime > tc.EndTime) ||
                        (taughtCourse.StartDateTime > tc.StartDateTime && taughtCourse.EndTime < tc.EndTime) ||
                        (taughtCourse.StartDateTime < tc.StartDateTime && taughtCourse.EndTime > tc.EndTime)

                        )
                    )
                {
                    throw new BusinessLogicException("El Profesor ya tiene este horario ocupado o ya esta impartiendo este curso");
                }
            }
            teacher.TaughtCourses.Add(taughtCourse);
            taughtCourse.Teacher = teacher;
            dal.SaveChanges();
        }
예제 #8
0
        /*
         * Method: GenerateAllClassessGridData
         * Areguments: none
         * Return: none
         * Des: this method is to fill the all classes GridView with data
         */

        protected void GenerateMyClassessGridData()
        {
            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");


            sectionsList.Filter("InstructorID", InsId);             // filter the sectionList with the instructor id
            foreach (Section section in sectionsList.List)
            {
                /* foreach element in the sectionList */

                taughtList.Filter("TaughtCourseID", section.TaughtCourseID);            // filter the taughtCourseList with the taughtCourseID
                TaughtCourse taughtcourse = (TaughtCourse)taughtList.List.ElementAt(0); // get the first elment from the list and cast it to (TaughtCourse)
                courseList.Filter("CourseID", taughtcourse.CourseID);                   // filter the courseList with courseID
                Course course = (Course)courseList.List.ElementAt(0);                   // get the first elment from the list and cast it to (Course)

                table.Rows.Add(taughtcourse.CourseID, section.getID(), course.Title);   // add information as row to the table object
            }

            myclassListGrid.DataSource = table;      // set table as the dataSource of the grid view
            myclassListGrid.DataBind();              // bind the data
        }
예제 #9
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //prompts a validation message to ensure selection
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete this taught course?",
                                                        "Delete Notice", MessageBoxButtons.YesNo);

            //if yes, the taught course object is created and passed to be deleted
            if (dialogResult == DialogResult.Yes)
            {
                TaughtCourse tCourse = (TaughtCourse)this.cmbTaughtID.SelectedItem;
                //Delete All Related Records First
                //From Schedule Table
                scheduleList.Delete("Section", "Section.SectionID", "Schedule.SectionID", "Section.TaughtCourseID", cmbTaughtID.SelectedItem.ToString());
                //From SectionStudent Table
                sectionStudentList.Delete("Section", "Section.SectionID", "SectionStudent.SectionID", "Section.TaughtCourseID", cmbTaughtID.SelectedItem.ToString());
                //From Section Table
                sectionList.Delete("TaughtCourseID", cmbTaughtID.SelectedItem.ToString());
                //Delete Taught Course From Taught Courses Table Second
                taughtCourses.Delete(tCourse);
                //checks if the execution was a seccuess or not
                if (tCourse.getValid() == true)
                {
                    MessageBox.Show("Taught Course has been deleted successfully.");
                }
                else
                {
                    MessageBox.Show("An error has occured. Record was not deleted.");
                }
                loadTCourses();
            }
        }
예제 #10
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 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
        }
 public void assignTeacherToTaughtCourse(Teacher teacher, TaughtCourse tc)
 {
     if (tc.Teacher != null)
     {
         throw new BusinessLogicException("Este curso ya tiene un profesor asignado.");
     }
     tc.Teacher = teacher;
     dal.SaveChanges();
     /*check dates*/
 }
예제 #12
0
 public void addTaughtCourse(TaughtCourse tau)
 {
     if (dal.taughtcourseDAO.findTaughtCourseById(tau.Id) == null)
     {
         dal.taughtcourseDAO.addTaughtCourse(tau);
     }
     else
     {
         throw new BusinessLogicException("Este curso ya existe.");
     }
 }
 public void addTaughtCourse(TaughtCourse taughtCourse)
 {
     try
     {
         dbcontext.taughtCourses.Add(taughtCourse);
         dbcontext.SaveChanges();
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e.ToString());
     }
 }
        public void assignTeacherToTaughtCourse(string teacherId, int taughtCourseId)
        {
            Teacher      teacher = dal.teacherDAO.findTeacherById(teacherId);
            TaughtCourse tc      = dal.taughtCourseDAO.findTaughtCourseById(taughtCourseId);

            try {
                assignTeacherToTaughtCourse(teacher, tc);
            }
            catch {
                throw;
            }
        }
예제 #15
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //foreach loop that checks all controls and whether if they are empty or not.
            bool isEmpty = false;

            foreach (Control ctl in this.Controls.OfType <ComboBox>())
            {
                if (ctl.Text == "" || ctl.Text == null)
                {
                    isEmpty = true;
                }
            }
            if (isEmpty == false)
            {
                //create an object and set properties
                TaughtCourse tCourse = (TaughtCourse)this.cmbTaughtCourse.SelectedItem;
                tCourse.Semester = this.cmbSemester.SelectedItem.ToString();
                tCourse.CourseID = this.cmbCourse.SelectedItem.ToString();
                //checks if the capacity entered is a number by checking each character in the number
                bool isValid = false;
                foreach (char c in this.txtYear.Text.ToString())
                {
                    if (c < '0' || c > '9')
                    {
                        isValid = false;
                    }
                    else
                    {
                        isValid = true;
                    }
                }
                //if valid, set the year. if not, set the default value
                if (isValid)
                {
                    tCourse.Year = this.txtYear.Text.ToString();
                }
                else
                {
                    tCourse.Year = "0000";
                    MessageBox.Show("Year entered is invalid.");
                }
                //updates the created taught course object
                taughtCourses.Update(tCourse);
                if (tCourse.getValid() == true)
                {
                    MessageBox.Show("Taught Course have been updated successfully.");
                }
                else
                {
                    MessageBox.Show("An error has occured. Record was not updated.");
                }
            }
        }
        public introducirEnrollmentId(BusinessController control, Student alumno, TaughtCourse tcourse)
        {
            InitializeComponent();
            this.businessControl = control;
            this.student         = alumno;
            this.Tc = tcourse;
            student = alumno;

            this.estudianteAnadir = alumno;
            this.cursoImAnadir    = tcourse;
            dal = GestAcaDAL.getGestAcaDAL();
        }
예제 #17
0
        /*
         * 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
                    }
                }
            }
        }
 public void removeTaughtCourse(TaughtCourse tc)
 {
     try
     {
         dbcontext.taughtcourses.Remove(tc);
         dbcontext.SaveChanges();
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e.ToString());
     }
 }
        public AssignTeacherSelection()
        {
            InitializeComponent();
            controller = BusinessController.getBusinessController();
            ICollection <TaughtCourse> courses  = controller.findAllTaughtCourses();
            ICollection <Teacher>      teachers = controller.findAllTeachers();
            TaughtCourse selectedTaughtCourse   = null;

            courseSelection.DataSource  = courses;
            teacherSelection.DataSource = teachers;
            toggleTaughtCourseVisibility(false);
            selectedTeacher = null;
        }
예제 #20
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //create a TaughtCourse object to be used to store information
            TaughtCourse tCourse = new TaughtCourse();

            //setting the properties of the object
            tCourse.setID(this.txtTaughtID.Text.ToString());
            tCourse.CourseID = this.cmbCourseID.SelectedItem.ToString();
            tCourse.Semester = this.cmbSemester.SelectedItem.ToString();
            //checks if the capacity entered is a number
            Boolean isValid = true;

            foreach (char c in this.txtYear.Text.ToString())
            {
                //checks the cahracter is between 0 or 9  and set the boolean to false if not
                if (c < '0' || c > '9')
                {
                    isValid = false;
                }
            }
            //if the string contains only numbers then set the proeprty
            if (isValid)
            {
                tCourse.Year = this.txtYear.Text.ToString();
            }
            else
            {
                //if invalid input, set the default value 0000 and show a message
                tCourse.Year = "0000";
                MessageBox.Show("Year entered is invalid.");
            }
            //call the add method and pass the TaughtCourse object as a parameter
            taughtCourses.Add(tCourse);
            //checks if the execution was a success or not
            if (tCourse.getValid() == true)
            {
                MessageBox.Show("Taught course have been added successfully.");
                //This calls two methods to get the new id and clears old information
                clear();
                nextID();
            }
            else
            {
                //prompt an error message for user indicating error
                MessageBox.Show("An error has occured. record was not added.");
            }
        }
 private void updateTaughtCourseInfo(TaughtCourse tc)
 {
     totalPriceText.Text = tc.TotalPrice + "EUR";
     quotaText.Text      = tc.Quota + "EUR";
     sessionsText.Text   = tc.SessionDuration + "";
     startDateText.Text  = tc.StartDateTime.ToShortDateString();
     endDateText.Text    = tc.EndTime.ToShortDateString();
     courseText.Text     = tc.Course.Name;
     if (tc.Teacher != null)
     {
         courseIsTaught.Text = "Este curso esta siendo impartido por " + tc.Teacher.Name + ".";
     }
     else
     {
         courseIsTaught.Text = "Este curso no esta siendo impartido por nadie.";
     }
 }
        private void courseSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (teacherSelection.SelectedIndex < 0)
            {
                toggleTaughtCourseVisibility(false);
                return;
            }
            TaughtCourse tc = (TaughtCourse)courseSelection.Items[courseSelection.SelectedIndex];

            if (tc == null)
            {
                toggleTaughtCourseVisibility(false);
                return;
            }
            selectedCourse = tc;
            updateTaughtCourseInfo(tc);
            toggleTaughtCourseVisibility(true);
        }
예제 #23
0
        private void button2_Click(object sender, EventArgs e)
        {
            int selectedRowCount = tabla.Rows.GetRowCount(DataGridViewElementStates.Selected);

            if (selectedRowCount == 0)
            {
                DialogResult answer = MessageBox.Show(this, "Debe seleccionar un curso", "Error",
                                                      MessageBoxButtons.OK,
                                                      MessageBoxIcon.Error
                                                      );
            }
            else
            {
                id      = (int)tabla.CurrentRow.Cells["dis_ID"].Value;
                Tcourse = businessControl.findTaughtCourseById(id);
                vdni    = new introducirDNI(businessControl, Tcourse);
                this.vdni.ShowDialog();
            }
        }
        public void addTaughtCourse(TaughtCourse taughtCourse)
        {
            TaughtCourse tc = (TaughtCourse)findTaughtCourseById(taughtCourse.Id);

            //si el taughtCourse a añadir es un curso y todavía no se imparte
            if (tc == null)
            {
                if (taughtCourse.EndTime.CompareTo(taughtCourse.StartDateTime) < 0)
                {
                    throw new BusinessLogicException("El curso no puede terminar antes de haber empezado.");
                }
                else
                {
                    dal.taughtCourseDAO.addTaughtCourse(taughtCourse);
                }
            }
            else
            {
                throw new BusinessLogicException("Ya existe este un curso impartido con esta ID.");
            }
        }
예제 #25
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
        }
예제 #26
0
 internal void addTaughtCourse(TaughtCourse taughtCourse)
 {
     taughtCourses.Add(taughtCourse);
 }
 private void taughtCoursesList_SelectedIndexChanged(object sender, EventArgs e)
 {
     myCourse = (TaughtCourse)taughtCoursesList.SelectedItem;
 }
예제 #28
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
            }
        }
예제 #29
0
 public void addTaughtCourse(TaughtCourse taughtCourse)
 {
     throw new NotImplementedException();
 }
예제 #30
0
 public introducirDNI(BusinessController control, TaughtCourse Tc)
 {
     InitializeComponent();
     this.businessControl = control;
     this.Tcurso          = Tc;
 }