Пример #1
0
        public void Delete()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            //Удаляем всех секретарей из секретариата
            foreach (Secretary secretary in Secretaries)
            {
                secretary.Quit();
            }
            Secretaries = null;
            //Удаляем главного секретаря
            if (MainSecretary != null)
            {
                MainSecretary.Quit();
                MainSecretary = null;
            }
            //Удаляем необработанные документы
            foreach (Document document in PendingDocuments)
            {
                document.Delete();
            }
            PendingDocuments = null;
            //Удаляем архив
            foreach (Document document in Archive)
            {
                document.Delete();
            }
            Archive = null;
            dataLists.Chanceries.Remove(this);
        }
Пример #2
0
        public void Persist()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            Id = DataLists.GeneratePersonId();
            dataLists.Persons.Add(this);
        }
Пример #3
0
        public void Persist()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            Id = DataLists.GenerateDocumentTypeId();
            dataLists.DocumentTypes.Add(this);
        }
Пример #4
0
        private void DocumentManagementForm_Closing(object sender, FormClosingEventArgs e)
        {
            DialogResult dlg = MessageBox.Show("Save changes?", "Document Management System", MessageBoxButtons.YesNo);

            if (dlg == DialogResult.Yes)
            {
                string type = ConfigurationManager.AppSettings["PersistingType"];
                switch (type)
                {
                case "1":
                    DataStorage ds = DataStorage.GetInstance();
                    ds.UpdateCollections();
                    ds.PersistDataChanges();
                    break;

                case "2":

                    break;

                case "3":
                    SerializationDataStorage sds = SerializationDataStorage.GetInstance();
                    sds.PersistData();
                    break;
                }
                e.Cancel = false;
            }
            if (dlg == DialogResult.No)
            {
                e.Cancel = false;
            }
        }
Пример #5
0
        public override void Quit()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            //Удаляем созданные неотправленные документы
            foreach (Document document in CreatedDocuments)
            {
                document.Delete();
            }
            CreatedDocuments = null;
            //Направляем необработанные документы обратно в секретариат
            Chancery chancery = Company.Chancery;

            foreach (Document document in PendingDocuments)
            {
                chancery.PendingDocuments.Add(document);
            }
            PendingDocuments = null;
            //Удаляем маркер
            Marker.Delete();
            Marker  = null;
            Working = false;
            dataLists.Secretaries.Remove(this);
            Person person = dataLists.Persons.Find((p) => p.Id == Id);

            person = this;
        }
Пример #6
0
        public void Persist()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            Id = DataLists.GenerateChanceryId();
            dataLists.Chanceries.Add(this);
        }
        public void UpdatePersonsToSecretaryBox()
        {
            ComboBox personsToSecretaryBox = (ComboBox)Utils.FindControl(this, "personsToSecretaryBox");

            personsToSecretaryBox.DataSource = null;
            personsToSecretaryBox.Items.Clear();
            personsToSecretaryBox.DataSource = DataStorage.GetInstance().DataLists.Persons.Where(p => !p.Working).ToList();
        }
Пример #8
0
        public new void Persist()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            EmployeeId = DataLists.GenerateDirectorId();
            Person person = dataLists.Persons.Find((p) => p.Id == Id);

            person = this;
            dataLists.Directors.Add(this);
        }
Пример #9
0
        public void Delete()
        {
            Director.Quit();
            Director = null;
            Chancery.Delete();
            Chancery = null;
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            dataLists.Companies.Remove(this);
        }
Пример #10
0
        public void Persist()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            Director.Company = this;
            Director.Persist();
            Chancery.Company = this;
            Chancery.Persist();
            Id = DataLists.GenerateCompanyId();
            dataLists.Companies.Add(this);
        }
Пример #11
0
        public override void Quit()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            Working = false;
            dataLists.MainSecretaries.Remove(this);
            Person person = dataLists.Persons.Find((p) => p.Id == Id);

            person = this;
            Company.Chancery.MainSecretary = null;
        }
Пример #12
0
        public new void Persist()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            EmployeeId = DataLists.GenerateMainSecretaryId();
            Person person = dataLists.Persons.Find((p) => p.Id == Id);

            person = this;
            //Добавляем управляющего в секретариат
            Company.Chancery.MainSecretary = this;
            dataLists.MainSecretaries.Add(this);
        }
