private void btnCreateLesson_Click(object sender, EventArgs e)
        {
            string txtLessonTheme   = this.txtLessonTheme.Text,
                   txtNumberOfHours = this.comboBoxNHours.SelectedItem.ToString(),
                   txtHomeTask      = this.txtHomeTask.Text;

            if (string.IsNullOrEmpty(txtLessonTheme))
            {
                ShowExceptionMessage("Lesson theme cannot be empty!");
                return;
            }
            if (string.IsNullOrEmpty(txtNumberOfHours))
            {
                ShowExceptionMessage("Number of hours cannot be empty!");
                return;
            }
            int numberOfHours = 0;

            if (!int.TryParse(txtNumberOfHours, out numberOfHours))
            {
                ShowExceptionMessage("Incorrect hours number format!");
                return;
            }

            int studentsInGradeCount = StudentDAL.GetStudentCountByGradeName(comboGrade.SelectedItem.ToString());

            if (studentsInGradeCount == 0)
            {
                MessageBox.Show(string.Format("No students in grade {0}!\nAsk administrator to add some!",
                                              comboGrade.SelectedItem.ToString()),
                                "Impossible to create lesson!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                ILessonInfo newLesson = LessonDAL.StartNewLesson(comboBoxSubject.SelectedItem.ToString(),
                                                                 txtLessonTheme,
                                                                 numberOfHours,
                                                                 comboGrade.SelectedItem.ToString(),
                                                                 txtHomeTask,
                                                                 this.TeacherID);

                NewLessonWindow nlWindow = new NewLessonWindow(this.TeacherID, newLesson);

                nlWindow.Owner = this.Owner;
                nlWindow.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                ShowExceptionMessage(ex.Message);
                return;
            }
        }
        private void btnCreateLesson_Click(object sender, EventArgs e)
        {
            string txtLessonTheme = this.txtLessonTheme.Text,
                   txtNumberOfHours = this.comboBoxNHours.SelectedItem.ToString(),
                   txtHomeTask = this.txtHomeTask.Text;

            if (string.IsNullOrEmpty(txtLessonTheme))
            {
                ShowExceptionMessage("Lesson theme cannot be empty!");
                return;
            }
            if (string.IsNullOrEmpty(txtNumberOfHours))
            {
                ShowExceptionMessage("Number of hours cannot be empty!");
                return;
            }
            int numberOfHours = 0;
            if(!int.TryParse(txtNumberOfHours, out numberOfHours))
            {
                ShowExceptionMessage("Incorrect hours number format!");
                return;
            }

            int studentsInGradeCount = StudentDAL.GetStudentCountByGradeName(comboGrade.SelectedItem.ToString());
            if (studentsInGradeCount == 0)
            {
                MessageBox.Show(string.Format("No students in grade {0}!\nAsk administrator to add some!",
                    comboGrade.SelectedItem.ToString()),
                    "Impossible to create lesson!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                ILessonInfo newLesson = LessonDAL.StartNewLesson(comboBoxSubject.SelectedItem.ToString(),
                                         txtLessonTheme,
                                         numberOfHours,
                                         comboGrade.SelectedItem.ToString(),
                                         txtHomeTask,
                                         this.TeacherID);

                NewLessonWindow nlWindow = new NewLessonWindow(this.TeacherID, newLesson);

                nlWindow.Owner = this.Owner;
                nlWindow.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                ShowExceptionMessage(ex.Message);
                return;
            }
        }