private void buttonAdd_Click(object sender, EventArgs e) { CityEditForm myform = new CityEditForm(); myform.Text += "Новый"; if (myform.ShowDialog() == DialogResult.OK) { myform.City.InsertCity(); if (myform.City.e != null) { MessageBox.Show(myform.City.e.Message, "Місто не добавлене!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } RefreshItems(); }
private void buttonEdit_Click(object sender, EventArgs e) { CityEditForm myform = new CityEditForm(); int selectedRow = (int)citiesListDataGridView.SelectedRows[0].Cells[0].Value; City ci = new City(); ci.GetCity(selectedRow); myform.City = ci; myform.Text += ci.CityName; if (myform.ShowDialog() == DialogResult.OK) { myform.City.UpdateCity(); if (myform.City.e != null) { MessageBox.Show(myform.City.e.Message, "Транзакція не виконана", MessageBoxButtons.OK, MessageBoxIcon.Error); } RefreshItems(); } }