private void btnRemove_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmLoanApplication", "Remove")) { return; } DataTable _dt = loLoanApplication.getLoanApplicationStatus(dgvList.CurrentRow.Cells[0].Value.ToString()); if (_dt.Rows.Count > 0) { foreach (DataRow _drStatus in _dt.Rows) { if (_drStatus[0].ToString() != "In Process") { MessageBoxUI _mbStatus = new MessageBoxUI("Only IN PROCESS application can be removed!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } } } else { MessageBoxUI _mbStatus = new MessageBoxUI("Loan Application Id does not exist!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } if (dgvList.Rows.Count > 0) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue removing this Loan Application record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { if (loLoanApplication.remove(dgvList.CurrentRow.Cells[0].Value.ToString())) { MessageBoxUI _mb1 = new MessageBoxUI("Loan Application record has been successfully removed!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); refresh(); } else { } } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnRemove_Click"); em.ShowDialog(); return; } }