private void CommitButton_Click(object sender, EventArgs e)
        {
            bool filled = Utils.CheckFormFilled(this);

            if (filled)
            {
                string name      = Utils.FindControl(this, "nameBox").Text;
                string surname   = Utils.FindControl(this, "surnameBox").Text;
                string ageString = Utils.FindControl(this, "ageBox").Text;

                bool nameValidated = PersonFormValidator.ValidateName(name, surname);
                bool ageValidated  = PersonFormValidator.ValidateAge(ageString);

                if (nameValidated && ageValidated)
                {
                    Person person = new Person(name, surname, int.Parse(ageString));
                    person.Persist();
                    DocumentManagementForm form = (DocumentManagementForm)Application.OpenForms["DocumentManagementForm"];
                    form.UpdatePersonsBox();
                    Close();
                    Dispose();
                }
                else
                {
                    MessageBox.Show("Неправильно введенные данные!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Одно из полей пустое!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void CommitButton_Click(object sender, EventArgs e)
        {
            bool filled = Utils.CheckFormFilled(this);

            if (filled)
            {
                Control nameBox    = Utils.FindControl(this, "nameBox");
                Control surnameBox = Utils.FindControl(this, "surnameBox");
                Control ageBox     = Utils.FindControl(this, "ageBox");

                string name      = nameBox.Text;
                string surname   = surnameBox.Text;
                string ageString = ageBox.Text;

                bool nameValidated = PersonFormValidator.ValidateName(name, surname);
                bool ageValidated  = PersonFormValidator.ValidateAge(ageString);

                if (nameValidated && ageValidated)
                {
                    person.Name    = name;
                    person.Surname = surname;
                    person.Age     = int.Parse(ageString);

                    DocumentManagementForm form = (DocumentManagementForm)Application.OpenForms["DocumentManagementForm"];
                    form.UpdatePersonsBox();
                    form.UpdateCompaniesBox();
                    Controls.Remove(nameBox);
                    Controls.Remove(surnameBox);
                    Controls.Remove(ageBox);
                    Controls.Remove((Control)sender);
                    AddInfoForms();
                }
                else
                {
                    MessageBox.Show("Неправильно введенные данные!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Одно из полей пустое!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }