public JsonResult Index(FirmaElectronicaModel oFirmaElectronicaModel)
        {
            String Resultado       = "";
            String vNuevoSigString = "";
            String pRutaArchivo    = string.Concat(System.Web.Hosting.HostingEnvironment.MapPath("~/DocumentosGenerados/"), "Firma_Electrina" + oFirmaElectronicaModel.oPersona.DNI + ".pdf");


            SIGPLUSLib.SigPlus oSigPlus = new SIGPLUSLib.SigPlus();
            oSigPlus.InitSigPlus();
            oSigPlus.SigCompressionMode = 0;
            oSigPlus.SigString          = oFirmaElectronicaModel.oFirmaElectronica.SIGSTRING;

            Obtener_Pdf_CC(pRutaArchivo, oFirmaElectronicaModel, oFirmaElectronicaModel.oFirmaElectronica.SIGSTRING);

            oSigPlus.EncryptionMode = 0;
            oSigPlus.AutoKeyData    = pRutaArchivo;
            oSigPlus.AutoKeyFinish();
            oSigPlus.EncryptionMode     = 2;
            oSigPlus.SigCompressionMode = 4;

            vNuevoSigString = oSigPlus.SigString;
            oFirmaElectronicaModel.oFirmaElectronica.SIGSTRING_ENCRIPTADA = vNuevoSigString;
            oFirmaElectronicaModel.Resultado = "Ok";

            return(Json(oFirmaElectronicaModel, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
 public bool SignSave(string imagePath, string PatientPath)
 {
     try
     {
         if (imagePath == null)
         {
             return(false);
         }
         SIGPLUSLib.SigPlus sigObj_Patient = new SIGPLUSLib.SigPlus();
         sigObj_Patient.InitSigPlus();
         sigObj_Patient.AutoKeyStart();
         sigObj_Patient.AutoKeyFinish();
         sigObj_Patient.SigCompressionMode = 1;
         sigObj_Patient.EncryptionMode     = 2;
         sigObj_Patient.SigString          = imagePath;
         if (sigObj_Patient.NumberOfTabletPoints() > 0)
         {
             sigObj_Patient.ImageFileFormat = 0;
             sigObj_Patient.ImageXSize      = 150;
             sigObj_Patient.ImageYSize      = 75;
             sigObj_Patient.ImagePenWidth   = 8;
             sigObj_Patient.SetAntiAliasParameters(1, 600, 700);
             sigObj_Patient.JustifyX    = 5;
             sigObj_Patient.JustifyY    = 5;
             sigObj_Patient.JustifyMode = 5;
             long   size;
             byte[] byteValue;
             sigObj_Patient.BitMapBufferWrite();
             size      = sigObj_Patient.BitMapBufferSize();
             byteValue = new byte[size];
             byteValue = (byte[])sigObj_Patient.GetBitmapBufferBytes();
             sigObj_Patient.BitMapBufferClose();
             System.IO.MemoryStream ms = new System.IO.MemoryStream(byteValue);
             if (ms.Length < 1024)
             {
                 return(false);
             }
             img = System.Drawing.Image.FromStream(ms);
             img.Save(PatientPath, System.Drawing.Imaging.ImageFormat.Bmp);
         }
         return(true);
     }
     catch (Exception ex)
     {
         Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
         return(false);
     }
 }
    protected void Page_Load(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());
        }
        _objcheckOut = new Bill_Sys_CheckoutBO();
        DigitalSign signobj = new DigitalSign();

        SIGPLUSLib.SigPlus sigObj_Patient1 = new SIGPLUSLib.SigPlus();
        objNF3Template = new Bill_Sys_NF3_Template();
        // DataSet dsObj = _objcheckOut.PatientName(Session["IMEventID"].ToString());
        //Session["ChkCaseID"] = ((SpecialityPDFDAO)Session["SPECIALITY_PDF_OBJECT"]).CaseID;

        if (((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).BT_REFERRING_FACILITY == true && ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_COMAPNY_ID != ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID)
        {
            sz_CompanyID = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_COMAPNY_ID;
            Bill_Sys_NF3_Template obj1 = new Bill_Sys_NF3_Template();
            sz_CompanyName = obj1.GetCompanyName(sz_CompanyID);
        }
        else
        {
            sz_CompanyID   = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            sz_CompanyName = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME;
        }



        sz_EventID = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;
        try
        {
            String szDefaultPath = (objNF3Template.getPhysicalPath()) + sz_CompanyName + "/" + ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID + "/Signs/";
            //Added By-Sunil
            string SaveSignPathlogical = sz_CompanyName + "/" + ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID + "/Signs/";
            //end
            if (!Directory.Exists(szDefaultPath))
            {
                Directory.CreateDirectory(szDefaultPath);
            }
            szDefaultPath = szDefaultPath + sz_EventID;
            //Added By-Sunil
            SaveSignPathlogical = SaveSignPathlogical + sz_EventID;
            //end
            DoctorImagePath        = szDefaultPath + "_DoctorSign.jpg";
            DoctorImagePathlogical = SaveSignPathlogical + "_DoctorSign.jpg";
            string sz_Patient_path                      = szDefaultPath + "_Patient.jpg";
            string sz_Patient_path_logical              = SaveSignPathlogical + "_Patient.jpg";
            string sz_Attorney_Path                     = szDefaultPath + "_Attoreny.jpg";
            string sz_Attorney_Path_logical             = SaveSignPathlogical + "_Attoreny.jpg";
            string sz_ParentOfMinorPatient_path         = szDefaultPath + "_ParentOfMinorPatient.jpg";
            string sz_ParentOfMinorPatient_path_logical = SaveSignPathlogical + "_ParentOfMinorPatient.jpg";
            string sz_Gardian_Path                      = szDefaultPath + "_Gardian.jpg";
            string sz_Gardian_Path_logical              = SaveSignPathlogical + "_Gardian.jpg";
            signobj.SignSave(Request.Form["hiddenPatient"], sz_Patient_path);
            signobj.SignSave(Request.Form["hidden"], sz_Attorney_Path);
            string RepresebtiveSign  = Request.Form["hiddenParentOfMinorPatient"].ToString();
            string RepresebtiveSign1 = Request.Form["hiddenGardian"].ToString();

            if (!RepresebtiveSign.Equals("FFFFFFFFF58841040500000004000000CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74"))
            {
                signobj.SignSave(Request.Form["hiddenParentOfMinorPatient"], sz_ParentOfMinorPatient_path);
            }
            else
            {
                signobj.SignSave(Request.Form["hiddenPatient"], sz_ParentOfMinorPatient_path);
            }


            if (!RepresebtiveSign1.Equals("FFFFFFFFF58841040500000004000000CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74"))
            {
                signobj.SignSave(Request.Form["hiddenGardian"], sz_Gardian_Path);
            }

            #region " "Barcode functionality
            DataSet dset = new DataSet();
            dset = _objcheckOut.GetNodeID(sz_CompanyID, sz_EventID);
            string          sz_NodeId                   = dset.Tables[0].Rows[0][1].ToString();
            string          sz_CaseId                   = dset.Tables[0].Rows[0][0].ToString();
            string          barcodeValue                = sz_CompanyID + "@" + sz_CaseId + "@" + sz_NodeId;
            String          sz_BarcodeImagePath         = (objNF3Template.getPhysicalPath()) + sz_CompanyName + "/" + ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID + "/Signs/";
            string          sz_BarcodeImagePath_logical = sz_CompanyName + "/" + ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID + "/Signs/";
            SpecialityPDFBO pdfbo = new SpecialityPDFBO();
            CaseBarcodePath             = pdfbo.GetBarCodePath(sz_CompanyID, sz_CaseId, sz_NodeId, sz_BarcodeImagePath);
            sz_BarcodeImagePath_logical = sz_BarcodeImagePath_logical + "BarcodeImg.jpg";
            #endregion
            //_objcheckOut.TestIntakeMri(sz_EventID, CaseBarcodePath, sz_Patient_path, sz_Attorney_Path, sz_ParentOfMinorPatient_path, sz_Gardian_Path);
            _objcheckOut.TestIntakeMri(sz_EventID, sz_BarcodeImagePath_logical, sz_Patient_path_logical, sz_Attorney_Path_logical, sz_ParentOfMinorPatient_path_logical, sz_Gardian_Path_logical);
            SpecialityPDFFill spf = new SpecialityPDFFill();
            ArrayList         obj = new ArrayList();
            spf.sz_EventID     = "";
            spf.sz_CompanyID   = sz_CompanyID;//spf.sz_CompanyID = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_COMAPNY_ID;
            spf.sz_CompanyName = sz_CompanyName;

            spf.sz_XMLPath = "MRI_INTAKE_XML_Path";
            spf.sz_PDFPath = "MRI_INTAKE_PDF_Path";

            spf.sz_Session_Id      = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;
            spf.SZ_USER_NAME       = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME;
            spf.SZ_SPECIALITY_NAME = "MRI";
            obj = FillPDFValue(spf);
            Response.Redirect(obj[1].ToString(), false);
            Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + obj[1] + "'); ", true);
            Response.Write("<script>window.open('" + obj[1] + "')</script>");

            spf.sz_Session_Id      = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;;
            spf.sz_CompanyID       = sz_CompanyID;
            spf.sz_EventID         = ((Bill_Sys_CaseObject)Session["CASE_OBJECT"]).SZ_CASE_ID;
            spf.SZ_PT_FILE_NAME    = obj[0].ToString();
            spf.SZ_PT_FILE_PATH    = obj[2].ToString();
            spf.SZ_SPECIALITY_CODE = "ININT";
            spf.SZ_SPECIALITY_NAME = "Intake Sheet";
            spf.SZ_USER_NAME       = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME;
            spf.savePDFForminDocMang(spf);
        }
        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 Page_Load(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());
        }
        _objcheckOut = new Bill_Sys_CheckoutBO();
        DigitalSign signobj = new DigitalSign();

        SIGPLUSLib.SigPlus sigObj_Patient1 = new SIGPLUSLib.SigPlus();
        objNF3Template = new Bill_Sys_NF3_Template();
        // DataSet dsObj = _objcheckOut.PatientName(Session["IMEventID"].ToString());
        //Session["ChkCaseID"] = ((SpecialityPDFDAO)Session["SPECIALITY_PDF_OBJECT"]).CaseID;
        sz_CompanyID   = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
        sz_CompanyName = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME;
        sz_EventID     = Session["PATIENT_LINE_CASE_ID"].ToString();
        int flag = 0;

        try
        {
            String szDefaultPath = (objNF3Template.getPhysicalPath()) + ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["PATIENT_LINE_CASE_ID"].ToString() + "/Signs/";
            //Added By-Sunil
            string SaveSignPathlogical = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["PATIENT_LINE_CASE_ID"].ToString() + "/Signs/";
            //end
            if (!Directory.Exists(szDefaultPath))
            {
                Directory.CreateDirectory(szDefaultPath);
            }
            szDefaultPath = szDefaultPath + sz_EventID;
            //Added By-Sunil
            SaveSignPathlogical = SaveSignPathlogical + sz_EventID;
            //end
            DoctorImagePath = szDefaultPath + "_DoctorSign.jpg";
            string DoctorImagePathlogical   = SaveSignPathlogical + "_DoctorSign.jpg";
            string PatientImagePathlogical  = SaveSignPathlogical + "_Patient.jpg";
            string sz_Attorney_Path_logical = SaveSignPathlogical + "_Attoreny.jpg";
            string sz_Patient_path          = szDefaultPath + "_Patient.jpg";
            string sz_Attorney_Path         = szDefaultPath + "_Attoreny.jpg";
            signobj.SignSave(Request.Form["hiddenPatient"], sz_Patient_path);
            signobj.SignSave(Request.Form["hidden"], sz_Attorney_Path);
            string RepresebtiveSign = Request.Form["hiddenPatientRepresentive"].ToString();
            if (!RepresebtiveSign.Equals("FFFFFFFFF58841040500000004000000CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74CF35D06FEE8E6C74"))
            {
                signobj.SignSave(Request.Form["hiddenPatientRepresentive"], DoctorImagePath);
            }
            else
            {
                DoctorImagePath = sz_Patient_path;
            }



            #region " "Barcode functionality
            DataSet dset = new DataSet();
            dset = _objcheckOut.GetIntakeSheetNodeID(sz_CompanyID, sz_EventID, "NFLNK");
            string sz_NodeId           = dset.Tables[0].Rows[0][0].ToString();
            string sz_CaseId           = sz_EventID.ToString();
            string barcodeValue        = sz_CompanyID + "@" + sz_CaseId + "@" + sz_NodeId;
            String sz_BarcodeImagePath = (objNF3Template.getPhysicalPath()) + ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["PATIENT_LINE_CASE_ID"].ToString() + "/Signs/";
            //Added By-Sunil
            string sz_BarcodeImagePathlogical = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + "/" + Session["PATIENT_LINE_CASE_ID"].ToString() + "/Signs/";
            //end
            //Added By-Sunil
            string CaseBarcodePathlogical = sz_BarcodeImagePathlogical + "BarcodeImg.jpg";
            //end
            SpecialityPDFBO pdfbo = new SpecialityPDFBO();
            CaseBarcodePath = pdfbo.GetBarCodePath(sz_CompanyID, sz_CaseId, sz_NodeId, sz_BarcodeImagePath);
            #endregion

            //_objcheckOut.LienPatientPath(sz_EventID, DoctorImagePath, CaseBarcodePath,sz_Patient_path,sz_Attorney_Path);
            _objcheckOut.LienPatientPath(sz_EventID, DoctorImagePathlogical, CaseBarcodePathlogical, PatientImagePathlogical, sz_Attorney_Path_logical);

            SpecialityPDFFill spf = new SpecialityPDFFill();
            ArrayList         obj = new ArrayList();
            spf.sz_EventID     = "";
            spf.sz_CompanyID   = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            spf.sz_CompanyName = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME;

            spf.sz_XMLPath = "LIEN_XML_Path";
            spf.sz_PDFPath = "LIEN_PDF_Path";

            spf.sz_Session_Id      = Session["PATIENT_LINE_CASE_ID"].ToString();
            spf.SZ_USER_NAME       = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME;
            spf.SZ_SPECIALITY_NAME = "Lien";
            obj = FillPDFValue(spf);
            Response.Redirect(obj[1].ToString(), false);
            Page.ClientScript.RegisterClientScriptBlock(typeof(GridView), "Msg", "window.open('" + obj[1] + "'); ", true);
            Response.Write("<script>window.open('" + obj[1] + "')</script>");

            spf.sz_Session_Id = Session["PATIENT_LINE_CASE_ID"].ToString();
            spf.sz_CompanyID  = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            //spf.sz_EventID = Session["AOB_EVENT_ID"].ToString();
            spf.SZ_PT_FILE_NAME    = obj[0].ToString();
            spf.SZ_PT_FILE_PATH    = obj[2].ToString();
            spf.SZ_SPECIALITY_CODE = "NFLNK";
            spf.SZ_SPECIALITY_NAME = "Lien";
            spf.SZ_USER_NAME       = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_NAME;
            spf.savePDFForminDocMang(spf);
        }
        catch (Exception ex)
        {
            Label1.Text = "Page Laod :" + ex.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);
        }

        #region "check version readonly or not"
        string app_status = ((Bill_Sys_BillingCompanyObject)Session["APPSTATUS"]).SZ_READ_ONLY.ToString();
        if (app_status.Equals("True"))
        {
            Bill_Sys_ChangeVersion cv = new Bill_Sys_ChangeVersion(this.Page);
            cv.MakeReadOnlyPage("Bill_Sys_Image_Save.aspx");
        }
        #endregion
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }