예제 #1
0
        public EditClassForm()
        {
            InitializeComponent();

            Util.addProfessors(cbEditClassProfessorFilter, profFilterId, false, true, null, null);
            Util.addProfessors(cbClassProfessor, profId, false, false, null, null);


            Util.addClasses(cbEditClass, classId, false, false, null, null);
            Util.addSemesters(cbSemester, semesterId, false);
            Util.addSemesters(cbEditClassSemesterFilter, semesterFilterId, true);
        }
예제 #2
0
        public EditSemesterForm()
        {
            InitializeComponent();

            //set start and end dates to current date
            dtSemesterStartDate.Value = DateTime.Now;
            dtSemesterEndDate.Value   = DateTime.Now;

            Util.addSemesters(cbEditSemester, semesterId, false);

            updateSemesterButtons();
        }
예제 #3
0
        public AddClassForm()
        {
            InitializeComponent();

            //dynamically add professors to combo box
            Util.addProfessors(cbClassProfessor, profId, false, false, null, null);

            //dynamically add possible grades
            Util.addLetterGrades(cbFinalLetterGrade);

            //dynamically add possible semesters
            Util.addSemesters(cbSemester, semesterId, false);
        }
예제 #4
0
        private bool saveSemester()
        {
            //ensure a semester name was entered
            if (txtSemesterName.Text.Equals(""))
            {
                Util.displayRequiredFieldsError("Semester Name");
            }
            //ensure a semester with the same semester id does not already exist
            else if (semesterId[cbEditSemester.SelectedIndex] != ctrSemesterNum.Value && Database.attributeExists("semesterID = '" + ctrSemesterNum.Value + "'", "Semester"))
            {
                Util.displayError("The Entered Semester Number Already Exists", "Invalid Semester Number");
            }
            //ensure the end semester date occurs on or after the start semester date
            else if (dtSemesterEndDate.Value < dtSemesterStartDate.Value)
            {
                Util.displayError("The End Date Must Be Later Than The Start Date", "Invalid Semester Dates");
            }
            else
            {
                //update the semester fields in the database
                Database.modifyDatabase("UPDATE Semester SET Name = " + Util.quote(txtSemesterName.Text)
                                        + ", StartDate = DATE('" + Database.getDate(dtSemesterStartDate.Value) + "')"
                                        + ", StartDate = DATE('" + Database.getDate(dtSemesterEndDate.Value) + "')"
                                        + " WHERE SemesterID = '" + semesterId[cbEditSemester.SelectedIndex] + "';");

                //update semester id if necessary
                if (semesterId[cbEditSemester.SelectedIndex] != ctrSemesterNum.Value)
                {
                    Database.modifyDatabase("UPDATE Semester SET SemesterID = '" + ctrSemesterNum.Value + "'"
                                            + " WHERE SemesterID = '" + semesterId[cbEditSemester.SelectedIndex] + "';");
                }

                //refresh values in semester combobox
                int previousIndex = cbEditSemester.SelectedIndex;
                Util.addSemesters(cbEditSemester, semesterId, false);
                cbEditSemester.SelectedIndex = previousIndex;

                return(true);
            }
            return(false);
        }