Exemplo n.º 1
0
        private void ButtonAddStreetClick(object sender, EventArgs e)
        {
            AddForm      addForm = new AddForm();
            DialogResult result  = addForm.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                return;
            }

            if (addForm.textBoxName.Text.Count() < 1)
            {
                MessageBox.Show("Вы не ввели название");
                return;
            }
            Street street = new Street {
                Name = addForm.textBoxName.Text, CityId = new Guid(dataGridViewCities.SelectedRows[0].Cells[0].Value.ToString())
            };

            streetDataService.Add(street);

            LoadDataGridViewStreets();
        }
Exemplo n.º 2
0
        private void ButtonAddCountryClick(object sender, EventArgs e)
        {
            AddForm      addForm = new AddForm();
            DialogResult result  = addForm.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                return;
            }

            if (addForm.textBoxName.Text.Count() < 1)
            {
                MessageBox.Show("Вы не ввели название");
                return;
            }
            Coutry coutry = new Coutry {
                Name = addForm.textBoxName.Text
            };

            countryDataService.Add(coutry);

            LoadDataGridViewCountries();
        }