private void cb_hour_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            int day, hour;

            day  = cb_hour.SelectedIndex + 1;
            hour = cb_hour.SelectedIndex + 8;
            int    index         = lb_activeCourse.Text.IndexOf("-");
            string fixnumecourse = lb_activeCourse.Text.Substring(0, index);

            if (typeCourse_select.Contains("Lecture"))
            {
                int numOfhoursOnCourse = courses_db.getNumHour(lb_activeCourse.Text, 1);    //1 for lec
                if (day == 6 && (hour + numOfhoursOnCourse > 13) || day != '6' && (hour + numOfhoursOnCourse > 21))
                {
                    lb_name_lecOrtut.Items.Clear();
                    lb_class.Items.Clear();
                    MessageBox.Show("Illegal hours");
                }
                else
                {
                    //--fill free class list
                    lb_class.Items.Clear();
                    lb_name_lecOrtut.Items.Clear();
                    activecourse_db.fillfreeclasses_listBox(lb_class, cb_day, cb_hour, lb_activeCourse, 1, courses_db, numOfhoursOnCourse);

                    //--fill lecturers that can study this cours and in this time

                    lecturersdb.fillLecturers_list(lb_name_lecOrtut, fixnumecourse, day, hour, courses_db);
                }
            }
        }
Exemplo n.º 2
0
        private void cb_hourse_SelectedIndexChanged(object sender, EventArgs e)
        {
            int day, hour, numOfhoursOnCourse;

            day  = cb_day.SelectedIndex + 1;
            hour = cb_hourse.SelectedIndex + 8;
            int lecOrTut_INT = 0;

            foreach (CoursesDB item in coursesDBList)
            {
                if (lb_nameCourse.Text.Contains(item.GetName()))
                {
                    selectedCourseOBJ = item;
                    break;
                }
            }
            if (Lec_OR_Tut == "Lecture")
            {
                numOfhoursOnCourse = selectedCourseOBJ.GetNumOfLec();
                lecOrTut_INT       = 1;
            }
            else
            {
                numOfhoursOnCourse = selectedCourseOBJ.GetNumOfTut();
                lecOrTut_INT       = 2;
            }
            //-------for lecture
            if (day == 6 && (hour + numOfhoursOnCourse > 13) || day != 6 && (hour + numOfhoursOnCourse > 21))
            {
                lb_nameLec.Items.Clear();
                lb_class.Items.Clear();
                MessageBox.Show("You have exceeded the operating hours of college");
            }
            else
            {
                //--fill free class list
                lb_class.Items.Clear();
                lb_nameLec.Items.Clear();


                activecourse_db.fillfreeclasses_listBox(lb_class, cb_day, cb_hourse, lb_nameCourse, lecOrTut_INT, selectedCourseOBJ, numOfhoursOnCourse);

                //--fill lecturers that can study this cours and in this time
                if (Lec_OR_Tut == "Lecture")
                {
                    lecturersdb.fillLecturers_list(lb_nameLec, lb_nameCourse.Text, day, hour, selectedCourseOBJ);
                }
                else
                {
                    tutorsdb.fillTutors_list(lb_nameLec, lb_nameCourse.Text, day, hour, selectedCourseOBJ);
                }
            }
        }