private void btnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (DGvTransPay.FocusedRowHandle < 0) { return; } int iPayId = Convert.ToInt32(DGvTransPay.GetRowCellValue(DGvTransPay.FocusedRowHandle, "TypeId").ToString()); if (PaymentScheduleBL.CheckPaymentScheduleUsed(iPayId) == true) { MessageBox.Show("Payment Schedule Used, Do not Delete"); return; } DialogResult result1 = MessageBox.Show("Do you want to Delete", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result1 == DialogResult.Yes) { string sql = String.Format("DELETE FROM PaySchType WHERE TypeId={0}", DGvTransPay.GetFocusedRowCellValue("TypeId")); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); BsfGlobal.g_CRMDB.Close(); DGvTransPay.DeleteRow(DGvTransPay.FocusedRowHandle); } }
public void FillData() { dt = new DataTable(); DGVPay.DataSource = null; DGvTransPay.Columns.Clear(); dt = UnitDirBL.PaySchType(); DGVPay.DataSource = dt; DGvTransPay.PopulateColumns(); DGvTransPay.Columns["TypeId"].Visible = false; DGvTransPay.Columns["EMI"].Visible = false; DGvTransPay.Columns["RoundValue"].Visible = false; DGvTransPay.Columns["NoOfMonths"].Visible = false; dt.GetChanges(); }