예제 #1
0
        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();
        }
예제 #2
0
        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();
            }
        }