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

        try
        {
            string           sz_file_path      = "";
            string           szfilename        = "";
            Bill_Sys_invoice objInvoice        = new Bill_Sys_invoice();
            DataSet          dsinvoiceid       = new DataSet();
            DataSet          dspaymentamount   = new DataSet();
            Bill_Sys_invoice _Bill_Sys_invoice = new Bill_Sys_invoice();


            FileUpload _FileUpload = new FileUpload();
            ArrayList  arr         = new ArrayList();


            if (!fuUploadReport.HasFile)
            {
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "mm", " alert('please select file from upload Report !');showUploadFilePopup();", true);
                return;
            }

            dsinvoiceid = objInvoice.GetsoftwareInvoiceId(Session["payment_No"].ToString(), txtCompanyID.Text);


            string strBillNo  = "";
            string strCaseID  = "";
            string strsSpecID = "";
            sz_file_path = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/Comman Folder/";
            if (dsinvoiceid.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < dsinvoiceid.Tables[0].Rows.Count; i++)
                {
                    strBillNo  = dsinvoiceid.Tables[0].Rows[i][0].ToString();
                    strCaseID  = dsinvoiceid.Tables[0].Rows[i][1].ToString();
                    strsSpecID = dsinvoiceid.Tables[0].Rows[i][2].ToString();
                    Bill_Sys_SoftwareInVoice_UploadFile _objUploadFile = new Bill_Sys_SoftwareInVoice_UploadFile();

                    _objUploadFile.sz_bill_no    = strBillNo;
                    _objUploadFile.sz_case_id    = strCaseID;
                    _objUploadFile.sz_company_id = txtCompanyID.Text;
                    _objUploadFile.sz_FileName   = fuUploadReport.FileName;

                    _objUploadFile.sz_UserId     = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString();
                    _objUploadFile.sz_UserName   = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME.ToString();
                    _objUploadFile.sz_StatusCode = "";
                    _objUploadFile.sz_flag       = "PAY";

                    _objUploadFile.sz_payment_id    = Session["payment_No"].ToString();
                    _objUploadFile.sz_speciality_id = strsSpecID;

                    _objUploadFile.sz_File_PhysicalPath = sz_file_path;
                    arr.Add(_objUploadFile);
                }
            }

            _FileUpload.InvoiceUploadFile(arr);

            if (!Directory.Exists(ApplicationSettings.GetParameterValue("BASEPATH") + sz_file_path))
            {
                Directory.CreateDirectory(ApplicationSettings.GetParameterValue("BASEPATH") + sz_file_path);
            }
            fuUploadReport.SaveAs(ApplicationSettings.GetParameterValue("BASEPATH") + sz_file_path + fuUploadReport.FileName);


            dspaymentamount = _Bill_Sys_invoice.GetInvoicepaymnetDetails(Session["InvoiceID"].ToString());
            grdPaymentTransaction.DataSource = dspaymentamount;
            grdPaymentTransaction.DataBind();

            usrMessage.PutMessage("File Upload Successfully");
            usrMessage.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage);
            usrMessage.Show();
            ModalPopupExtender1.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());
        }
    }