コード例 #1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        ArrayList objarr = new ArrayList();
        Bill_Sys_BillTransaction_BO obj = new Bill_Sys_BillTransaction_BO();
        Bill_Sys_Verification_Desc  _obj1;
        ArrayList _objAL = new ArrayList();

        try
        {
            for (int i = 0; i < grdVerificationReq.Items.Count; i++)
            {
                if (((CheckBox)grdVerificationReq.Items[i].Cells[8].FindControl("chkDelete")).Checked == true)
                {
                    string sz_status_code = grdVerificationReq.Items[i].Cells[9].Text.ToString();
                    if (hfconfirm.Value == "delete" || hfconfirm.Value == "no")
                    {
                        Bill_sys_Verification_Pop objpopup = new Bill_sys_Verification_Pop();

                        objpopup.sz_bill_no = txtViewBillNumber.Text;

                        objpopup.i_verification_id = grdVerificationReq.Items[i].Cells[5].Text.ToString();
                        objpopup.sz_company_id     = txtCompanyID.Text;
                        objpopup.sz_bill_Status    = sz_status_code;
                        objpopup.sz_flag           = "DEL";
                        objarr.Add(objpopup);
                        _obj1                    = new Bill_Sys_Verification_Desc();
                        _obj1.sz_bill_no         = txtViewBillNumber.Text;
                        _obj1.sz_verification_id = grdVerificationReq.Items[i].Cells[5].Text.ToString();
                        _obj1.sz_company_id      = txtCompanyID.Text;
                        _obj1.sz_answer_id       = grdVerificationReq.Items[i].Cells[12].Text.ToString();
                        _objAL.Add(_obj1);
                    }

                    else if (hfconfirm.Value == "yes")
                    {
                        Bill_sys_Verification_Pop objpopup = new Bill_sys_Verification_Pop();
                        objpopup.sz_bill_no        = txtViewBillNumber.Text;
                        objpopup.i_verification_id = grdVerificationReq.Items[i].Cells[5].Text.ToString();
                        objpopup.sz_company_id     = txtCompanyID.Text;
                        objpopup.sz_bill_Status    = sz_status_code;
                        if (hfverificationId.Value != grdVerificationReq.Items[i].Cells[5].Text.ToString())
                        {
                            objpopup.sz_flag = "DEL";
                        }
                        else
                        {
                            objpopup.sz_flag = "CONFIRM";
                        }

                        objarr.Add(objpopup);
                    }
                }
            }

            if (_objAL != null && _objAL.Count > 0)
            {
                try
                {
                    Bill_Sys_BillTransaction_BO obj2 = new Bill_Sys_BillTransaction_BO();
                    obj2.DeleteVerificationAns(_objAL);
                }
                catch (Exception ex)
                {
                    Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                    using (Utils utility = new Utils())
                    {
                        utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
                    }
                    string str2 = "Error Request=" + id + ".Please share with Technical support.";
                    base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
                }
            }
            ArrayList             FilePath = obj.DeleteVerificationNotes(objarr);
            Bill_Sys_NF3_Template objpath  = new Bill_Sys_NF3_Template();
            string PhysicalPath            = objpath.getPhysicalPath();
            {
                for (int i = 0; i < FilePath.Count; i++)
                {
                    string file_path = FilePath[i].ToString();
                    if (File.Exists(PhysicalPath + file_path))
                    {
                        if (!File.Exists(PhysicalPath + file_path + ".delete"))
                        {
                            File.Move(PhysicalPath + file_path, PhysicalPath + file_path + ".delete");
                        }
                    }
                }
            }

            BindGridforDenial();
            ClearControls();
            usrMessage.PutMessage("Delete Successfully ...!");
            usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
            usrMessage.Show();
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }

        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
