private void AddEmployeeButton_Click(object sender, EventArgs e)
        {
            EmployeeForm addEmployeeForm = new EmployeeForm(dataBase.Departments, selectedDepartment, "Новый сотрудник");

            // Валидация
            bool correctValuesEntered = false;

            while (correctValuesEntered == false)
            {
                DialogResult dialogResult = addEmployeeForm.ShowDialog(this);
                if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }
                correctValuesEntered = addEmployeeForm.RunValidation();
            }

            #region Set new Employee fields
            Employee newEmployee = new Employee();
            newEmployee.SurName     = addEmployeeForm.surnameTextBox.Text;
            newEmployee.FirstName   = addEmployeeForm.firstNameTextBox.Text;
            newEmployee.Patronymic  = addEmployeeForm.patronymicTextBox.Text;
            newEmployee.DateOfBirth = addEmployeeForm.dateOfBirthDateTimePicker.Value.Date;
            newEmployee.DocSeries   = addEmployeeForm.docSeriesTextBox.Text;
            newEmployee.DocNumber   = addEmployeeForm.docNumberTextBox.Text;
            newEmployee.Position    = addEmployeeForm.positionTextBox.Text;
            Department selectedInAddFormDepartment = (Department)addEmployeeForm.departmentComboBox.SelectedItem;
            newEmployee.DepartmentID = selectedInAddFormDepartment.ID;
            #endregion

            dataBase.Employees.Add(newEmployee);
            dataBase.SaveChanges();
            ShowDepartmentEmployees();
        }
        private void EditEmployeeButton_Click(object sender, EventArgs e)
        {
            #region Set new EmployeeForm child items
            EmployeeForm editEmployeeForm = new EmployeeForm(dataBase.Departments, selectedEmployee.Department, "Редактирование данных сотрудника");

            editEmployeeForm.surnameTextBox.Text             = selectedEmployee.SurName;
            editEmployeeForm.firstNameTextBox.Text           = selectedEmployee.FirstName;
            editEmployeeForm.patronymicTextBox.Text          = selectedEmployee.Patronymic;
            editEmployeeForm.dateOfBirthDateTimePicker.Value = selectedEmployee.DateOfBirth;
            editEmployeeForm.docSeriesTextBox.Text           = selectedEmployee.DocSeries;
            editEmployeeForm.docNumberTextBox.Text           = selectedEmployee.DocNumber;
            editEmployeeForm.positionTextBox.Text            = selectedEmployee.Position;
            #endregion

            // Валидация
            bool correctValuesEntered = false;
            while (correctValuesEntered == false)
            {
                DialogResult dialogResult = editEmployeeForm.ShowDialog(this);
                if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }
                correctValuesEntered = editEmployeeForm.RunValidation();
            }

            #region Set Employee fields
            selectedEmployee.SurName     = editEmployeeForm.surnameTextBox.Text;
            selectedEmployee.FirstName   = editEmployeeForm.firstNameTextBox.Text;
            selectedEmployee.Patronymic  = editEmployeeForm.patronymicTextBox.Text;
            selectedEmployee.DateOfBirth = editEmployeeForm.dateOfBirthDateTimePicker.Value.Date;
            selectedEmployee.DocSeries   = editEmployeeForm.docSeriesTextBox.Text;
            selectedEmployee.DocNumber   = editEmployeeForm.docNumberTextBox.Text;
            selectedEmployee.Position    = editEmployeeForm.positionTextBox.Text;
            Department newEmployeeDepartment = (Department)editEmployeeForm.departmentComboBox.SelectedItem;
            selectedEmployee.DepartmentID = newEmployeeDepartment.ID;
            #endregion

            dataBase.SaveChanges();
            ShowDepartmentEmployees();
        }