예제 #1
0
        private void barButtonItem4_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                if (grdPBTransView.FocusedRowHandle >= 0)
                {
                    if (BsfGlobal.FindPermission("Progress Bill-Delete") == false)
                    {
                        MessageBox.Show("You don't have Rights to Progress Bill-Delete");
                        return;
                    }

                    string sApprove = CommFun.IsNullCheck(grdPBTransView.GetFocusedRowCellValue("Approve"), CommFun.datatypes.vartypestring).ToString();

                    if (sApprove == "P" || sApprove == "Y")
                    {
                        MessageBox.Show("Bill Approved, Do not Delete");
                        return;
                    }


                    DialogResult Result;
                    Result = MessageBox.Show("Do you Want to Delete?", "CRM", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (Result == DialogResult.Yes)
                    {
                        int iPBillId = Convert.ToInt32(grdPBTransView.GetRowCellValue(grdPBTransView.FocusedRowHandle, "PBillId"));
                        int iCCId    = Convert.ToInt32(grdPBTransView.GetRowCellValue(grdPBTransView.FocusedRowHandle, "CostCentreId"));
                        if (m_sBussinessType == "B")
                        {
                            ProgBillBL.DeletePBill(iPBillId);

                            grdPBTransView.DeleteRow(grdPBTransView.FocusedRowHandle);

                            //CommFun.InsertLog(DateTime.Now, "Progress Bill-Delete", "D", "Progress Bill", BsfGlobal.g_lUserId, Convert.ToInt32(gridView1.GetFocusedRowCellValue("RegisterId")), Convert.ToInt32(gridView1.GetFocusedRowCellValue("CostCentreId")), 0, BsfGlobal.g_sCRMDBName);
                            BsfGlobal.InsertLog(DateTime.Now, "Progress Bill-Delete", "D", "Progress Bill", iProgRegId, iCCId, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId, 0, 0);
                        }
                        else
                        {
                            ProgBillBL.DeletePlotPBill(iPBillId);

                            grdPBTransView.DeleteRow(grdPBTransView.FocusedRowHandle);

                            //CommFun.InsertLog(DateTime.Now, "Plot-Progress-Bill-Delete", "D", "Plot Progress Bill  ", BsfGlobal.g_lUserId, Convert.ToInt32(gridView1.GetFocusedRowCellValue("RegisterId")), Convert.ToInt32(gridView1.GetFocusedRowCellValue("CostCentreId")), 0, BsfGlobal.g_sCRMDBName);
                            BsfGlobal.InsertLog(DateTime.Now, "Plot-Progress-Bill-Delete", "D", "Plot Progress Bill", iProgRegId, iCCId, 0, BsfGlobal.g_sCRMDBName, "", BsfGlobal.g_lUserId, 0, 0);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }