private void resetDetail(int x = 6)
        {
            if (x >= 0)
            {
                btn_Add.Enabled = false;
            }
            if (x >= 1)
            {
                txt_TB_infoLesson.Text    = "";
                txt_TB_infoLesson.Enabled = false;
            }
            if (x >= 2)
            {
                txt_TB_NumStudents.Text    = "";
                txt_TB_NumStudents.Enabled = false;
            }
            if (x >= 3)
            {
                txt_CB_type.Text    = "";
                txt_CB_type.Enabled = false;
            }
            if (x >= 4)
            {
                txt_CB_TimeStart.Text    = "";
                txt_CB_TimeStart.Enabled = false;
                lbl_TB_End.Text          = "";
                setTimeOnce = false;
            }
            if (x >= 5)
            {
                txt_CB_days.Text    = "";
                txt_CB_days.Enabled = false;

                checkBox_classroom.Checked = false;
                selected_classRoom         = null;

                list_Counstraints = null;
                listView_constraints.Items.Clear();
                checkBox_constraint.Checked = false;
                selected_constraint         = null;
            }
            if (x >= 6)
            {
                txt_CB_coursesApproved.Text = "";
                txt_CB_days.Text            = "";
                txt_CB_TimeStart.Text       = "";
                txt_TB_infoLesson.Text      = "";
                txt_CB_type.Text            = "";
                txt_TB_NumStudents.Text     = "";

                selected_constraint = null;
                list_Counstraints   = null;
                listView_constraints.Items.Clear();
                checkBox_constraint.Checked = false;

                selected_classRoom = null;
                list_classes       = null;
                listView_freeClasses.Items.Clear();
                checkBox_classroom.Checked = false;

                selected_course = null;
                selected_lesson = null;

                txt_CB_coursesApproved.Text    = "";
                txt_CB_coursesApproved.Enabled = false;
                resetDataTimeTable();
                setEmptyDataInGridView();
            }
        }
        private void updateButtons()
        {
            if (selected_lesson != null)
            {
                if (checkBox_LessonsOfStudentSelected.Checked != true)
                {
                    btn_Add.Enabled          = true;
                    btn_RemoveLesson.Enabled = false;
                }
                else
                {
                    btn_Add.Enabled          = false;
                    btn_RemoveLesson.Enabled = true;
                }

                checkBox_Lesson.Checked = true;
                txt_lbl_day.Text        = selected_lesson.Day;
                txt_lbl_End.Text        = GeneralFuntion.formatTime(selected_lesson.End);
                txt_lbl_Start.Text      = GeneralFuntion.formatTime(selected_lesson.Start);
                txt_lbl_Type.Text       = selected_lesson.Type;
                txt_TB_infoLesson.Text  = selected_lesson.InfoLesson;
                string nameTeacher    = "";
                int    amountStudent  = 0;
                int    maxStudInClass = 0;

                ClassRoom classroom = dal.class_rooms.Where(x => x.building.Equals(selected_lesson.building) && x.number == selected_lesson.number).FirstOrDefault();

                if (classroom != null)
                {
                    maxStudInClass = classroom.maxStudents;
                }

                if (selected_lesson.Type.Equals("Lecture"))
                {
                    Lecturer l = dal.lecturers.Find(selected_lesson.LTeacherID);
                    if (l != null)
                    {
                        nameTeacher = "L" + l.ID.ToString() + " : " + l.Name;
                    }
                    if (secretary != null)
                    {
                        Lecture lecture = secretary.geLectureFromLesson(selected_lesson);
                        if (lecture != null)
                        {
                            amountStudent = lecture.NumStudent;
                        }
                    }
                    else if (admin != null)
                    {
                        Lecture lecture = admin.geLectureFromLesson(selected_lesson);
                        if (lecture != null)
                        {
                            amountStudent = lecture.NumStudent;
                        }
                    }
                    else if (student != null)
                    {
                        Lecture lecture = SettingDatabase.geLectureFromLesson(selected_lesson);
                        if (lecture != null)
                        {
                            amountStudent = lecture.NumStudent;
                        }
                    }
                }
                else
                {
                    Practitioner p = dal.practitiners.Find(selected_lesson.LTeacherID);
                    if (p != null)
                    {
                        nameTeacher = "P" + p.ID.ToString() + " : " + p.Name;
                    }
                    if (secretary != null)
                    {
                        if (selected_lesson.Type.Equals("Practise"))
                        {
                            Practise Practise = secretary.getPractiseFormLesson(selected_lesson);
                            if (Practise != null)
                            {
                                amountStudent = Practise.NumStudent;
                            }
                        }
                        else if (selected_lesson.Type.Equals("Lab"))
                        {
                            Lab lab = secretary.geLabFromLesson(selected_lesson);
                            if (lab != null)
                            {
                                amountStudent = lab.NumStudent;
                            }
                        }

                        else if (student != null)
                        {
                            Lab lab = SettingDatabase.geLabFromLesson(selected_lesson);
                            if (lab != null)
                            {
                                amountStudent = lab.NumStudent;
                            }
                        }
                    }
                    else if (admin != null)
                    {
                        if (selected_lesson.Type.Equals("Practise"))
                        {
                            Practise Practise = admin.getPractiseFormLesson(selected_lesson);
                            if (Practise != null)
                            {
                                amountStudent = Practise.NumStudent;
                            }
                        }
                        else if (selected_lesson.Type.Equals("Lab"))
                        {
                            Lab lab = admin.geLabFromLesson(selected_lesson);
                            if (lab != null)
                            {
                                amountStudent = lab.NumStudent;
                            }
                        }
                    }
                }

                txt_lbl_teacher.Text = nameTeacher;
                if (maxStudInClass == 0)
                {
                    maxStudInClass = amountStudent;
                }
                txt_lbl_NumCurrentStudents.Text = amountStudent.ToString() + " / " + maxStudInClass.ToString();
            }
            else
            {
                btn_RemoveLesson.Enabled        = false;
                btn_Add.Enabled                 = false;
                txt_lbl_day.Text                = "";
                txt_lbl_End.Text                = "";
                txt_lbl_Start.Text              = "";
                txt_lbl_Type.Text               = "";
                txt_lbl_teacher.Text            = "";
                txt_lbl_NumCurrentStudents.Text = "";
            }
        }