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;
        Bill_Sys_BillTransaction_BO obj;

        try
        {
            for (int i = 0; i < grdVerificationReq.Items.Count; i++)
            {
                if (((CheckBox)grdVerificationReq.Items[i].Cells[6].FindControl("chkDelete")).Checked == true)
                {
                    Bill_Sys_BillTransaction_BO _obj = new Bill_Sys_BillTransaction_BO();
                    string sz_status_code            = _obj.GetStatusCode(txtCompanyID.Text, grdVerificationReq.Items[i].Cells[5].Text.ToString());
                    objarr = new ArrayList();
                    objarr.Add(txtCompanyID.Text);
                    objarr.Add(txtViewBillNumber.Text);
                    objarr.Add(sz_status_code);

                    obj = new Bill_Sys_BillTransaction_BO();
                    obj.DeleteVerificationNotes(objarr);
                }
            }
            BindGrid();
        }
        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());
        }
    }
Example #2
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {//Logging Start
        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[7].FindControl("chkDelete")).Checked == true)
                {
                    string sz_status_code = grdVerificationReq.Items[i].Cells[8].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;
                        _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");
                        }
                    }
                }
            }
            BindGridforVerification();
            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());
        }
    }
Example #3
0
    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();
        }
    }