private void btnAddNewCountry_Click(object sender, EventArgs e) { frmCountry objFrm = new frmCountry(); objFrm.ShowDialog(); dataGridViewCountry.DataSource = null; LoadCountry(); }
private void dataGridViewCountry_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGridViewCountry.Columns["clmEdit"].Index) { int x = Convert.ToInt32(dataGridViewCountry.CurrentRow.Cells["clmCountryID"].Value.ToString()); frmCountry objFrm = new frmCountry(x); objFrm.ShowDialog(); dataGridViewCountry.DataSource = null; LoadCountry(); } if (e.ColumnIndex == dataGridViewCountry.Columns["clmDelete"].Index) { try { Country.CountryWebService objWebService = new Country.CountryWebService(); CountryInfo objInfo = new CountryInfo(); objInfo.CountryID = Convert.ToInt32(dataGridViewCountry.Rows[e.RowIndex].Cells["clmCountryID"].Value.ToString()); if (DialogResult.Yes == MessageBox.Show("Do You Want Delete ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { string deletedBy = GetLoginUser.UserName; objWebService.CountryNameDeleteByID(objInfo.CountryID, deletedBy, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens())); MessageBox.Show("Data Deleted Successfully"); LoadCountry(); } } catch (Exception ex) { throw ex; } } }