Пример #13
0
        public new void Persist()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;
            Marker    marker    = new Marker(Marker.Color.GREEN);

            marker.Persist();
            Marker     = marker;
            EmployeeId = DataLists.GenerateSecretaryId();
            dataLists.Secretaries.Add(this);
            Person person = dataLists.Persons.Find((p) => p.Id == Id);

            person = this;
        }
Пример #14
0
        public override void Quit()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            foreach (Document document in PendingDocuments)
            {
                document.Delete();
            }
            PendingDocuments = null;
            Working          = false;
            dataLists.Directors.Remove(this);
            Person person = dataLists.Persons.Find((p) => p.Id == Id);

            person           = this;
            Company.Director = null;
        }
Пример #15
0
        public DocumentManagementForm()
        {
            InitializeComponent();
            DataStorage storage = DataStorage.GetInstance();

            UpdateCompaniesBox();
            UpdatePersonsBox();

            /*
             * CompanyType type1 = new CompanyType("АО");
             * CompanyType type2 = new CompanyType("ЗАО");
             * CompanyType type3 = new CompanyType("ООО");
             * CompanyType type4 = new CompanyType("Корпорация");
             * CompanyType type5 = new CompanyType("Муниципалитет");
             * CompanyType type6 = new CompanyType("Ассоциация");
             *
             * type1.Id = DataLists.GenerateCompanyTypeId();
             * type2.Id = DataLists.GenerateCompanyTypeId();
             * type3.Id = DataLists.GenerateCompanyTypeId();
             * type4.Id = DataLists.GenerateCompanyTypeId();
             * type5.Id = DataLists.GenerateCompanyTypeId();
             * type6.Id = DataLists.GenerateCompanyTypeId();
             *
             * SqlCompanyType.AddCompanyType(type1);
             * SqlCompanyType.AddCompanyType(type2);
             * SqlCompanyType.AddCompanyType(type3);
             * SqlCompanyType.AddCompanyType(type4);
             * SqlCompanyType.AddCompanyType(type5);
             * SqlCompanyType.AddCompanyType(type6);
             *
             * DocumentType dtype1 = new DocumentType("Справка");
             * DocumentType dtype2 = new DocumentType("Акт");
             * DocumentType dtype3 = new DocumentType("Приказ");
             * DocumentType dtype4 = new DocumentType("Докладная записка");
             *
             * dtype1.Id = DataLists.GenerateDocumentTypeId();
             * dtype2.Id = DataLists.GenerateDocumentTypeId();
             * dtype3.Id = DataLists.GenerateDocumentTypeId();
             * dtype4.Id = DataLists.GenerateDocumentTypeId();
             *
             * SqlDocumentType.AddDocumentType(dtype1);
             * SqlDocumentType.AddDocumentType(dtype2);
             * SqlDocumentType.AddDocumentType(dtype3);
             * SqlDocumentType.AddDocumentType(dtype4);
             */
        }
        private void AddMainSecretaryEditForms()
        {
            Button changeMainSecretaryButton = new Button
            {
                Name      = "changeMainSecretaryButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Выбрать управляющего"
            };

            changeMainSecretaryButton.SetBounds(250, 145, 250, 30);
            changeMainSecretaryButton.Click += new EventHandler(ChangeMainSecretaryEvent);

            ComboBox personsToMainSecretaryBox = new ComboBox
            {
                Name          = "personsToMainSecretaryBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = DataStorage.GetInstance().DataLists.Persons.Where(p => !p.Working).ToList()
            };

            personsToMainSecretaryBox.SetBounds(250, 180, 250, 30);

            Button commitEditMainSecretaryButton = new Button
            {
                Name      = "commitEditMainSecretaryButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Подтвердить"
            };

            commitEditMainSecretaryButton.SetBounds(250, 250, 250, 30);
            commitEditMainSecretaryButton.Click += new EventHandler(CommitEditMainSecretaryEvent);

            Controls.Add(changeMainSecretaryButton);
            Controls.Add(personsToMainSecretaryBox);
            Controls.Add(commitEditMainSecretaryButton);
        }
