コード例 #1
0
        // Cancell Lecture - Final Confirmation Button
        private void CancellLec_Final_Confirmation_Button(object sender, EventArgs e)
        {
            string day        = "";
            string leteralDay = cbo_Cancell_Day.Text;


            if (leteralDay == "'א")
            {
                day = "A";
            }
            else if (leteralDay == "'ב")
            {
                day = "B";
            }
            else if (leteralDay == "'ג")
            {
                day = "C";
            }
            else if (leteralDay == "'ד")
            {
                day = "D";
            }
            else if (leteralDay == "'ה")
            {
                day = "E";
            }
            else if (leteralDay == "'ו")
            {
                day = "F";
            }
            int hour = Convert.ToInt32(cbo_Cancell_Hour.Text);

            ActiveCoursesDB      actCourseDB = new ActiveCoursesDB();
            string               classroom   = actCourseDB.Get_Course_Classroom(user.Get_First_Name(), user.Get_Last_Name(), cbo_Courses.Text, day, hour);
            Requests_LecturersDB reqLectDB   = new Requests_LecturersDB();

            reqLectDB.Add_Request(user.Get_ID(), user.Get_First_Name(), user.Get_Last_Name(), CANCELL, cbo_Courses.Text, day, hour, classroom);
            Panel_Lecturer_Requests_Main.Visible = true;
            cbo_Cancell_Day.Items.Clear();
            cbo_Cancell_Day.ResetText();
            cbo_Courses.ResetText();

            cbo_Cancell_Hour.Items.Clear();
            cbo_Cancell_Hour.ResetText();
        }
コード例 #2
0
        // Add Lecture - Confirmation Button
        private void button4_Click(object sender, EventArgs e)
        {
            CoursesDB       courses_db         = new CoursesDB();
            ActiveCoursesDB actCourseDB        = new ActiveCoursesDB();
            int             day                = cbo_Day.SelectedIndex + 1;
            int             hour               = cbo_Hour.SelectedIndex + 8;
            int             numOfhoursOnCourse = courses_db.getNumHour(cbo_Courses.Text, 1); // 1 for lecturer

            if (((day == 6) && (hour + numOfhoursOnCourse > 13)) || ((day != 6) && (hour + numOfhoursOnCourse > 21)))
            {
                MessageBox.Show("Illegal hours");
            }
            else
            {
                //--fill free class list
                List <string> free_classes = new List <string>();
                actCourseDB.Fill_Free_Classes_List(free_classes, cbo_Day.SelectedIndex + 1, Convert.ToInt32(cbo_Hour.Text), cbo_Courses.Text, 1, courses_db, "Lecture");
                Requests_LecturersDB reqLec = new Requests_LecturersDB();

                reqLec.Check_Classes(free_classes);
                try {
                    if (free_classes.Count == 0)
                    {
                        throw new NullReferenceException("There are no available classrooms.");
                    }

                    string LeteralDay = cbo_Day.Text;
                    if (LeteralDay == "'א")
                    {
                        LeteralDay = "A";
                    }
                    else if (LeteralDay == "'ב")
                    {
                        LeteralDay = "B";
                    }
                    else if (LeteralDay == "'ג")
                    {
                        LeteralDay = "C";
                    }
                    else if (LeteralDay == "'ד")
                    {
                        LeteralDay = "D";
                    }
                    else if (LeteralDay == "'ה")
                    {
                        LeteralDay = "E";
                    }
                    else if (LeteralDay == "'ו")
                    {
                        LeteralDay = "F";
                    }

                    reqLec.Add_Request(user.Get_ID(), user.Get_First_Name(), user.Get_Last_Name(), ADD_LEC, cbo_Courses.Text, LeteralDay, Convert.ToInt32(cbo_Hour.Text), free_classes[0]);
                }
                catch (NullReferenceException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }


            cbo_Day.ResetText();
            cbo_Hour.ResetText();
            cbo_Courses.ResetText();

            Panel_Cancell_Lec.Visible            = true;
            Panel_Lecturer_Requests_Main.Visible = true;
        }