private void btnEditCountry_Click(object sender, EventArgs e) { if ((dgvCountries.Rows.Count > 0)) { Country country = new Country(); bool hasThSaveButtonPressed; country.CountryId = Convert.ToInt32(dgvCountries.CurrentRow.Cells[0].Value.ToString()); country.CountryName = dgvCountries.CurrentRow.Cells[1].Value.ToString(); frmAddOrUpdateCountry _frmAddOrUpdateCountry = new frmAddOrUpdateCountry(country); this.TopMost = false; _frmAddOrUpdateCountry.StartPosition = FormStartPosition.CenterParent; _frmAddOrUpdateCountry.ShowDialog(); hasThSaveButtonPressed = _frmAddOrUpdateCountry.hasTheSaveButtonPressed; if (hasThSaveButtonPressed == true) { Validation.LocalDatabaseConfig(true); //databaseViewModel = Services.GetDataFromDatabase(); countryList = loadCountries(); } dgvCountries.ClearSelection(); txtSearchCountry.Clear(); btnEditCountry.Enabled = false; btnDeleteCountry.Enabled = false; _frmAddOrUpdateCountry.Dispose(); } }
private void btnNewCountry_Click(object sender, EventArgs e) { bool hasTheSaveButtonPressed; Country country = new Country(); frmAddOrUpdateCountry _frmAddOrUpdateCountry = new frmAddOrUpdateCountry(country); _frmAddOrUpdateCountry.TopMost = true; _frmAddOrUpdateCountry.StartPosition = FormStartPosition.CenterParent; _frmAddOrUpdateCountry.ShowDialog(); hasTheSaveButtonPressed = _frmAddOrUpdateCountry.hasTheSaveButtonPressed; if (hasTheSaveButtonPressed == true) { Validation.LocalDatabaseConfig(true); //databaseViewModel = Services.GetDataFromDatabase(); countryList = loadCountries(); } dgvCountries.ClearSelection(); txtSearchCountry.Clear(); btnEditCountry.Enabled = false; btnDeleteCountry.Enabled = false; _frmAddOrUpdateCountry.Dispose(); }