Пример #17
0
        public void Delete()
        {
            DataLists     dataLists     = DataStorage.GetInstance().DataLists;
            Secretary     secretary     = dataLists.Secretaries.Find((s) => s.Id == Id);
            MainSecretary mainSecretary = dataLists.MainSecretaries.Find((ms) => ms.Id == Id);
            Director      director      = dataLists.Directors.Find((d) => d.Id == Id);

            if (secretary != null)
            {
                secretary.Quit();
                secretary = null;
            }
            if (mainSecretary != null)
            {
                mainSecretary.Quit();
                mainSecretary = null;
            }
            if (director != null)
            {
                // С компанией удаляется и директор
                director.Company.Delete();
            }
            dataLists.Persons.Remove(this);
        }
Пример #18
0
        private void AddEditForms()
        {
            TextBox nameBox = new TextBox
            {
                Name = "nameBox",
                Text = company.Name
            };

            nameBox.SetBounds(95, 20, 150, 30);

            TextBox addressBox = new TextBox
            {
                Name = "addressBox",
                Text = company.Address
            };

            addressBox.SetBounds(95, 55, 150, 30);

            ComboBox typeBox = new ComboBox
            {
                Name          = "typeBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = DataStorage.GetInstance().DataLists.CompanyTypes
            };

            typeBox.SetBounds(95, 90, 150, 30);
            Controls.Add(typeBox);
            typeBox.SelectedIndex = typeBox.FindString(company.Type.ToString());

            Button directorChooserButton = new Button
            {
                Name      = "directorChooserButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Сменить директора"
            };

            directorChooserButton.SetBounds(10, 160, 235, 30);
            directorChooserButton.Click += new EventHandler(DirectorChooseEvent);

            ComboBox personsBox = new ComboBox
            {
                Name          = "personsBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = DataStorage.GetInstance().DataLists.Persons.Where(p => !p.Working).ToList()
            };

            personsBox.SetBounds(10, 195, 235, 30);

            Button commitEditButton = new Button
            {
                Name      = "commitEditButon",
                Text      = "Подтвердить",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204)))
            };

            commitEditButton.SetBounds(10, 285, 235, 30);
            commitEditButton.Click += new EventHandler(CommitEditEvent);

            Controls.Add(nameBox);
            Controls.Add(addressBox);
            Controls.Add(typeBox);
            Controls.Add(directorChooserButton);
            Controls.Add(personsBox);
            Controls.Add(commitEditButton);
        }
        private void InitializeForm()
        {
            Width         = 900;
            Height        = 400;
            Name          = "ChanceryInfoForm";
            Text          = "Chancery Info Form";
            BackColor     = Color.MediumTurquoise;
            StartPosition = FormStartPosition.CenterScreen;

            Label secretaries = new Label
            {
                AutoSize  = false,
                TextAlign = ContentAlignment.MiddleCenter,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Список секретарей"
            };

            secretaries.SetBounds(10, 20, 150, 30);

            Label mainSecretary = new Label
            {
                AutoSize  = false,
                TextAlign = ContentAlignment.MiddleCenter,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Управляющий секретариатом"
            };

            mainSecretary.SetBounds(250, 20, 250, 30);

            ComboBox secretariesBox = new ComboBox
            {
                Name          = "secretariesBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = chancery.Secretaries
            };

            secretariesBox.SetBounds(10, 55, 150, 30);

            Button removeSecretaryButton = new Button
            {
                Name      = "deleteSecretaryButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Удалить"
            };

            removeSecretaryButton.SetBounds(10, 145, 150, 30);
            removeSecretaryButton.Click += new EventHandler(RemoveSecretaryEvent);

            Button selectSecretaryButton = new Button
            {
                Name      = "selectSecretaryButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Выбрать"
            };

            selectSecretaryButton.SetBounds(10, 180, 150, 30);
            selectSecretaryButton.Click += new EventHandler(SelectSecretaryEvent);

            Button addSecretaryButton = new Button
            {
                Name      = "addSecretaryButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Добавить"
            };

            addSecretaryButton.SetBounds(10, 215, 150, 30);
            addSecretaryButton.Click += new EventHandler(AddSecretaryEvent);

            ComboBox personsToSecretaryBox = new ComboBox
            {
                Name          = "personsToSecretaryBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = DataStorage.GetInstance().DataLists.Persons.Where(p => !p.Working).ToList()
            };

            personsToSecretaryBox.SetBounds(10, 250, 150, 30);

            Label archive = new Label
            {
                AutoSize  = false,
                TextAlign = ContentAlignment.MiddleCenter,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Архив"
            };

            archive.SetBounds(590, 20, 250, 30);

            Button selectArchivedDocumentButton = new Button
            {
                Name      = "selectArchivedDocumentButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Выбрать документ"
            };

            selectArchivedDocumentButton.SetBounds(590, 55, 250, 30);
            selectArchivedDocumentButton.Click += new EventHandler(SelectArchivedDocumentEvent);

            ComboBox archiveBox = new ComboBox
            {
                Name          = "archiveBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = chancery.Archive
            };

            archiveBox.SetBounds(590, 90, 250, 30);

            Label pendingDocuments = new Label
            {
                AutoSize  = false,
                TextAlign = ContentAlignment.MiddleCenter,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Документы к выполнению"
            };

            pendingDocuments.SetBounds(590, 150, 250, 30);

            Button selectPendingDocumentButton = new Button
            {
                Name      = "selectPendingDocumentButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Выбрать документ"
            };

            selectPendingDocumentButton.SetBounds(590, 185, 250, 30);
            selectPendingDocumentButton.Click += new EventHandler(SelectPendingDocumentEvent);

            ComboBox pendingDocumentsBox = new ComboBox
            {
                Name          = "pendingDocumentsBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = chancery.PendingDocuments
            };

            pendingDocumentsBox.SetBounds(590, 220, 250, 30);

            if (chancery.MainSecretary == null)
            {
                AddInitMainSecretaryForms();
            }
            else
            {
                AddMainSecretaryInfoForms();
            }

            Controls.Add(secretaries);
            Controls.Add(mainSecretary);
            Controls.Add(secretariesBox);
            Controls.Add(personsToSecretaryBox);
            Controls.Add(addSecretaryButton);
            Controls.Add(removeSecretaryButton);
            Controls.Add(selectSecretaryButton);
            Controls.Add(archive);
            Controls.Add(selectArchivedDocumentButton);
            Controls.Add(archiveBox);
            Controls.Add(pendingDocuments);
            Controls.Add(selectPendingDocumentButton);
            Controls.Add(pendingDocumentsBox);
        }
