예제 #1
0
    protected void btnSaveSendRequest_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());
        }
        try
        {
            string    billNo = "";
            ArrayList list   = new ArrayList();
            ArrayList list2  = new ArrayList();

            for (int i = 0; i < this.grdVerificationSend.Items.Count; i++)
            {
                Bill_Sys_Verification_Desc desc;
                TextBox box = (TextBox)this.grdVerificationSend.Items[i].FindControl("txtBoxAns");

                string cleanstr = WebUtils.CleanText(box.Text);

                if (box.Text.Trim().ToString() != "")
                {
                    desc                    = new Bill_Sys_Verification_Desc();
                    desc.sz_answer          = cleanstr;
                    desc.sz_bill_no         = this.grdVerificationSend.Items[i].Cells[0].Text.ToString();
                    desc.sz_verification_id = this.grdVerificationSend.Items[i].Cells[8].Text.ToString();
                    desc.sz_case_id         = this.grdVerificationSend.Items[i].Cells[9].Text.ToString();
                    list.Add(desc);
                    if (billNo == "")
                    {
                        billNo = "'" + this.grdVerificationSend.Items[i].Cells[0].Text.ToString() + "'";
                    }
                    else
                    {
                        billNo = billNo + ",'" + this.grdVerificationSend.Items[i].Cells[0].Text.ToString() + "'";
                    }
                }
                else
                {
                    desc                    = new Bill_Sys_Verification_Desc();
                    desc.sz_answer          = box.Text;
                    desc.sz_bill_no         = this.grdVerificationSend.Items[i].Cells[0].Text.ToString();
                    desc.sz_verification_id = this.grdVerificationSend.Items[i].Cells[8].Text.ToString();
                    desc.sz_answer_id       = this.grdVerificationSend.Items[i].Cells[7].Text.ToString();
                    desc.sz_company_id      = this.txtCompanyID.Text;
                    list2.Add(desc);
                }
            }
            Bill_Sys_NF3_Template template = new Bill_Sys_NF3_Template();
            if (list2.Count > 0)
            {
                new Bill_Sys_BillTransaction_BO().DeleteVerificationAns(list2);
            }
            if (list.Count > 0)
            {
                if (template.SetVerification_Answer(list, this.txtCompanyID.Text, ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_NAME) == 1)
                {
                    lblErrorMessage.Visible = false;
                    lblMessage.Visible      = true;
                    lblMessage.Text         = "Record saved successfully";
                    BindGrid();
                }
                else
                {
                    lblMessage.Visible      = false;
                    lblErrorMessage.Visible = true;
                    lblErrorMessage.Text    = "";
                    lblErrorMessage.Text    = "Error in transaction";
                }
            }
            else if ((list2.Count <= 0) && (list.Count <= 0))
            {
                lblMessage.Visible      = false;
                lblErrorMessage.Visible = true;
                lblErrorMessage.Text    = "";
                lblErrorMessage.Text    = "Add atleast one answer";
            }
        }
        catch (Exception ex)
        {
            lblMessage.Visible      = false;
            lblErrorMessage.Visible = true;
            lblErrorMessage.Text    = "";
            lblErrorMessage.Text    = ex.Message.ToString();
            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());
        }
    }