private void AddTeacher_button_Click(object sender, EventArgs e)
        {
            if (TeacherName_textBox.Text != "" && TeacherSurname_textBox.Text != "" &&
                Subject_comboBox.SelectedIndex > -1 && Cabinet_comboBox.SelectedIndex > -1)
            {
                try
                {
                    bool result = AddDataToDataBase.AddTeacher(TeacherName_textBox.Text, TeacherSurname_textBox.Text,
                                                               Subject_comboBox.SelectedValue.ToString(), Cabinet_comboBox.SelectedValue.ToString());

                    if (result)
                    {
                        TeacherName_textBox.Clear();
                        TeacherSurname_textBox.Clear();
                        UpdateAddTeacherComboboxes();
                        MessageBox.Show(@"Teacher has been added.");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(@"Something went wrong.");
                }
            }
            else
            {
                MessageBox.Show(@"Fill all gaps");
            }
        }
        private void AddPupil_button_Click(object sender, EventArgs e)
        {
            if (PupilName_textBox.Text != "" && PupilSurname_textBox.Text != "" && Group_comboBox.SelectedIndex > -1)
            {
                try
                {
                    bool result = AddDataToDataBase.AddPupil(PupilName_textBox.Text, PupilSurname_textBox.Text,
                                                             PupilEmail_textBox.Text,
                                                             Group_comboBox.SelectedValue.ToString(),
                                                             DateTime.Parse(PupilEntraceYear_dateTimePicker.Value.ToString(CultureInfo.InvariantCulture)).Year
                                                             .ToString());

                    if (result)
                    {
                        PupilName_textBox.Clear();
                        PupilSurname_textBox.Clear();
                        PupilEmail_textBox.Clear();
                        UpdateAddPupilCombobox();
                        PupilEntraceYear_dateTimePicker.Value = new DateTime(2019, 1, 1);
                        MessageBox.Show(@"Pupil has been added.");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(@"Something went wrong.");
                }
            }
            else
            {
                MessageBox.Show(@"Fill all gaps");
            }
        }
 private void AddCabinet_button_Click(object sender, EventArgs e)
 {
     if (int.TryParse(CabinetNumber_textBox.Text, out int cabinet))
     {
         try
         {
             var result = AddDataToDataBase.AddCabinet(cabinet);
             if (result)
             {
                 CabinetNumber_textBox.Clear();
                 MessageBox.Show(@"Cabinet has been added.");
             }
         }
         catch (Exception)
         {
             MessageBox.Show(@"Something went wrong.");
         }
     }
     else
     {
         MessageBox.Show(@"Enter cabinet number correctly.");
     }
 }
 private void AddSubject_button_Click(object sender, EventArgs e)
 {
     if (SubjectName_textBox.Text != "")
     {
         try
         {
             var result = AddDataToDataBase.AddSubject(SubjectName_textBox.Text);
             if (result)
             {
                 SubjectName_textBox.Clear();
                 MessageBox.Show(@"Subject has been added.");
             }
         }
         catch (Exception)
         {
             MessageBox.Show(@"Something went wrong.");
         }
     }
     else
     {
         MessageBox.Show(@"Enter subject name.");
     }
 }