Пример #20
0
 public void UpdateCompaniesBox()
 {
     companiesBox.DataSource = null;
     companiesBox.Items.Clear();
     companiesBox.DataSource = DataStorage.GetInstance().DataLists.Companies;
 }
Пример #21
0
 public void UpdatePersonsBox()
 {
     personsBox.DataSource = null;
     personsBox.Items.Clear();
     personsBox.DataSource = DataStorage.GetInstance().DataLists.Persons;
 }
Пример #22
0
        public void Delete()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            dataLists.Documents.Remove(this);
        }
Пример #23
0
        private void InitializeForm()
        {
            Width         = 500;
            Height        = 500;
            Name          = "DocumentEditForm";
            Text          = "Document Edit Form";
            BackColor     = Color.MediumTurquoise;
            StartPosition = FormStartPosition.CenterScreen;

            Label title = new Label
            {
                Text = "Название:"
            };

            title.SetBounds(10, 20, 80, 30);

            TextBox titleBox = new TextBox
            {
                Name = "titleBox",
                Text = document.Title
            };

            titleBox.SetBounds(95, 20, 150, 30);

            Label type = new Label
            {
                Text = "Тип:"
            };

            type.SetBounds(10, 55, 80, 30);

            ComboBox typeBox = new ComboBox
            {
                Name          = "typeBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = DataStorage.GetInstance().DataLists.DocumentTypes
            };

            typeBox.SetBounds(95, 55, 150, 30);

            Label documentCode = new Label
            {
                Text = "Код:"
            };

            documentCode.SetBounds(10, 90, 80, 30);

            TextBox documentCodeBox = new TextBox
            {
                Name = "documentCodeBox",
                Text = document.DocumentCode.ToString()
            };

            documentCodeBox.SetBounds(95, 90, 150, 30);

            Label time = new Label
            {
                Text = "Время создания:"
            };

            time.SetBounds(10, 125, 80, 30);

            Label timeInfo = new Label
            {
                Name = "timeInfo",
                Text = document.CreationDate.ToShortDateString()
            };

            timeInfo.SetBounds(95, 125, 150, 30);

            Label receiver = new Label
            {
                Text = "Получатель:"
            };

            receiver.SetBounds(10, 160, 80, 30);

            ComboBox receiverBox = new ComboBox
            {
                Name          = "receiverBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = DataStorage.GetInstance().DataLists.Companies
            };

            receiverBox.SetBounds(95, 160, 150, 30);

            Label sender = new Label
            {
                Text = "Отправитель:"
            };

            sender.SetBounds(10, 195, 80, 30);

            Label senderInfo = new Label
            {
                Name = "senderInfo",
                Text = document.Sender.ToString()
            };

            senderInfo.SetBounds(95, 195, 150, 30);

            Label text = new Label
            {
                Text = "Содержание:"
            };

            text.SetBounds(10, 230, 80, 30);

            TextBox textBox = new TextBox
            {
                Name      = "textBox",
                Multiline = true,
                Text      = document.Text
            };

            textBox.SetBounds(10, 265, 235, 100);

            Button commitButton = new Button
            {
                Name      = "commitButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Подтвердить"
            };

            commitButton.SetBounds(10, 370, 235, 30);
            commitButton.Click += new EventHandler(CommitEvent);

            Controls.Add(title);
            Controls.Add(titleBox);
            Controls.Add(type);
            Controls.Add(typeBox);
            Controls.Add(documentCode);
            Controls.Add(documentCodeBox);
            Controls.Add(time);
            Controls.Add(timeInfo);
            Controls.Add(receiver);
            Controls.Add(receiverBox);
            Controls.Add(sender);
            Controls.Add(senderInfo);
            Controls.Add(text);
            Controls.Add(textBox);
            Controls.Add(commitButton);
        }
