private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (grdBrokerView.FocusedRowHandle < 0) { return; } if (BsfGlobal.FindPermission("Broker Details-Delete") == false) { MessageBox.Show("You don't have Rights to Broker-Delete"); return; } try { int i_BrokerId = Convert.ToInt32(grdBrokerView.GetFocusedRowCellValue("BrokerId")); if (UnitDirBL.BrokerFound(i_BrokerId) == false) { if (MessageBox.Show("Do You want to Delete Row?", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK) { string sql; sql = "DELETE FROM BrokerDet WHERE BrokerId=" + i_BrokerId + ""; CommFun.CRMExecute(sql); grdBrokerView.DeleteRow(grdBrokerView.FocusedRowHandle); BsfGlobal.InsertLog(DateTime.Now, "Broker Details-Delete", "D", "Delete Broker Details", i_BrokerId, 0, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId); } } else { MessageBox.Show("Broker Details Used, Can't Delete Row", "Information", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } } catch (Exception ex) { throw ex; } }