protected void btnFileUpload_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
        {
            this._saveOperation = new SaveOperation();
            this._editOperation = new EditOperation();
            this._nf3Template   = new Bill_Sys_NF3_Template();
            string physicalPath = this._nf3Template.getPhysicalPath();
            for (int i = 0; i < this.grdDocumentGrid.Items.Count; i++)
            {
                System.Web.UI.WebControls.FileUpload fileUpload = (System.Web.UI.WebControls.FileUpload) this.grdDocumentGrid.Items[i].FindControl("fileuploadDocument");
                string str = "";
                if (fileUpload.FileName != "")
                {
                    Bill_Sys_RequiredDocumentBO billSysRequiredDocumentBO = new Bill_Sys_RequiredDocumentBO();
                    string nodePath = billSysRequiredDocumentBO.GetNodePath(this.grdDocumentGrid.Items[i].Cells[this.COL_I_NODE_TYPE_ID].Text, this.txtCaseID.Text, ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    nodePath = nodePath.Replace("\\", "/");
                    str      = string.Concat(physicalPath, nodePath);
                    if (!Directory.Exists(str))
                    {
                        Directory.CreateDirectory(str);
                    }
                    fileUpload.SaveAs(string.Concat(str, "/", fileUpload.FileName));
                    ArrayList arrayLists = new ArrayList();
                    arrayLists.Add(this.txtCaseID.Text);
                    arrayLists.Add(this.grdDocumentGrid.Items[i].Cells[18].Text.Replace("/", ""));
                    arrayLists.Add(((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
                    arrayLists.Add(fileUpload.FileName);
                    arrayLists.Add(string.Concat(nodePath, "/"));
                    arrayLists.Add(((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_NAME);
                    arrayLists.Add(this.grdDocumentGrid.Items[i].Cells[this.COL_I_NODE_TYPE_ID].Text.ToString());

                    string str1 = this._nf3Template.SaveDocumentData(arrayLists);
                    if (!(this.grdDocumentGrid.Items[i].Cells[1].Text != "") || !(this.grdDocumentGrid.Items[i].Cells[1].Text != "&nbsp;"))
                    {
                        this.txtDocID.Text = this.grdDocumentGrid.Items[i].Cells[this.COL_I_DOCUMENT_TYPE_ID].Text;
                        if (!(this.grdDocumentGrid.Items[i].Cells[8].Text != "") || !(this.grdDocumentGrid.Items[i].Cells[8].Text != "&nbsp;"))
                        {
                            this.txtAssignOn.Text = "";
                        }
                        else
                        {
                            this.txtAssignOn.Text = this.grdDocumentGrid.Items[i].Cells[8].Text;
                        }
                        ExtendedDropDownList.ExtendedDropDownList extendedDropDownList = (ExtendedDropDownList.ExtendedDropDownList) this.grdDocumentGrid.Items[i].FindControl("extddlAssignTo");
                        if (!(extendedDropDownList.Text != "NA") || !(extendedDropDownList.Text != ""))
                        {
                            this.txtAssignTo.Text = "";
                        }
                        else
                        {
                            this.txtAssignTo.Text = extendedDropDownList.Text;
                        }
                        TextBox textBox = (TextBox)this.grdDocumentGrid.Items[i].FindControl("txtNotes");
                        if (textBox.Text == "")
                        {
                            this.txtNotes.Text = "";
                        }
                        else
                        {
                            this.txtNotes.Text = textBox.Text;
                        }
                        this.txtRecieved.Text        = "1";
                        this.txtImageId.Text         = str1;
                        this._saveOperation.WebPage  = this.Page;
                        this._saveOperation.Xml_File = "CaseTypeDocumentXML.xml";
                        this._saveOperation.SaveMethod();
                    }
                    else
                    {
                        this.txtDocID.Text = this.grdDocumentGrid.Items[i].Cells[1].Text;
                        if (!(this.grdDocumentGrid.Items[i].Cells[8].Text != "") || !(this.grdDocumentGrid.Items[i].Cells[8].Text != "&nbsp;"))
                        {
                            this.txtAssignOn.Text = "";
                        }
                        else
                        {
                            this.txtAssignOn.Text = this.grdDocumentGrid.Items[i].Cells[8].Text;
                        }
                        ExtendedDropDownList.ExtendedDropDownList extendedDropDownList1 = (ExtendedDropDownList.ExtendedDropDownList) this.grdDocumentGrid.Items[i].FindControl("extddlAssignTo");
                        if (!(extendedDropDownList1.Text != "NA") || !(extendedDropDownList1.Text != ""))
                        {
                            this.txtAssignTo.Text = "";
                        }
                        else
                        {
                            this.txtAssignTo.Text = extendedDropDownList1.Text;
                        }
                        TextBox textBox1 = (TextBox)this.grdDocumentGrid.Items[i].FindControl("txtNotes");
                        if (textBox1.Text == "")
                        {
                            this.txtNotes.Text = "";
                        }
                        else
                        {
                            this.txtNotes.Text = textBox1.Text;
                        }
                        this.txtRecieved.Text             = "1";
                        this.txtImageId.Text              = str1;
                        this._editOperation.WebPage       = this.Page;
                        this._editOperation.Xml_File      = "CaseTypeDocumentXML.xml";
                        this._editOperation.Primary_Value = this.grdDocumentGrid.Items[i].Cells[1].Text;
                        this._editOperation.UpdateMethod();
                    }
                }
            }
            this.BindCaseDocumentGrid();
            this.usrMessage.PutMessage("Changes to the server were made successfully");
            this.usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
            this.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
    protected void btnUploadFile_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());
        }
        Bill_Sys_NF3_Template objNF3Template = new Bill_Sys_NF3_Template();

        _bill_Sys_BillingCompanyDetails_BO = new Bill_Sys_BillingCompanyDetails_BO();
        string strLinkPath = "";

        try
        {
            if (!fuUploadReport.HasFile)
            {
                Page.RegisterStartupScript("ss", "<script language='javascript'> alert('please select file from upload Report !');showUploadFilePopup();</script>");
                return;
            }
            String szDefaultPath    = objNF3Template.getPhysicalPath();
            int    ImageId          = 0;
            String szDestinationDir = "";

            szDestinationDir = objNF3Template.GetCompanyName(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
            _obj             = new Bill_Sys_BillTransaction_BO();
            Bill_Sys_RequiredDocumentBO bo = new Bill_Sys_RequiredDocumentBO();
            String NodeId     = _obj.GetNodeIDMST_Nodes(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, "NFPAY");
            string szNodePath = bo.GetNodePath(NodeId, ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
            szNodePath  = szNodePath.Replace("\\", "/");
            strLinkPath = szNodePath + "/" + fuUploadReport.FileName;
            if (!Directory.Exists(szDefaultPath + szNodePath + "/"))
            {
                Directory.CreateDirectory(szDefaultPath + szNodePath + "/");
            }
            //if (!File.Exists(szDefaultPath + szDestinationDir + fuUploadReport.FileName))
            //{
            fuUploadReport.SaveAs(szDefaultPath + szNodePath + "/" + fuUploadReport.FileName);
            // Start : Save report under document manager.

            //String NodeId = _obj.GetNodeID(txtCompanyID.Text, ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID.ToString(), "NFPAY");
            ArrayList objAL = new ArrayList();

            objAL.Add(((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID);
            objAL.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);

            objAL.Add(fuUploadReport.FileName);
            objAL.Add(szNodePath + "/");
            objAL.Add(NodeId);
            objAL.Add("");
            objNF3Template.UpdateDocMgr(objAL);
            // End :   Save report under document manager.
            //}
            // Code To get Image Id Of Saved Record
            ArrayList objALImage = new ArrayList();
            objALImage.Add(((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID);
            objALImage.Add("");
            objALImage.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
            objALImage.Add(fuUploadReport.FileName);
            objALImage.Add(szNodePath + "/");
            objALImage.Add(((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME.ToString());
            objALImage.Add(NodeId);
            string ImgId = objNF3Template.SaveDocumentData(objALImage);
            // End of Code

            //Function To Save Entry In Txn_Bil_Payment_Images Table
            ArrayList objarrtxnbill = new ArrayList();
            objarrtxnbill.Add(txtBillNo.Text);
            objarrtxnbill.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
            objarrtxnbill.Add(ImgId);
            objarrtxnbill.Add(((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID);
            objarrtxnbill.Add(Session["payment_No"].ToString());
            _bill_Sys_BillingCompanyDetails_BO.InsertBillPaymentImages(objarrtxnbill);
            //End Of  Function
            BindGrid();
            usrMessage.PutMessage("File Upload Successfully");
            usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
            usrMessage.Show();
            //lblMsg.Text = "File Upload Successfully";
            //lblMsg.Visible = true;
        }
        //Page.RegisterStartupScript("ss", "<script language = 'javascript'>alert('Report received successfully.');</script>");


        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());
        }
    }