Beispiel #1
0
    protected void grdInvoiceReport_RowCommand(object sender, GridViewCommandEventArgs 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
        {
            if (e.CommandName == "InvoiceId")
            {
                int        index        = Convert.ToInt32(e.CommandArgument);
                LinkButton lnkInvoiceId = new LinkButton();
                lnkInvoiceId = (LinkButton)grdInvoiceReport.Rows[index].FindControl("lnkSelectCase");
                string InvoiceId = lnkInvoiceId.Text;
                string Case_Id   = grdInvoiceReport.DataKeys[index][0].ToString();
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "mm", "OpenInvoiceWiseItem(" + InvoiceId + "," + Case_Id + ");", true);
            }
            if (e.CommandName == "Generate Invoice")
            {
                #region "Logic to view bills"
                string InvoiceId = e.CommandArgument.ToString();
                _InvoiceDAO = new InvoiceDAO();
                string PDF_Path;
                PDF_Path = _InvoiceDAO.GetPDFPath(InvoiceId, txtCompanyId.Text);

                if (PDF_Path.ToString() != "")
                {
                    //PDF_Path = ConfigurationSettings.AppSettings["DocumentManagerURL"].ToString() + PDF_Path;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "starScript", "window.open('" + PDF_Path + "');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "starScript", "alert('No Invoice Generated ...!');", true);
                }

                #endregion
            }

            if (e.CommandName == "Make Payment")
            {
                string InvoiceId = e.CommandArgument.ToString();
                lblPosteddate.Text  = DateTime.Today.ToShortDateString();
                txtPaymentDate.Text = lblPosteddate.Text;
                lblInvoiceId.Text   = InvoiceId.ToString();
                btnUpdate.Enabled   = false;
                btnSave.Enabled     = true;
                txtCompanyID1.Text  = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                txtCaseID.Text      = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;
                txtUserID.Text      = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID;
                BindGrid();
                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());
        }
    }
    protected void css_btnSave_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());
        }
        string sz_EventID, sz_CompanyID, sz_CompanyName, XML_Path, PDF_Path, sz_Session_Id;

        TXT_WEEK.Text = RDO_WEEK.SelectedValue.ToString();
        try
        {
            if (Page.IsValid)
            {
                SaveOperation _saveOperation = new SaveOperation();
                _saveOperation.WebPage  = this.Page;
                _saveOperation.Xml_File = "RefferalXML.xml";
                _saveOperation.SaveMethod();
            }
            Bill_Sys_CheckoutBO obj   = new Bill_Sys_CheckoutBO();
            ArrayList           objal = new ArrayList();
            if (obj.ChekCORefferalSignPath(Convert.ToInt32(TXT_I_EVENT.Text)))
            {
                //    string sz_EventId = TXT_I_EVENT.Text;
                //    FillPDFValue(sz_EventId, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME);
                sz_EventID     = Session["CO_Refferal_Event_Id"].ToString();
                sz_CompanyID   = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
                sz_CompanyName = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME;
                SpecialityPDFFill spf = new SpecialityPDFFill();
                spf.sz_EventID         = sz_EventID.ToString();
                spf.sz_CompanyID       = sz_CompanyID.ToString();
                spf.sz_CompanyName     = sz_CompanyName.ToString();
                XML_Path               = "CO_Refferal_XML_Path";
                PDF_Path               = "CO_Refferal_PDF_Path";
                spf.sz_XMLPath         = XML_Path.ToString();
                spf.sz_PDFPath         = PDF_Path.ToString();
                sz_Session_Id          = Session["CO_Refferal_CaseID"].ToString();
                spf.sz_Session_Id      = sz_Session_Id.ToString();
                spf.SZ_SPECIALITY_NAME = "IM";
                spf.SZ_USER_NAME       = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME;
                objal = spf.FillPDFValue(spf);
                Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + objal[1] + "'); ", true);
                // Response.Write("<script>window.open('" + objal[1] + "')</script>");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('Bill_Sys_CO_Refferal_PhisicianSign.aspx','Sign','toolbar=no,directories=no,menubar=no,scrollbars=no,status=no,resizable=no,width=700,height=575'); ", true);
            }
        }

        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());
        }
    }
    protected void btnSumbit_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_CheckoutBO   _objcheckOut   = new Bill_Sys_CheckoutBO();
        Bill_Sys_NF3_Template objNF3Template = new Bill_Sys_NF3_Template();
        string sz_CompanyID   = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
        string sz_CompanyName = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME;
        string sz_EventID     = Session["CO_Refferal_Event_Id"].ToString();
        string XML_Path;
        string PDF_Path;

        int    flag            = 0;
        string DoctorImagePath = "";
        //string PatientImagePath = Session["PatientImagePath"].ToString();
        string CaseBarcodePath = "";

        try
        {
            string sz_NodeId;
            string sz_CaseId;
            String sz_BarcodeImagePath;
            string sz_Session_Id;
            String szDefaultPath = (objNF3Template.getPhysicalPath()) + ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["CO_Refferal_CaseID"].ToString() + "/Signs/";
            if (!Directory.Exists(szDefaultPath))
            {
                Directory.CreateDirectory(szDefaultPath);
            }
            szDefaultPath = szDefaultPath + sz_EventID;
            if (WebSignature2.ExportToStreamOnly())
            {
                System.IO.MemoryStream imgstream2 = (System.IO.MemoryStream)(WebSignature2.ImageMemoryStream);
                {
                    if (imgstream2 != null)
                    {
                        byte[] imageContent2 = new Byte[imgstream2.Length];
                        imgstream2.Position = 0;
                        imgstream2.Read(imageContent2, 0, (int)imgstream2.Length);
                        Response.ContentType = "image/jpeg";
                        Response.BinaryWrite(imageContent2);
                        Bitmap bmp  = new Bitmap(imgstream2);
                        double size = 0.15;
                        ResizeImage((System.Drawing.Image)bmp, size);
                        DoctorImagePath = szDefaultPath + "_PhysicianSign.jpg";
                        Img.Save(DoctorImagePath);
                        DataSet dset = new DataSet();
                        dset = _objcheckOut.GetNodeID(sz_CompanyID, sz_EventID);

                        sz_NodeId = dset.Tables[0].Rows[0][1].ToString();
                        sz_CaseId = dset.Tables[0].Rows[0][0].ToString();


                        sz_BarcodeImagePath = (objNF3Template.getPhysicalPath()) + ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["CO_Refferal_CaseID"].ToString() + "/Signs/";



                        //code by tushar to centralise barcode generation process
                        SpecialityPDFBO pdfbo = new SpecialityPDFBO();
                        CaseBarcodePath = pdfbo.GetBarCodePath(sz_CompanyID, sz_CaseId, sz_NodeId, sz_BarcodeImagePath);
                        //end of code
                    }
                    else
                    {
                        flag = 2;
                    }
                }
            }


            _objcheckOut.SaveCORefferalSignPath(sz_EventID, DoctorImagePath, CaseBarcodePath);


            // Code by tushar to centralise pdf generation process
            SpecialityPDFFill spf = new SpecialityPDFFill();
            ArrayList         obj = new ArrayList();
            spf.sz_EventID         = sz_EventID;
            spf.sz_CompanyID       = sz_CompanyID;
            spf.sz_CompanyName     = sz_CompanyName;
            XML_Path               = "CO_Refferal_XML_Path";
            PDF_Path               = "CO_Refferal_PDF_Path";
            spf.sz_XMLPath         = XML_Path.ToString();
            spf.sz_PDFPath         = PDF_Path.ToString();
            sz_Session_Id          = Session["CO_Refferal_Event_Id"].ToString();
            spf.sz_Session_Id      = sz_Session_Id.ToString();
            spf.SZ_USER_NAME       = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME;
            spf.SZ_SPECIALITY_NAME = "CH";
            obj = spf.FillPDFValue(spf);

            Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + obj[1] + "'); ", true);
            Response.Write("<script>window.open('" + obj[1] + "')</script>");
            //end of code
        }
        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());
        }
    }