private void OrganizationCreateForm_Load(object sender, EventArgs e)
        {
            var peopleResult = PersonController.PeopleList();

            if (!peopleResult.Success)
            {
                MessageBox.Show(peopleResult.ErrorText);
                return;
            }

            ComponentBindingHelper.BindComboboxToDictionary(founderComboBox, peopleResult.Entities);
            ComponentBindingHelper.BindComboboxToDictionary(chiefComboBox, peopleResult.Entities);
        }
Beispiel #2
0
        private void GuaranteeCreateForm_Load(object sender, EventArgs e)
        {
            var organizationsResult = OrganizationController.GetOrganizationNames();

            if (!organizationsResult.Success)
            {
                MessageBox.Show(organizationsResult.ErrorText);
                return;
            }

            _organizationsDictionary = organizationsResult.Entities;
            _organizationsDictionary.Add(CREATE_NEW_KEY, Resources.CreateNew);
            ComponentBindingHelper.BindComboboxToDictionary(organizationsComboBox, _organizationsDictionary);
        }
Beispiel #3
0
        private void organizationsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int id = ComponentBindingHelper.GetComboboxItemKey(sender);

            if (id == CREATE_NEW_KEY)
            {
                var nextForm = OrganizationController.CreateNew(this);
                nextForm.TopMost = true;
                nextForm.Show();
            }
            else
            {
                var organization = OrganizationController.GetOrganization(id);
                FillOrganizationFields(organization);
            }
        }
Beispiel #4
0
        private void createButton_Click(object sender, EventArgs e)
        {
            Decimal.TryParse(amountTextBox.Text, out var amount);
            Int32.TryParse(periodTextBox.Text, out var days);
            var guaranteeAddResult = GuaranteeController.AddGuarantee(new Guarantee
            {
                Name           = Resources.BankGuarantee + organizationsComboBox.Text,
                Amount         = amount,
                Days           = days,
                StartDate      = DateTime.Now,
                OrganizationId = ComponentBindingHelper.GetComboboxItemKey(organizationsComboBox)
            });

            if (guaranteeAddResult.Executed)
            {
                _closeApp = false;
                this.Close();
            }
            else
            {
                MessageBox.Show(guaranteeAddResult.ErrorText);
            }
        }
        private void createButton_Click(object sender, EventArgs e)
        {
            Int32.TryParse(foundedYearTextBox.Text, out var foundedYear);
            var addOrganizationResult = OrganizationController.AddOrganization(new Organization
            {
                Name             = nameTextBox.Text,
                Inn              = innTextBox.Text,
                Ogrn             = ogrnTextBox.Text,
                FoundedYear      = foundedYear,
                Address          = addressTextBox.Text,
                FounderId        = ComponentBindingHelper.GetComboboxItemKey(founderComboBox),
                ChiefExecutiveId = ComponentBindingHelper.GetComboboxItemKey(chiefComboBox)
            });

            if (addOrganizationResult.Executed)
            {
                this.Close();
            }
            else
            {
                MessageBox.Show(addOrganizationResult.ErrorText);
            }
        }