private void btnEditState_Click(object sender, EventArgs e) { try { if (dgvState.CurrentRow != null) { StateSetSortedColumns(); frmStateEntry fState = new frmStateEntry((int)Common.Constant.Mode.Modify, (Int64)dgvState.CurrentRow.Cells["StateID"].Value, (long)dgvCountry.CurrentRow.Cells["CountryID"].Value, dgvCountry.CurrentRow.Cells["CountryName"].Value.ToString()); fState.ShowDialog(); StatesetDefaultGridRecords(sender, e); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("State", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } }
private void btnNewState_Click(object sender, EventArgs e) { try { if (dgvCountry.CurrentRow != null) { frmStateEntry fState = new frmStateEntry((int)Common.Constant.Mode.Insert, 0, (long)dgvCountry.CurrentRow.Cells["CountryID"].Value, dgvCountry.CurrentRow.Cells["CountryName"].Value.ToString()); fState.ShowDialog(); LoadStateList(); if (dgvState.Rows.Count > 0) { dgvState.CurrentCell = dgvState.Rows[0].Cells[0]; } dgvState_SelectionChanged(sender, e); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("State", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } }