private void btnEditCity_Click(object sender, EventArgs e) { try { if (dgvCity.CurrentRow != null) { CitySetSortedColumns(); frmCityEntry fCity = new frmCityEntry((int)Common.Constant.Mode.Modify, (Int64)dgvCity.CurrentRow.Cells["CityID"].Value, dgvCountry.CurrentRow.Cells["CountryName"].Value.ToString(), (long)dgvState.CurrentRow.Cells["StateID"].Value, dgvState.CurrentRow.Cells["StateName"].Value.ToString()); fCity.ShowDialog(); CitysetDefaultGridRecords(sender, e); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("City", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } }
private void btnNewCity_Click(object sender, EventArgs e) { try { if (dgvState.CurrentRow != null) { frmCityEntry fCity = new frmCityEntry((int)Common.Constant.Mode.Insert, 0, dgvCountry.CurrentRow.Cells["CountryName"].Value.ToString(), (long)dgvState.CurrentRow.Cells["StateID"].Value, dgvState.CurrentRow.Cells["StateName"].Value.ToString()); fCity.ShowDialog(); LoadCityList(); if (dgvCity.Rows.Count > 0) { dgvCity.CurrentCell = dgvCity.Rows[0].Cells[0]; } dgvCity_SelectionChanged(sender, e); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("City", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } }