private void ChangeMainSecretaryDisposeEvent(object sender, EventArgs e)
        {
            SecretaryForm form = (SecretaryForm)sender;

            if (form.CorrectOnClose)
            {
                Person person = form.Person;
                mainSecretary        = new MainSecretary(person, chancery.Company, form.Salary);
                mainSecretaryChanged = true;
            }
        }
        private void ChangeMainSecretaryEvent(object sender, EventArgs e)
        {
            ComboBox personsBox = (ComboBox)Utils.FindControl(this, "personsToMainSecretaryBox");

            if (personsBox.SelectedItem == null)
            {
                MessageBox.Show("Персона не выбрана!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Person        person        = (Person)personsBox.SelectedItem;
                SecretaryForm secretaryForm = new SecretaryForm(person);
                secretaryForm.Disposed += new EventHandler(ChangeMainSecretaryDisposeEvent);
                secretaryForm.Activate();
                secretaryForm.Show();
            }
        }
        private void AddMainSecretaryDisposeEvent(object sender, EventArgs e)
        {
            Control addMainSecretaryButton    = Utils.FindControl(this, "addMainSecretaryButton");
            Control personsToMainSecretaryBox = Utils.FindControl(this, "personsToMainSecretaryBox");
            //Создаем управляющего секретариатом
            SecretaryForm form = (SecretaryForm)sender;

            if (form.CorrectOnClose)
            {
                Person        person        = form.Person;
                MainSecretary mainSecretary = new MainSecretary(person, chancery.Company, form.Salary);
                mainSecretary.Persist();
                //Добавляем управляющего в секретариат
                chancery.MainSecretary = mainSecretary;

                Controls.Remove(addMainSecretaryButton);
                Controls.Remove(personsToMainSecretaryBox);
                Controls.Remove((Control)sender);
                UpdateSecretariesBox();
                UpdatePersonsToSecretaryBox();
                AddMainSecretaryInfoForms();
            }
        }
        private void AddSecretaryDisposeEvent(object sender, EventArgs e)
        {
            //Создаем секретаря
            SecretaryForm form = (SecretaryForm)sender;

            if (form.CorrectOnClose)
            {
                Person    person    = form.Person;
                Marker    marker    = new Marker(Marker.Color.BLUE);
                Secretary secretary = new Secretary(person, chancery.Company, form.Salary)
                {
                    Marker           = marker,
                    PendingDocuments = new List <Document>(),
                    CreatedDocuments = new List <Document>()
                };
                secretary.Persist();
                //Добавляем секретаря в секретариат
                chancery.Secretaries.Add(secretary);

                UpdateSecretariesBox();
                UpdatePersonsToSecretaryBox();
                UpdatePersonsToMainSecretaryBox();
            }
        }