private void dataGridViewCountry_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int id = Convert.ToInt32(dataGridViewCountry.Rows[e.RowIndex].Cells[0].Value); country = WarehouseBack.Classes.Country.GetCountry(id); textBoxCountryName.Text = country.Name; }
private void button_SubmitCountry_Click(object sender, EventArgs e) { if (!IsEmtyStr(textBoxCountryName.Text)) { try { if (country == null) { WarehouseBack.Classes.Country newCountry = new WarehouseBack.Classes.Country(); newCountry.Name = textBoxCountryName.Text; newCountry.Save(); } else { country.Name = textBoxCountryName.Text; country.Save(); } country = null; textBoxCountryName.Text = ""; MessageBoxOk1(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
private void dataGridViewCountry_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { if (MessageBoxOk()) { int id = Convert.ToInt32(dataGridViewCountry.Rows[e.RowIndex].Cells[0].Value); country = WarehouseBack.Classes.Country.GetCountry(id); country.Delete(); } } }
private void button_CountryCancel_Click(object sender, EventArgs e) { country = null; textBoxCountryName.Text = ""; }