コード例 #2
0
ファイル: BillDenial.aspx.cs プロジェクト: jehan2898/root
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        ArrayList objarr = new ArrayList();
        Bill_Sys_BillTransaction_BO obj = new Bill_Sys_BillTransaction_BO();
        Bill_Sys_Verification_Desc  _obj1;
        ArrayList _objAL = new ArrayList();

        try
        {
            for (int i = 0; i < grdVerificationReq.Items.Count; i++)
            {
                if (((CheckBox)grdVerificationReq.Items[i].Cells[12].FindControl("chkDelete")).Checked == true)
                {
                    string sz_status_code = grdVerificationReq.Items[i].Cells[9].Text.ToString();
                    if (hfconfirm.Value == "delete" || hfconfirm.Value == "no")
                    {
                        Bill_sys_Verification_Pop objpopup = new Bill_sys_Verification_Pop();

                        objpopup.sz_bill_no        = grdVerificationReq.Items[i].Cells[0].Text.ToString();
                        objpopup.i_verification_id = grdVerificationReq.Items[i].Cells[5].Text.ToString();
                        objpopup.sz_company_id     = txtCompanyID.Text;
                        objpopup.sz_bill_Status    = sz_status_code;
                        objpopup.sz_flag           = "DEL";
                        objarr.Add(objpopup);
                        _obj1                    = new Bill_Sys_Verification_Desc();
                        _obj1.sz_bill_no         = grdVerificationReq.Items[i].Cells[0].Text.ToString();
                        _obj1.sz_verification_id = grdVerificationReq.Items[i].Cells[5].Text.ToString();
                        _obj1.sz_company_id      = txtCompanyID.Text;
                        _obj1.sz_answer_id       = grdVerificationReq.Items[i].Cells[12].Text.ToString();
                        _objAL.Add(_obj1);
                    }

                    else if (hfconfirm.Value == "yes")
                    {
                        Bill_sys_Verification_Pop objpopup = new Bill_sys_Verification_Pop();
                        objpopup.sz_bill_no        = grdVerificationReq.Items[i].Cells[0].Text.ToString();
                        objpopup.i_verification_id = grdVerificationReq.Items[i].Cells[5].Text.ToString();
                        objpopup.sz_company_id     = txtCompanyID.Text;
                        objpopup.sz_bill_Status    = sz_status_code;
                        if (hfverificationId.Value != grdVerificationReq.Items[i].Cells[5].Text.ToString())
                        {
                            objpopup.sz_flag = "DEL";
                        }
                        else
                        {
                            objpopup.sz_flag = "CONFIRM";
                        }

                        objarr.Add(objpopup);
                    }
                }
            }

            if (_objAL != null && _objAL.Count > 0)
            {
                try
                {
                    Bill_Sys_BillTransaction_BO obj2 = new Bill_Sys_BillTransaction_BO();
                    obj2.DeleteVerificationAns(_objAL);
                }
                catch (Exception ex)
                {
                    lblMessage.Visible      = false;
                    lblErrorMessage.Text    = "";
                    lblErrorMessage.Visible = true;
                    lblErrorMessage.Text    = ex.Message.ToString();
                }
            }
            ArrayList             FilePath = obj.DeleteVerificationNotes(objarr);
            Bill_Sys_NF3_Template objpath  = new Bill_Sys_NF3_Template();
            string PhysicalPath            = objpath.getPhysicalPath();
            {
                for (int i = 0; i < FilePath.Count; i++)
                {
                    string file_path = FilePath[i].ToString();
                    if (File.Exists(PhysicalPath + file_path))
                    {
                        if (!File.Exists(PhysicalPath + file_path + ".delete"))
                        {
                            File.Move(PhysicalPath + file_path, PhysicalPath + file_path + ".delete");
                        }
                    }
                }
            }

            BindGrid();
            lblErrorMessage.Visible = true;
            lblScan.Visible         = false;
            lblMessage.Visible      = true;
            lblMessage.Text         = "Record deleted successfully";
        }
        catch (Exception ex)
        {
            lblMessage.Visible      = false;
            lblScan.Visible         = false;
            lblErrorMessage.Text    = "";
            lblErrorMessage.Visible = true;
            lblErrorMessage.Text    = ex.Message.ToString();
        }
    }