private void dataGridView_schedule_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int r = dataGridView_schedule.CurrentCell.RowIndex;
            int c = dataGridView_schedule.CurrentCell.ColumnIndex;

            string[] days = { "Hours", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };

            string   Hour = dataGridView_schedule.Rows[r].Cells[0].Value.ToString();
            DateTime dt   = System.Convert.ToDateTime(Hour);

            //dt = dt.AddMinutes(30);

            if (secretary != null)
            {
                if (checkBox_LessonsOfStudentSelected.Checked)
                {
                    selected_lesson = secretary.getLessonStudentByDayAndHour(selected_student, days[c], dt);
                }
                else if (selected_course != null)
                {
                    List <Lesson> listOfLessonsAtTheSameTime = secretary.getLessonCourseByDayAndHour(selected_course, days[c], dt);
                    if (listOfLessonsAtTheSameTime != null && listOfLessonsAtTheSameTime.Count > 0)
                    {
                        selected_lesson = listOfLessonsAtTheSameTime.ElementAt(0);
                    }
                    else
                    {
                        selected_lesson = null;
                    }
                }
            }
            else if (admin != null)
            {
                if (checkBox_LessonsOfStudentSelected.Checked)
                {
                    selected_lesson = admin.getLessonStudentByDayAndHour(selected_student, days[c], dt);
                }
                else if (selected_course != null)
                {
                    List <Lesson> listOfLessonsAtTheSameTime = admin.getLessonCourseByDayAndHour(selected_course, days[c], dt);
                    if (listOfLessonsAtTheSameTime != null && listOfLessonsAtTheSameTime.Count > 0)
                    {
                        selected_lesson = listOfLessonsAtTheSameTime.ElementAt(0);
                    }
                    else
                    {
                        selected_lesson = null;
                    }
                }
            }
            else if (student != null)
            {
                if (checkBox_LessonsOfStudentSelected.Checked)
                {
                    selected_lesson = student.getLessonOfMineByDayAndHour(days[c], dt);
                }
                else if (selected_course != null)
                {
                    List <Lesson> listOfLessonsAtTheSameTime = student.getLessonCourseByDayAndHour(selected_course, days[c], dt);
                    if (listOfLessonsAtTheSameTime != null && listOfLessonsAtTheSameTime.Count > 0)
                    {
                        selected_lesson = listOfLessonsAtTheSameTime.ElementAt(0);
                    }
                    else
                    {
                        selected_lesson = null;
                    }
                }
            }
            else
            {
                selected_lesson = null;
            }

            updateButtons();
        }
示例#2
0
 public bool ScheduleLessonLabToPractitionerInCourse(Practitioner prac, Course c, Lesson les)
 {
     if (SettingDatabase.PractitionerHasMoreThenAllowsHours(prac, les))
     {
         MessageBox.Show("Can't register any more lessons to this Practitioner, because he above more then 16 weekly hours teaching");
         return(false);
     }
     return(SettingDatabase.AddLabInCourseToPractitioner(prac, c, les));
 }
        private void setLessons()
        {
            list_lessons    = null;
            selected_lesson = null;

            if (checkBox_LessonsOfStudentSelected.Checked && selected_student != null)
            {
                if (checkBox_onlyLabs.Checked && checkBox_onlyLectures.Checked && checkBox_onlyPractises.Checked)
                {
                    setAllLessonOfStudent();
                }
                else
                {
                    list_lessons = new List <Lesson>();

                    if (checkBox_onlyLabs.Checked)
                    {
                        setAllLabsLessonOfStudent();
                    }
                    if (checkBox_onlyLectures.Checked)
                    {
                        setAllLecturesLessonOfStudent();
                    }
                    if (checkBox_onlyPractises.Checked)
                    {
                        setAllPractisesLessonOfStudent();
                    }
                }
            }
            else if (selected_course != null)
            {
                checkBox_LessonsOfStudentSelected.Checked = false;

                if (checkBox_onlyLabs.Checked && checkBox_onlyLectures.Checked && checkBox_onlyPractises.Checked)
                {
                    setAllLessonOfCourse();
                }
                else
                {
                    list_lessons = new List <Lesson>();

                    if (checkBox_onlyLabs.Checked)
                    {
                        setAllLabsLessonOfCourse();
                    }
                    if (checkBox_onlyLectures.Checked)
                    {
                        setAllLecturesLessonOfCourse();
                    }
                    if (checkBox_onlyPractises.Checked)
                    {
                        setAllPractisesLessonOfCourse();
                    }
                }
            }
            else
            {
                checkBox_LessonsOfStudentSelected.Checked = false;
                checkBox_onlyLabs.Checked      = true;
                checkBox_onlyLectures.Checked  = true;
                checkBox_onlyPractises.Checked = true;
            }
        }