Пример #1
0
        private void btn_Cancel_Tuition_Confirmation_Click(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_TutorsDB reqTutDB = new Requests_TutorsDB();

            reqTutDB.Add_Request(user.Get_ID(), user.Get_First_Name(), user.Get_Last_Name(), CANCELL, cbo_Courses.Text, day, hour, classroom);

            Panel_Tutor_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
        private void btn_AddLec_Confirmation_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_TutorsDB reqTutDB = new Requests_TutorsDB();
                reqTutDB.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";
                    }

                    reqTutDB.Add_Request(user.Get_ID(), user.Get_First_Name(), user.Get_Last_Name(), ADD_TUT, 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_Tut.Visible         = true;
            Panel_Tutor_Requests_Main.Visible = true;
        }