Пример #24
0
        public void Delete()
        {
            DataLists dataLists = DataStorage.GetInstance().DataLists;

            dataLists.CompanyTypes.Remove(this);
        }
Пример #25
0
        private void InitializeForm()
        {
            Width         = 600;
            Height        = 400;
            Name          = "CompanyForm";
            Text          = "Company Adder Form";
            BackColor     = Color.Orange;
            StartPosition = FormStartPosition.CenterScreen;

            Label name = new Label
            {
                Text = "Название:"
            };

            name.SetBounds(10, 20, 80, 30);

            TextBox nameBox = new TextBox
            {
                Name = "nameBox"
            };

            nameBox.SetBounds(95, 20, 150, 30);

            Label address = new Label
            {
                Text = "Адрес:"
            };

            address.SetBounds(10, 55, 80, 30);

            TextBox addressBox = new TextBox
            {
                Name = "addressBox"
            };

            addressBox.SetBounds(95, 55, 150, 30);

            Label type = new Label
            {
                Text = "Тип:"
            };

            type.SetBounds(10, 90, 80, 30);

            ComboBox typeBox = new ComboBox
            {
                Name          = "typeBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = DataStorage.GetInstance().DataLists.CompanyTypes
            };

            typeBox.SetBounds(95, 90, 150, 30);

            Button directorChooseButton = new Button
            {
                Name      = "directorChooseButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Выбрать директора"
            };

            directorChooseButton.SetBounds(10, 125, 235, 30);
            directorChooseButton.Click += new EventHandler(DirectorChooseButton_Click);

            ComboBox personsBox = new ComboBox
            {
                Name          = "personsBox",
                DropDownStyle = ComboBoxStyle.DropDownList,
                DataSource    = DataStorage.GetInstance().DataLists.Persons.Where(p => !p.Working).ToList()
            };

            personsBox.SetBounds(10, 160, 235, 30);

            Button addCompanyButton = new Button
            {
                Name      = "addCompanyButton",
                BackColor = Color.Tomato,
                Font      = new Font("Monotype Corsiva", 14.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(204))),
                Text      = "Добавить организацию"
            };

            addCompanyButton.SetBounds(10, 250, 235, 30);
            addCompanyButton.Click += new EventHandler(AddCompanyButton_Click);

            Controls.Add(name);
            Controls.Add(nameBox);
            Controls.Add(address);
            Controls.Add(addressBox);
            Controls.Add(type);
            Controls.Add(typeBox);
            Controls.Add(directorChooseButton);
            Controls.Add(personsBox);
            Controls.Add(addCompanyButton);
        }