コード例 #1
0
    private void BindControls()
    {
        try
        {
            CommonFunctions.Event_Trap(this);

            //Clear the controls
            ClearControls();

            //Get the Client Pharmacies data from Session's DataSet Client Summary
            //and merge the same in dsClientPharmacies
            //no need to fetch again from database

            objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();
            string DOB = "";
            //Added by Loveena in ref to task# 2417 MM-1.9 to retrieve HTML Client Summary
            if (_DataSetClientSummary.Tables.Contains("ClientHTMLSummary") == true)
            {
                // Bind Name
                //Increasing the Limit from 15 to 35 on the basis of Task#2896 1.9.8.9 Patient Overview Edit - Widen Client Name
                LabelClientName.Text = ApplicationCommonFunctions.cutText((_DataSetClientSummary.Tables["ClientGeneralInfo"].Rows[0]["ClientName"].ToString()), 35);

                // Bind DOB/Age
                if (_DataSetClientSummary.Tables["ClientGeneralInfo"].Rows[0]["DOB"].ToString() != "")
                {
                    DOB = Convert.ToDateTime(_DataSetClientSummary.Tables["ClientGeneralInfo"].Rows[0]["DOB"].ToString()).ToString("MM/dd/yyyy");
                }
            }
            else if (_DataSetClientSummary.Tables.Contains("ClientInfoAreaHtml") == true)
            {
                //Increasing the Limit from 15 to 35 on the basis of Task#2896 1.9.8.9 Patient Overview Edit - Widen Client Name
                LabelClientName.Text = ApplicationCommonFunctions.cutText((_DataSetClientSummary.Tables["ClientInformation"].Rows[0]["ClientName"].ToString()), 35);

                // Bind DOB/Age
                if (_DataSetClientSummary.Tables["ClientInformation"].Rows[0]["DOB"].ToString() != "")
                {
                    DOB = Convert.ToDateTime(_DataSetClientSummary.Tables["ClientInformation"].Rows[0]["DOB"].ToString()).ToString("MM/dd/yyyy");
                }
            }
            if (DOB == string.Empty)
            {
                LabelClientDOB.Text = "";
            }
            else
            {
                LabelClientDOB.Text = DateTime.Parse(DOB).ToString("MM/dd/yyyy");
            }

            //Set Values for HiddenFields.
            HiddenPreferredPharmacy1.Value = DropDownListPharmacy1.SelectedValue;
            HiddenPreferredPharmacy2.Value = DropDownListPharmacy2.SelectedValue;
            HiddenPreferredPharmacy3.Value = DropDownListPharmacy3.SelectedValue;
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
コード例 #2
0
    public void ShowReport(string _strScriptIds)
    {
        FileStream fs;
        TextWriter ts;
        ArrayList  ScriptArrays;
        ArrayList  ChartScriptArrays;
        bool       _strFaxSendStatus   = false;
        string     _strFaxFaildMessage = "";



        try
        {
            string strPath  = "";
            string FileName = "";
            fs = new FileStream(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\Report.html"), FileMode.Create);
            ts = new StreamWriter(fs);
            divReportViewer.InnerHtml = "";

            string strPageHtml = "";
            ScriptArrays = new ArrayList();
            ScriptArrays = ApplicationCommonFunctions.StringSplit(_strScriptIds, "^");


            for (int i = 0; i < ScriptArrays.Count; i++)
            {
                foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                {
                    FileName = file.Substring(file.LastIndexOf("\\") + 1);
                    if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0) && (FileName.IndexOf(ScriptArrays[i].ToString(), 3) >= 0))
                    {
                        //strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + ScriptArrays[i] + "\\" + FileName + "'/>";
                        strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName + "'/>";
                    }
                    //  strPageHtml += "<img src='\\RDLC\\" +  Context.User.Identity.Name  + file.ToString() + "'>";
                    //strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + ScriptArrays[i] + "\\" + FileName;
                    strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName;
                    //ts.WriteLine("<img src='" + file.ToString() + "'>");
                }
            }


            divReportViewer.InnerHtml = "";
            divReportViewer.InnerHtml = strPageHtml;

            ts.Close();
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
コード例 #3
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        FileStream fs;
        TextWriter ts;
        string     _strScriptIds = "";
        ArrayList  ScriptArrays;
        string     _strChartScriptIds = "";
        ArrayList  ChartScriptArrays;
        bool       _strFaxSendStatus             = false;
        string     _strFaxFaildMessage           = "";
        Dictionary <string, string> filePathList = new Dictionary <string, string>();

        string imagePath = string.Empty;

        try
        {
            #region "error message color added by rohit ref. #121"
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
            #endregion

            string strPath  = "";
            string FileName = "";

            DataSet DatasetSystemConfigurationKeys = null;
            Streamline.DataService.SharedTables objSharedTables = new Streamline.DataService.SharedTables();
            DatasetSystemConfigurationKeys = objSharedTables.GetSystemConfigurationKeys();
            if (objSharedTables.GetSystemConfigurationKeys("PRINTFOURPRESCRIPTIONSPERPAGE", DatasetSystemConfigurationKeys.Tables[0]).ToUpper() == "YES")
            {
                Printheader.Text = "";
                Printfourprescriptionsperpage = "Y";
            }


            fs            = new FileStream(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\Report.html"), FileMode.Create);
            ts            = new StreamWriter(fs);
            _strScriptIds = Request.QueryString["varScriptIds"].ToString();
            if (Request.QueryString["varChartScriptIds"] != null)
            {
                _strChartScriptIds = Request.QueryString["varChartScriptIds"].ToString();
            }
            _strFaxSendStatus = Convert.ToBoolean(Request.QueryString["varFaxSendStatus"]);

            string strPageHtml = "";
            ScriptArrays = new ArrayList();
            if (_strScriptIds.Contains("^"))
            {
                ScriptArrays = ApplicationCommonFunctions.StringSplit(_strScriptIds, "^");
            }
            else if (_strScriptIds.Contains(","))
            {
                ScriptArrays = ApplicationCommonFunctions.StringSplit(_strScriptIds, ",");
            }
            else
            {
                ScriptArrays = ApplicationCommonFunctions.StringSplit(_strScriptIds, ",");
            }

            ChartScriptArrays = new ArrayList();
            if (_strChartScriptIds.Contains("^"))
            {
                ChartScriptArrays = ApplicationCommonFunctions.StringSplit(_strChartScriptIds, "^");
            }
            else if (_strChartScriptIds.Contains(","))
            {
                ChartScriptArrays = ApplicationCommonFunctions.StringSplit(_strChartScriptIds, ",");
            }
            else
            {
                ChartScriptArrays = ApplicationCommonFunctions.StringSplit(_strChartScriptIds, ",");
            }

            if (_strFaxSendStatus == false)
            {
                _strFaxFaildMessage = "Script could not be faxed at this time.  The fax server is not available.  Please print the script or re-fax the script later.";
                strPageHtml        += "<span style='float:left;position:absolute;padding-left:30%;color:Red;text-align:center;font-size: 12px;font-family:Microsoft Sans Serif;'><b>" + _strFaxFaildMessage + "</b></span><br/>";
            }
            //End here
            for (int i = 0; i < ScriptArrays.Count; i++)
            {
                foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                {
                    FileName = file.Substring(file.LastIndexOf("\\") + 1);
                    if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0) && (FileName.IndexOf(ScriptArrays[i].ToString()) >= 0))
                    {
                        strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName + "'  style='width:100%' />";
                        imagePath    = "RDLC\\" + Context.User.Identity.Name + "\\" + FileName;
                        filePathList.Add(FileName, imagePath);
                    }
                    strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName;
                    strPath = strPath.Replace(@"\", "/");
                }
            }

            //Get the Images from ChartScripts Folder
            for (int i = 0; i < ChartScriptArrays.Count; i++)
            {
                if (
                    Directory.Exists(
                        Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\" + "ChartScripts" + "\\")))
                {
                    foreach (
                        string file in
                        Directory.GetFiles(
                            Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\" + "ChartScripts" + "\\"))
                        )
                    {
                        FileName = file.Substring(file.LastIndexOf("\\") + 1);
                        if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0) &&
                            (FileName.IndexOf(ChartScriptArrays[i].ToString()) >= 0))
                        {
                            strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" +
                                           "ChartScripts" + "\\" + FileName + "'  style='width:100%' />";
                        }
                        strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + "ChartScripts" + "\\" +
                                  FileName;
                    }
                }
            }

            //byte[] photo = org_logo(imagePath);
            string pageHTMLWithWatermark = string.Empty;

            bool printWithWatermark = false;
            int  drugCategory       = 0;
            Streamline.UserBusinessServices.DataSets.DataSetClientMedicationOrders _DataSetOrderDetails = Session["DataSetOrderDetails"] as DataSetClientMedicationOrders;
            string PharmacyName   = Convert.ToString(Session["PharmacyName"]);
            string OrderingMethod = Convert.ToString(Session["OrderingMethod"]);
            if (OrderingMethod.Contains("Elec"))
            {
                if (Session["MedicationOrderStatus"] != null && Convert.ToString(Session["MedicationOrderStatus"]).Equals("Successful") &&
                    Session["DrugCategory"] != null)
                {
                    drugCategory = Convert.ToInt32(Session["DrugCategory"]);
                    if (drugCategory >= 2)
                    {
                        foreach (KeyValuePair <string, string> imageParameters in filePathList)
                        {
                            string phyisicalPathName = AddWatermark(imageParameters.Value, imageParameters.Key, OrderStatus.Success);
                            pageHTMLWithWatermark += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + phyisicalPathName + "'/>";
                            printWithWatermark     = true;
                        }
                    }
                }
                else if (Session["MedicationOrderStatus"] != null && !Convert.ToString(Session["MedicationOrderStatus"]).Equals("Successful") &&
                         Session["DrugCategory"] != null)
                {
                    drugCategory = Convert.ToInt32(Session["DrugCategory"]);
                    foreach (KeyValuePair <string, string> imageParameters in filePathList)
                    {
                        string phyisicalPathName = AddWatermark(imageParameters.Value, imageParameters.Key, OrderStatus.Failure);
                        pageHTMLWithWatermark += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + phyisicalPathName + "'/>";
                        printWithWatermark     = true;
                    }
                }
            }
            else
            {
                if (Session["MedicationOrderStatus"] != null && !Convert.ToString(Session["MedicationOrderStatus"]).Equals("Successful") &&
                    Session["DrugCategory"] != null)
                {
                    drugCategory = Convert.ToInt32(Session["DrugCategory"]);
                    foreach (KeyValuePair <string, string> imageParameters in filePathList)
                    {
                        if (ChartScriptArrays.Count == 0)
                        {
                            string phyisicalPathName = AddOriginalPrescriptionImage(imageParameters.Value, imageParameters.Key);
                            pageHTMLWithWatermark += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + phyisicalPathName + "'/>";
                            printWithWatermark     = true;
                        }
                    }
                }
                printWithWatermark = true;
            }

            ts.Close();
            if (printWithWatermark && pageHTMLWithWatermark != "")
            {
                Response.Write(pageHTMLWithWatermark);
            }
            else
            {
                strPageHtml = strPageHtml.Replace(@"\", "/");
            }
            Response.Write(strPageHtml);
            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "printScript();", true);
        }
        catch (Exception ex)
        {
            Response.Write("Error While Generating Report" + ex.Message.ToString());
        }
        finally
        {
            fs                 = null;
            ts                 = null;
            _strScriptIds      = null;
            ScriptArrays       = null;
            ChartScriptArrays  = null;
            _strChartScriptIds = null;
        }
    }
コード例 #4
0
    public override void Activate()
    {
        try
        {
            LabelMedicalStaffName.Text = ((StreamlineIdentity)Context.User.Identity).LastName + ", " +
                                         ((StreamlineIdentity)Context.User.Identity).FirstName;
            //Code added by Loveena in ref to Task#3234 2.3 Show Client Demographics on All Client Pages
            if (Session["DataSetClientSummary"] != null)
            {
                var _DataSetClientSummary = (DataSet)Session["DataSetClientSummary"];
                //Modified by Loveena in ref to Task#3265
                LabelClientName.Text =
                    _DataSetClientSummary.Tables["ClientInformation"].Rows[0]["ClientInformationLabel"].ToString();
            }
            FillDocumentCodes();
            FillRelationShips();

            RadioButtonMedicalStaff.Text = ((StreamlineIdentity)Context.User.Identity).LastName + ", " +
                                           ((StreamlineIdentity)Context.User.Identity).FirstName + " (Medical Staff)";
            RadioButtonPatient.Text = ((StreamlinePrinciple)Context.User).Client.LastName + ", " +
                                      ((StreamlinePrinciple)Context.User).Client.FirstName + " (Patient)";
            HiddenFieldImageConsentClick = (HiddenField)Page.FindControl("HiddenFieldImageConsentClick");
            HiddenFieldImageClientmedicationConsentId =
                (HiddenField)Page.FindControl("HiddenFieldImageClientmedicationConsentId");
            HiddenFieldClientmedicationIdForConsent =
                (HiddenField)Page.FindControl("HiddenFieldClientmedicationIdForConsent");
            HiddenFieldCheckImageClick = (HiddenField)Page.FindControl("HiddenFieldCheckImageClick");
            SetBrowsersUrl();
            CreateDocumentDataSet();
            ApplicationCommonFunctions objApplicationCommonFunctions = null;
            objApplicationCommonFunctions = new ApplicationCommonFunctions();
            DataSet SystemConfigurations = objApplicationCommonFunctions.GetSystemConfigurations();
            if (SystemConfigurations.Tables.Count > 0)
            {
                if (SystemConfigurations.Tables[0].Rows.Count > 0)
                {
                    DataRow dataRowSystemConfigs = SystemConfigurations.Tables[0].Rows[0];
                    if (dataRowSystemConfigs.Table.Columns.Contains("DocumentSignaturesNoPassword") &&
                        dataRowSystemConfigs["DocumentSignaturesNoPassword"].ToString() == "Y")
                    {
                        HiddenFieldDocumentSignaturesNoPassword.Value = "True";
                    }
                    HiddenFieldStaffPassword.Value = ((StreamlineIdentity)Context.User.Identity).Password;
                }
            }

            if (HiddenFieldImageConsentClick.Value != "" && HiddenFieldImageConsentClick.Value != null)
            {
                if (HiddenFieldImageConsentClick.Value == "Patient Consent")
                {
                    GetRDLCContents();
                }
                else
                {
                    LabelSignedNotSigned.Text    = "Signed by Medical Staff";
                    RadioButtonPatient.Enabled   = true;
                    RadioButtonPatient.Checked   = true;
                    RadioButtonRelation.Enabled  = true;
                    DropDownRelationShip.Enabled = true;
                    TextBoxSignatureName.Enabled = true;
                    GetRDLCContents();
                }
            }
            else
            {
                Session["VersionIdForConsentDetailPage"] = null;
            }
            RadioButtonMedicalStaff.Attributes.Add("onkeydown",
                                                   CommonFunctions.ReturnJSForClickEvent(ButtonSign.UniqueID));
            RadioButtonPatient.Attributes.Add("onkeydown", CommonFunctions.ReturnJSForClickEvent(ButtonSign.UniqueID));
            RadioButtonRelation.Attributes.Add("onkeydown", CommonFunctions.ReturnJSForClickEvent(ButtonSign.UniqueID));
            TextBoxSignatureName.Attributes.Add("onkeydown",
                                                "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" +
                                                ButtonSign.UniqueID + "').click();return false;}} else {return true}; ");
            DropDownRelationShip.Attributes.Add("onkeydown", CommonFunctions.ReturnJSForClickEvent(ButtonSign.UniqueID));
        }
        catch (Exception ex)
        {
        }
    }
コード例 #5
0
    public void GetRDLCContents()
    {
        #region Get RDLC Contents

        string   _ReportPath = "";
        string   mimeType;
        string   encoding;
        string   fileNameExtension;
        string[] streams;

        DataSet    _DataSetGetRdlCName      = null;
        DataSet    _DataSetRdlForMainReport = null;
        DataSet    _DataSetRdlForSubReport  = null;
        DataRow[]  dr              = null;
        DataRow[]  _drSubReport    = null;
        string     _OrderingMethod = "";
        string     strErrorMessage = "";
        LogManager objLogManager   = null;

        ReportParameter[] _RptParam = null;
        int LocationId = 1;
        //End
        //Block For ReportPath
        reportViewer1 = new ReportViewer();
        //Ref to Task#2660
        string FileName = "";
        int    seq      = 1;
        try
        {
            _ReportPath = Server.MapPath(".") + ConfigurationManager.AppSettings["MedicationPerscriptionReportUrl"];
            if (_ReportPath == "") //Check For Report Path
            {
                strErrorMessage = "ReportPath is Missing In WebConfig";
                ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID,
                                                    "ShowError('" + strErrorMessage + "', true);", true);
                return;
            }
        }
        catch (Exception ex)
        {
            LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);

            strErrorMessage = "ReportPath Key is Missing In WebConfig";
            ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID,
                                                "ShowError('" + strErrorMessage + "', true);", true);
            return;
        }
        finally
        {
            objLogManager = null;
        }

        try
        {
            //  _DataSetRdl = new DataSet();//Commented by Vikas Vyas On Dated March 04 2008
            ClientMedication objectClientMedications = null;
            objectClientMedications = new ClientMedication();

            //Get the Name of the Rdlc,StoredProcedure from DocumentCodes,DocumentCodesRDLSubReports
            _DataSetGetRdlCName = objectClientMedications.GetRdlCNameDataBase(1026);
            _DataSetGetRdlCName.Tables[0].TableName = "DocumentCodes";
            _DataSetGetRdlCName.Tables[1].TableName = "DocumentCodesRDLSubReports";


            if (_DataSetGetRdlCName.Tables["DocumentCodes"].Rows.Count > 0)
            {
                dr = _DataSetGetRdlCName.Tables["DocumentCodes"].Select();
                //because DocumentCodes table only contain one row


                //_OrderingMethod = OrderingMethod;


                //Check For Main Report
                if ((dr[0]["DocumentName"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["DocumentName"].ToString())) &&
                    (dr[0]["ViewStoredProcedure"] != DBNull.Value ||
                     !String.IsNullOrEmpty(dr[0]["ViewStoredProcedure"].ToString())))
                {
                    #region Get the StoredProceudreName and Execute

                    string _StoredProcedureName = "";
                    string _ReportName          = "";
                    _StoredProcedureName = dr[0]["ViewStoredProcedure"].ToString(); //Get the StoredProcedure Name
                    _ReportName          = dr[0]["DocumentName"].ToString();

                    reportViewer1.ProcessingMode         = ProcessingMode.Local;
                    reportViewer1.LocalReport.ReportPath = _ReportPath + "\\" + _ReportName + ".rdlc";
                    reportViewer1.LocalReport.DataSources.Clear();

                    if (Session["VersionIdForConsentDetailPage"] != null)
                    {
                        _DataSetRdlForMainReport =
                            objectClientMedications.GetDataForHarborStandardConsentRdlC(_StoredProcedureName,
                                                                                        Convert.ToInt32(
                                                                                            (((StreamlinePrinciple)
                                                                                              Context.User).Client
                                                                                             .ClientId)),
                                                                                        Convert.ToString(
                                                                                            HiddenFieldClientmedicationIdForConsent
                                                                                            .Value),
                                                                                        Convert.ToInt32(
                                                                                            Session[
                                                                                                "VersionIdForConsentDetailPage"
                                                                                            ].ToString()));
                    }
                    else if (Session["ChangedOrderMedicationIds"] != null)
                    {
                        //Codition modified by Loveena in ref to Task#2962
                        if (HiddenFieldDocumentVersionId.Value != "")
                        {
                            _DataSetRdlForMainReport =
                                objectClientMedications.GetDataForHarborStandardConsentRdlC(_StoredProcedureName,
                                                                                            Convert.ToInt32(
                                                                                                (((StreamlinePrinciple)
                                                                                                  Context.User).Client
                                                                                                 .ClientId)),
                                                                                            Session[
                                                                                                "ChangedOrderMedicationIds"
                                                                                            ].ToString(),
                                                                                            Convert.ToInt32(
                                                                                                HiddenFieldDocumentVersionId
                                                                                                .Value));
                        }
                        else
                        {
                            if (HiddenFieldImageConsentClick == null)
                            {
                                HiddenFieldImageConsentClick =
                                    (HiddenField)Page.FindControl("HiddenFieldImageConsentClick");
                                HiddenFieldImageConsentClick.Value =
                                    ((HiddenField)Page.FindControl("HiddenFieldImageConsentClick")).Value;
                            }
                            if (HiddenFieldImageConsentClick.Value == "Patient Consent")
                            {
                                _DataSetRdlForMainReport =
                                    objectClientMedications.GetDataForHarborStandardConsentRdlC(_StoredProcedureName,
                                                                                                Convert.ToInt32(
                                                                                                    (((
                                                                                                          StreamlinePrinciple
                                                                                                          )Context.User)
                                                                                                     .Client.ClientId)),
                                                                                                Session[
                                                                                                    "ChangedOrderMedicationIds"
                                                                                                ].ToString(), 0);
                            }
                        }
                    }

                    var DataSource = new ReportDataSource("RDLReportDataSet_" + _StoredProcedureName,
                                                          _DataSetRdlForMainReport.Tables[0]);
                    var dstemp = (DataSet)Session["DataSetRdlTemp"];
                    if (dstemp == null)
                    {
                        dstemp = _DataSetRdlForMainReport;
                    }
                    else
                    {
                        dstemp.Merge(_DataSetRdlForMainReport);
                    }
                    Session["DataSetRdlTemp"] = dstemp;
                    //HiddenFieldStoredProcedureName.Value = _StoredProcedureName;
                    //HiddenFieldReportName.Value = _ReportName;

                    #endregion

                    if (_DataSetGetRdlCName.Tables["DocumentCodesRDLSubReports"].Rows.Count > 0)
                    {
                        _drSubReport = _DataSetGetRdlCName.Tables["DocumentCodesRDLSubReports"].Select();

                        reportViewer1.LocalReport.SubreportProcessing -= SetSubDataSource;
                        reportViewer1.LocalReport.SubreportProcessing += SetSubDataSource;

                        for (int i = 0; i < _drSubReport.Length; i++) //Loop
                        {
                            if ((_drSubReport[i]["SubReportName"] != DBNull.Value ||
                                 !String.IsNullOrEmpty(_drSubReport[i]["SubReportName"].ToString())) &&
                                (_drSubReport[i]["StoredProcedure"] != DBNull.Value ||
                                 !String.IsNullOrEmpty(_drSubReport[i]["StoredProcedure"].ToString())))
                            {
                                #region Get the StoredProcedureName For SubReport and Execute

                                string _SubReportStoredProcedure = "";
                                string _SubReportName            = "";
                                _SubReportStoredProcedure = _drSubReport[i]["StoredProcedure"].ToString();
                                _SubReportName            = _drSubReport[i]["SubReportName"].ToString();
                                //Get Data For SubReport
                                //Added By Chandan Task#85 MM #1.7
                                if (Session["VersionIdForConsentDetailPage"] != null) //By Anuj for Yellow checkBox
                                {
                                    _DataSetRdlForSubReport =
                                        objectClientMedications.GetDataForHarborStandardConsentRdlC(
                                            _SubReportStoredProcedure,
                                            Convert.ToInt32((((StreamlinePrinciple)Context.User).Client.ClientId)),
                                            Convert.ToString(HiddenFieldClientmedicationIdForConsent.Value),
                                            Convert.ToInt32(Session["VersionIdForConsentDetailPage"].ToString()));
                                }
                                else if (HiddenFieldDocumentVersionId.Value != "")
                                {
                                    _DataSetRdlForSubReport =
                                        objectClientMedications.GetDataForHarborStandardConsentRdlC(
                                            _SubReportStoredProcedure,
                                            Convert.ToInt32((((StreamlinePrinciple)Context.User).Client.ClientId)),
                                            Session["ChangedOrderMedicationIds"].ToString(),
                                            Convert.ToInt32(HiddenFieldDocumentVersionId.Value));
                                }
                                else
                                {
                                    if (HiddenFieldImageConsentClick.Value == "Patient Consent")
                                    {
                                        //Code added by Loveena in ref to Task#2962
                                        if (_SubReportStoredProcedure != "csp_RDLHarborConsentElectronicSignature")
                                        {
                                            _DataSetRdlForSubReport =
                                                objectClientMedications.GetDataForHarborStandardConsentRdlC(
                                                    _SubReportStoredProcedure,
                                                    Convert.ToInt32(
                                                        (((StreamlinePrinciple)Context.User).Client.ClientId)),
                                                    Session["ChangedOrderMedicationIds"].ToString(), 0);
                                        }
                                    }
                                }
                                var rds = new ReportDataSource(_SubReportName, _DataSetRdlForSubReport.Tables[0]);
                                reportViewer1.LocalReport.DataSources.Add(rds);
                                string strRootPath = Server.MapPath(".");

                                var RdlSubReport = new StreamReader(_ReportPath + "\\" + _SubReportName.Trim() + ".rdlc");

                                reportViewer1.LocalReport.LoadReportDefinition(RdlSubReport);

                                #endregion
                            }
                        } //End For Loop
                    }
                    //Following parameters added with ref to Task 2371 SC-Support
                    _RptParam    = new ReportParameter[3];
                    _RptParam[0] = new ReportParameter("ClientId",
                                                       Convert.ToString(
                                                           ((StreamlinePrinciple)Context.User).Client.ClientId));
                    if (Session["VersionIdForConsentDetailPage"] != null)
                    {
                        _RptParam[1] = new ReportParameter("ClientMedicationId",
                                                           Convert.ToString(
                                                               HiddenFieldClientmedicationIdForConsent.Value));
                    }
                    else
                    {
                        _RptParam[1] = new ReportParameter("ClientMedicationId",
                                                           Session["ChangedOrderMedicationIds"].ToString());
                    }
                    _RptParam[2] = new ReportParameter("ClientName",
                                                       Convert.ToString(
                                                           ((StreamlinePrinciple)Context.User).Client.LastName + ", " +
                                                           ((StreamlinePrinciple)Context.User).Client.FirstName));
                    reportViewer1.LocalReport.SetParameters(_RptParam);

                    reportViewer1.LocalReport.Refresh();
                    reportViewer1.LocalReport.DataSources.Add(DataSource);
                    //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowPrintDiv('" + Session["ChangedOrderMedicationIds"].ToString() + "');", true);
                }
            }

            #endregion

            //Ref to Task#2660
            if (ConfigurationSettings.AppSettings["SaveJpegOutput"].ToLower() == "true")
            {
                if (Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name)))
                {
                    if (!Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS")))
                    {
                        Directory.CreateDirectory(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS"));
                    }

                    foreach (
                        string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                    {
                        FileName = file.Substring(file.LastIndexOf("\\") + 1);
                        if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0))
                        {
                            //Added by Chandan on 16th Feb2010 ref task#2797
                            if (
                                File.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" +
                                            FileName))
                            {
                                if (FileName.ToUpper().IndexOf(".RDLC") == -1)
                                {
                                    File.Delete(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\" + FileName));
                                }
                            }
                            else
                            {
                                while (seq < 1000)
                                {
                                    seq = seq + 1;
                                    if (
                                        !File.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") +
                                                     "\\" + FileName))
                                    {
                                        File.Move(file,
                                                  Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") +
                                                  "\\" + FileName);
                                        break;
                                    }
                                    else
                                    {
                                        FileName = ApplicationCommonFunctions.GetFileName(FileName, seq);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                #region DeleteOldRenderedImages

                try
                {
                    using (var objRDLC = new RDLCPrint())
                    {
                        objRDLC.DeleteRenderedImages(Server.MapPath("RDLC\\" + Context.User.Identity.Name));
                    }
                }
                catch (Exception ex)
                {
                    LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                }

                #endregion
            }

            string ScriptId = "";
            ////Added by Rohit. Ref ticket#84
            string         reportType = "PDF";
            IList <Stream> m_streams;
            m_streams = new List <Stream>();
            Warning[] warnings;
            string    deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat><StartPage>0</StartPage></DeviceInfo>";
            try
            {
                if (Session["imgId"] == null)
                {
                    var rand = new Random();
                    if (Session["ChangedOrderMedicationIds"] != null)
                    {
                        string[] ClientMedicationIds = Session["ChangedOrderMedicationIds"].ToString().Split(',');
                        //Modified by Malathi Shiva on 09/July/2015 - Modified the conversion to handle null values
                        //Int32 ClientMedicationId = Convert.ToInt32(ClientMedicationIds[0]);
                        Int32 ClientMedicationId;
                        int.TryParse(ClientMedicationIds[0].ToString(), out ClientMedicationId);

                        ClientMedicationId = ClientMedicationId + rand.Next();
                        Session["imgId"]   = ClientMedicationId;
                        //Session["imgId"] = Session["ChangedOrderMedicationIds"];
                    }
                    else
                    {
                        if (HiddenFieldClientmedicationIdForConsent.Value != "" &&
                            HiddenFieldClientmedicationIdForConsent.Value != null)
                        {
                            Session["imgId"] = Convert.ToInt32(HiddenFieldClientmedicationIdForConsent.Value) +
                                               rand.Next();
                        }
                        //                        Session["imgId"] = Convert.ToString(HiddenFieldClientmedicationIdForConsent.Value);
                    }
                }
                else
                {
                    Session["imgId"] = Convert.ToInt32(Session["imgId"]) + 1;
                }
                ScriptId = Session["imgId"] + "_" + DateTime.Now.ToString("yyyyMMHHMMss") + "." + seq.ToString();
            }
            catch (Exception ex)
            {
            }

            using (var objRDLC = new RDLCPrint())
            {
                //In case of Ordering method as X Chart copy will be printed
                //objRDLC.Run(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), Session["imgId"].ToString(), false, false);
                objRDLC.RunConsent(reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name),
                                   ScriptId, false, false);

                //Added by Rohit. Ref ticket#84
                renderedBytes = reportViewer1.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding,
                                                                 out fileNameExtension, out streams, out warnings);
            }
            if (Session["VersionIdForConsentDetailPage"] != null)
            {
                if (HiddenFieldCheckImageClick.Value == "G")
                {
                    ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID,
                                                        "ShowPrintDiv('" + ScriptId + "','G');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID,
                                                        "ShowPrintDiv('" + ScriptId + "','Y');", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID,
                                                    "ShowPrintDiv('" + ScriptId + "');", true);
            }
            //Session["ImgIdForMDSigned"] = Session["imgId"];
            Session["ImgIdForMDSigned"] = ScriptId;
        }
        catch (Exception ex)
        {
            LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            //    //Added by Vikas Vyas In ref to task 2334 On Dated March 04th 2008

            _DataSetGetRdlCName      = null;
            _DataSetRdlForMainReport = null;
            _DataSetRdlForSubReport  = null;
            _RptParam = null;
            if (Session["VersionIdForConsentDetailPage"] != null)
            {
                Session["VersionIdForConsentDetailPage"] = null;
            }
            if (Session["imgId"] != null)
            {
                Session["imgId"] = null;
            }

            ////End
        }
    }
コード例 #6
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        FileStream fs;
        TextWriter ts;
        string     _strClientMedicationIds = "";
        ArrayList  MedicationArrays;

        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetExpires(DateTime.Now - new TimeSpan(0, 0, 0));
        Response.Cache.SetLastModified(DateTime.Now);
        Response.Cache.SetAllowResponseInBrowserHistory(false);
        Response.Expires = 0;
        Response.Cache.SetNoStore();
        Response.AppendHeader("Pragma", "no-cache");
        divReportViewer1.Visible   = true;
        divNonReportViewer.Visible = false;

        try
        {
            #region "error message color added by rohit ref. #121"
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
            #endregion

            string strPath  = "";
            string FileName = "";


            fs = new FileStream(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\Report.html"), FileMode.Create);
            ts = new StreamWriter(fs);
            _strClientMedicationIds    = Request.QueryString["varClientMedicationIds"].ToString();
            divReportViewer1.InnerHtml = "";

            string strPageHtml = "";
            MedicationArrays = new ArrayList();
            MedicationArrays = ApplicationCommonFunctions.StringSplit(_strClientMedicationIds, "^");


            for (int i = 0; i < MedicationArrays.Count; i++)
            {
                foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                {
                    FileName = file.Substring(file.LastIndexOf("\\") + 1);
                    if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0) && (FileName.IndexOf(MedicationArrays[i].ToString()) >= 0))
                    {
                        strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName + "' style='width:108%' />";
                    }
                    strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName;
                }
            }

            if (Request.QueryString["ReportViewer"].ToString() == "true")
            {
                divReportViewer1.InnerHtml = "";
                strPageHtml = strPageHtml.Replace(@"\", "/");
                divReportViewer1.InnerHtml = strPageHtml;
                ts.Close();
            }
            else if (Request.QueryString["ReportViewer"].ToString() == "false")
            {
                ts.Close();
                //Response.Write(strPageHtml);
                strPageHtml = strPageHtml.Replace(@"\", "/");
                divNonReportViewer.InnerHtml = strPageHtml;
                divReportViewer1.Visible     = false;
                divNonReportViewer.Visible   = true;
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "printScript1();", true);
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "###Source Event Name -Page_Load()";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            fs = null;
            ts = null;
        }
    }
コード例 #7
0
    private void BindControls()
    {
        try
        {
            // Name
            CommonFunctions.Event_Trap(this);
            ClearControls();


            HyperLinkPatientName.InnerText = ApplicationCommonFunctions.cutText((_DataSetClientSummary.Tables["ClientInformation"].Rows[0]["LastName"].ToString() + ", " + _DataSetClientSummary.Tables["ClientInformation"].Rows[0]["FirstName"].ToString()), 15);

            // DOB/Age
            string DOB = _DataSetClientSummary.Tables["ClientInformation"].Rows[0]["DOB"].ToString();
            if (DOB == string.Empty)
            {
                HyperLinkPatientDOB.InnerText = "";
            }
            else
            {
                HyperLinkPatientDOB.InnerText = DateTime.Parse(DOB).ToShortDateString() + " (" + GetAge(DOB) + ")";
            }

            // Sex

            HyperLinkSex.InnerText = _DataSetClientSummary.Tables["ClientInformation"].Rows[0]["SEX"].ToString();

            // Race
            this.HyperLinkRace.InnerText = ApplicationCommonFunctions.cutText(_DataSetClientSummary.Tables["ClientInformation"].Rows[0]["ClientRace"].ToString(), 20);;

            // Diagnosis
            if (_DataSetClientSummary.Tables["DiagnosesIandII"].Rows.Count > 0)
            {
                this.HyperlinkDiagnosis.InnerHtml = Streamline.UserBusinessServices.ApplicationCommonFunctions.WrappableText(GetDiagnosisValue());
                //this.HyperlinkDiagnosis.InnerHtml = GetDiagnosisValue();
                //this.linkLabelDiagnosis.Tag = _DataSetClientSummary.Tables[1].Rows[0]["DocumentId"].ToString() + "," + _DataSetClientSummary.Tables[1].Rows[0]["Version"].ToString();
            }
            else
            {
                this.HyperlinkDiagnosis.InnerText = "";
                //this.linkLabelDiagnosis.Tag = "";
            }

            //Axis III Code display added as per 2373 SC-Support
            if (_DataSetClientSummary.Tables["DiagnosisIIICodes"].Rows.Count > 0)
            {
                this.HyperLinkAxisIII.InnerHtml = Streamline.UserBusinessServices.ApplicationCommonFunctions.WrappableText(GetDiagnosisAxisIIIValues());
            }
            else
            {
                this.HyperLinkAxisIII.InnerText = "";
            }


            // Last Seen Date
            if (_DataSetClientSummary.Tables["LastMedicationVisit"].Rows.Count > 0)
            {
                DateTime prevDate      = DateTime.Parse(_DataSetClientSummary.Tables["LastMedicationVisit"].Rows[0]["DateOfService"].ToString());
                string   procedureName = _DataSetClientSummary.Tables["LastMedicationVisit"].Rows[0]["ProcedureName"].ToString();
                string   staffName     = _DataSetClientSummary.Tables["LastMedicationVisit"].Rows[0]["StaffName"].ToString();
                this.HyperLinkLastMedicationVisit.InnerText = prevDate.ToShortDateString() + " " + prevDate.ToShortTimeString() + " " + procedureName + " " + staffName;
            }
            else
            {
                this.HyperLinkLastMedicationVisit.InnerText = "";
            }


            // Next Date
            if (_DataSetClientSummary.Tables["NextMedicationVisit"].Rows.Count > 0)
            {
                DateTime nextDate = DateTime.Parse(_DataSetClientSummary.Tables["NextMedicationVisit"].Rows[0]["DateOfService"].ToString());
                this.HyperLinkNextMedicationVisit.InnerText = nextDate.ToShortDateString() + " " + nextDate.ToShortTimeString();
            }
            else
            {
                HyperLinkNextMedicationVisit.InnerText = "";
            }
            //DisplayAllergiesData(_DataSetClientSummary.Tables[7]);
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
コード例 #8
0
    public void GetRDLCContents()
    {
        #region Get RDLC Contents

        string   _ReportPath = "";
        string   mimeType;
        string   encoding;
        string   fileNameExtension;
        string[] streams;


        DataSet    _DataSetGetRdlCName      = null;
        DataSet    _DataSetRdlForMainReport = null;
        DataSet    _DataSetRdlForSubReport  = null;
        DataRow[]  dr              = null;
        DataRow[]  _drSubReport    = null;
        string     _OrderingMethod = "";
        string     strErrorMessage = "";
        LogManager objLogManager   = null;

        ReportParameter[] _RptParam = null;
        //Ref to Task#2660
        string FileName = "";
        int    seq      = 1;
        reportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer();

        try
        {
            _ReportPath = Server.MapPath(".") + System.Configuration.ConfigurationManager.AppSettings["MedicationPerscriptionReportUrl"];
            if (_ReportPath == "")//Check For Report Path
            {
                strErrorMessage = "ReportPath is Missing In WebConfig";
                ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                return;
            }
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);

            strErrorMessage = "ReportPath Key is Missing In WebConfig";
            ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
            return;
        }
        finally
        {
            objLogManager = null;
        }

        try
        {
            //Ref to Task#2660
            if (System.Configuration.ConfigurationSettings.AppSettings["SaveJpegOutput"].ToLower() == "true")
            {
                if (System.IO.Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name)))
                {
                    if (!System.IO.Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS")))
                    {
                        System.IO.Directory.CreateDirectory(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS"));
                    }

                    foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                    {
                        FileName = file.Substring(file.LastIndexOf("\\") + 1);
                        if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0))
                        {
                            //Added by Chandan on 16th Feb2010 ref task#2797
                            if (System.IO.File.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName))
                            {
                                if (FileName.ToUpper().IndexOf(".RDLC") == -1)
                                {
                                    System.IO.File.Delete(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\" + FileName));
                                }
                            }
                            else
                            {
                                while (seq < 1000)
                                {
                                    seq = seq + 1;
                                    if (!System.IO.File.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName))
                                    {
                                        System.IO.File.Move(file, Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName);
                                        break;
                                    }
                                    else
                                    {
                                        FileName = ApplicationCommonFunctions.GetFileName(FileName, seq);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                #region DeleteOldRenderedImages
                try
                {
                    using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                    {
                        objRDLC.DeleteRenderedImages(Server.MapPath("RDLC\\" + Context.User.Identity.Name));
                    }
                }
                catch (Exception ex)
                {
                    Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                }

                #endregion
            }
            //  _DataSetRdl = new DataSet();//Commented by Vikas Vyas On Dated March 04 2008
            Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
            objectClientMedications = new ClientMedication();
            //Added by Chandan for getting Location Id

            #region Added by Vikas Vyas


            _DataSetGetRdlCName = objectClientMedications.GetRdlCNameDataBase(1028);

            _DataSetGetRdlCName.Tables[0].TableName = "DocumentCodes";
            _DataSetGetRdlCName.Tables[1].TableName = "DocumentCodesRDLSubReports";


            if (_DataSetGetRdlCName.Tables["DocumentCodes"].Rows.Count > 0)
            {
                dr = _DataSetGetRdlCName.Tables["DocumentCodes"].Select();//because DocumentCodes table only contain one row



                //Check For Main Report
                if ((dr[0]["DocumentName"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["DocumentName"].ToString())) && (dr[0]["ViewStoredProcedure"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["ViewStoredProcedure"].ToString())))
                {
                    #region Get the StoredProceudreName and Execute
                    string _StoredProcedureName = "";
                    string _ReportName          = "";
                    _StoredProcedureName = dr[0]["ViewStoredProcedure"].ToString();//Get the StoredProcedure Name
                    _ReportName          = dr[0]["DocumentName"].ToString();

                    this.reportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                    this.reportViewer1.LocalReport.ReportPath = _ReportPath + "\\" + _ReportName + ".rdlc";
                    this.reportViewer1.LocalReport.DataSources.Clear();


                    //Get Data For Main Report
                    //One More Parameter Added by Chandan Task#85 MM1.7
                    _DataSetRdlForMainReport = objectClientMedications.GetDataForPrescriberRdlC(_StoredProcedureName, ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId, LabelReviewDateTime.Text, HiddenFieldRDLCurrentDateTime.Value);
                    //Microsoft.Reporting.WebForms.ReportDataSource DataSource = new ReportDataSource("RdlReportDataSet_" + _StoredProcedureName, _DataSetRdlForMainReport.Tables[0]);


                    Microsoft.Reporting.WebForms.ReportDataSource DataSource = new Microsoft.Reporting.WebForms.ReportDataSource("RDLReportDataSet_" + _StoredProcedureName, _DataSetRdlForMainReport.Tables[0]);
                    //Added by Chandan 0n 18th Dec 2008
                    //Session["DataSetRdlTemp"] = null;
                    DataSet dstemp = (DataSet)Session["DataSetRdlTemp"];
                    if (dstemp == null)
                    {
                        dstemp = _DataSetRdlForMainReport;
                    }
                    else
                    {
                        dstemp.Merge(_DataSetRdlForMainReport);
                    }
                    Session["DataSetRdlTemp"] = dstemp;
                    //HiddenFieldStoredProcedureName.Value = _StoredProcedureName;
                    //HiddenFieldReportName.Value = _ReportName;

                    #endregion

                    //Code addded by Loveena in ref to Task#2597
                    //Following parameters added with ref to Task 2371 SC-Support
                    _RptParam    = new ReportParameter[3];
                    _RptParam[0] = new ReportParameter("PrescriberId", ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId.ToString());
                    _RptParam[1] = new ReportParameter("LastReviewTime", LabelReviewDateTime.Text);
                    _RptParam[2] = new ReportParameter("ServerTime", HiddenFieldRDLCurrentDateTime.Value);
                    reportViewer1.LocalReport.SetParameters(_RptParam);

                    reportViewer1.LocalReport.Refresh();
                    reportViewer1.LocalReport.DataSources.Add(DataSource);
                }
            }



            #endregion



            //Added by Rohit. Ref ticket#84
            string         reportType = "PDF";
            IList <Stream> m_streams;
            m_streams = new List <Stream>();
            Microsoft.Reporting.WebForms.Warning[] warnings;
            string deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat><StartPage>0</StartPage></DeviceInfo>";

            if (Session["imgId"] == null)
            {
                Session["imgId"] = 0;
            }
            else
            {
                Session["imgId"] = Convert.ToInt32(Session["imgId"]) + 1;
            }

            string ScriptId = Session["imgId"] + "_" + DateTime.Now.ToString("yyyyMMHHMMss") + "." + seq.ToString();

            try
            {
                using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                {
                    //In case of Ordering method as X Chart copy will be printed

                    objRDLC.RunPreview(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), ScriptId, false, false);

                    //Added by Rohit. Ref ticket#84
                    renderedBytes = reportViewer1.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

                    ShowReport(ScriptId);
                }
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                objLogManager = null;
            }
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            //    //Added by Vikas Vyas In ref to task 2334 On Dated March 04th 2008

            _DataSetGetRdlCName      = null;
            _DataSetRdlForMainReport = null;
            _DataSetRdlForSubReport  = null;
            _RptParam = null;
            ////End
        }

        #endregion
    }
コード例 #9
0
    /// <summary>
    /// <Description>Used to get Rdlc contents as per task#1(Venture)</Description>
    ///<Author>Pradeep</Author>
    /// <CreatedOn>2Dec,2009</CreatedOn>
    /// </summary>
    public void GetRDLCContents()
    {
        string _ReportPath = "";
        string mimeType;
        string encoding;
        string fileNameExtension;

        string[] streams;

        DataSet _DataSetGetRdlCName      = null;
        DataSet _DataSetRdlForMainReport = null;
        DataSet _DataSetRdlForSubReport  = null;

        DataRow[]  dr              = null;
        DataRow[]  _drSubReport    = null;
        string     _OrderingMethod = "";
        string     strErrorMessage = "";
        LogManager objLogManager   = null;
        //Ref to Task#2660
        string FileName = "";
        int    seq      = 1;

        ReportParameter[] _RptParam = null;

        reportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer();
        try
        {
            _ReportPath = Server.MapPath(".") + System.Configuration.ConfigurationManager.AppSettings["MedicationPerscriptionReportUrl"];
            if (_ReportPath == "")//Check For Report Path
            {
                strErrorMessage = "ReportPath is Missing In WebConfig";
                //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                return;
            }
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);

            strErrorMessage = "ReportPath Key is Missing In WebConfig";
            //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
            return;
        }
        finally
        {
            objLogManager = null;
        }
        try
        {
            //Ref to Task#2660
            if (System.Configuration.ConfigurationSettings.AppSettings["SaveJpegOutput"].ToLower() == "true")
            {
                if (System.IO.Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name)))
                {
                    if (!System.IO.Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS")))
                    {
                        System.IO.Directory.CreateDirectory(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS"));
                    }

                    foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                    {
                        FileName = file.Substring(file.LastIndexOf("\\") + 1);
                        if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0))
                        {
                            //Added by Chandan on 16th Feb2010 ref task#2797
                            if (System.IO.File.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName))
                            {
                                if (FileName.ToUpper().IndexOf(".RDLC") == -1)
                                {
                                    System.IO.File.Delete(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\" + FileName));
                                }
                            }
                            else
                            {
                                while (seq < 1000)
                                {
                                    seq = seq + 1;
                                    if (!System.IO.File.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName))
                                    {
                                        System.IO.File.Move(file, Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\JPEGS") + "\\" + FileName);
                                        break;
                                    }
                                    else
                                    {
                                        //string FirstName = FileName.Substring(0, FileName.IndexOf("."));
                                        //string LastName = FileName.Substring(FileName.IndexOf(".") + 1);
                                        //string MiddleName = LastName.Substring(0, LastName.IndexOf("."));
                                        //MiddleName = MiddleName.Replace(MiddleName, seq.ToString());

                                        //FileName = FileName.Replace(FileName.Substring(FileName.IndexOf(".") + 1).Substring(0, FileName.Substring(FileName.IndexOf(".") + 1).IndexOf(".")), seq.ToString());
                                        FileName = ApplicationCommonFunctions.GetFileName(FileName, seq);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                //Code added to delete the rendered images
                try
                {
                    using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                    {
                        objRDLC.DeleteRenderedImages(Server.MapPath("RDLC\\" + Context.User.Identity.Name));
                    }
                }
                catch (Exception ex)
                {
                    Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                }
            }
            Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
            objectClientMedications = new ClientMedication();
            _DataSetGetRdlCName     = objectClientMedications.GetRdlCNameDataBase(1035);

            _DataSetGetRdlCName.Tables[0].TableName = "DocumentCodes";
            _DataSetGetRdlCName.Tables[1].TableName = "DocumentCodesRDLSubReports";
            if (Request.QueryString["MedicationId"] != null || Request.QueryString["MedicationId"] != string.Empty)
            {
                clientMedicationId = Convert.ToInt32(Request.QueryString["MedicationId"].ToString());
            }
            if (Request.QueryString["OrderName"] != null || Request.QueryString["OrderName"] != string.Empty)
            {
                method = Convert.ToString(Request.QueryString["OrderName"].ToString());
            }
            if (Request.QueryString["StaffId"] != null || Request.QueryString["StaffId"] != string.Empty)
            {
                staffId = Convert.ToInt32(Request.QueryString["StaffId"].ToString());
            }
            //if (Request.QueryString["PharmacyId"] != null || Request.QueryString["PharmacyId"] != string.Empty)
            //{
            //    pharmacyId = Convert.ToInt32(Request.QueryString["PharmacyId"].ToString());
            //}
            DataSet dataSetClientSummary = null;
            if (Session["DataSetClientSummary"] != null)
            {
                dataSetClientSummary = (DataSet)Session["DataSetClientSummary"];
                DataRow[] dataRowPharmacy = dataSetClientSummary.Tables["ClientPharmacies"].Select("SequenceNumber=1");
                if (dataRowPharmacy.Length > 0)
                {
                    string _PharmacyId = dataRowPharmacy[0]["PharmacyId"] == DBNull.Value ? string.Empty : dataRowPharmacy[0]["PharmacyId"].ToString();
                    if (_PharmacyId.Trim() != string.Empty && pharmacyId == 0)
                    {
                        pharmacyId = Convert.ToInt32(_PharmacyId);
                    }
                }
            }
            if (_DataSetGetRdlCName.Tables["DocumentCodes"].Rows.Count > 0)
            {
                dr = _DataSetGetRdlCName.Tables["DocumentCodes"].Select();//because DocumentCodes table only contain one row
                //Check For Main Report
                if ((dr[0]["DocumentName"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["DocumentName"].ToString())) && (dr[0]["ViewStoredProcedure"] != DBNull.Value || !String.IsNullOrEmpty(dr[0]["ViewStoredProcedure"].ToString())))
                {
                    #region --Get the StoredProceudreName and Execute
                    string _StoredProcedureName = "";
                    string _ReportName          = "";
                    _StoredProcedureName = dr[0]["ViewStoredProcedure"].ToString();//Get the StoredProcedure Name
                    _ReportName          = dr[0]["DocumentName"].ToString();
                    this.reportViewer1.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                    this.reportViewer1.LocalReport.ReportPath = _ReportPath + "\\" + _ReportName + ".rdlc";
                    this.reportViewer1.LocalReport.DataSources.Clear();

                    _DataSetRdlForMainReport = objectClientMedications.GetDataForDisContinueRdlC(_StoredProcedureName, clientMedicationId, method, staffId, pharmacyId);

                    Microsoft.Reporting.WebForms.ReportDataSource DataSource = new Microsoft.Reporting.WebForms.ReportDataSource("RDLDiscontinueDataSet_" + _StoredProcedureName, _DataSetRdlForMainReport.Tables[0]);
                    DataSet dataSetTemp = new DataSet();
                    dataSetTemp.Merge(_DataSetRdlForMainReport);
                    #endregion --Get the StoredProceudreName and Execute
                    _RptParam    = new ReportParameter[4];
                    _RptParam[0] = new ReportParameter("ClientMedicationId", Convert.ToString(clientMedicationId));
                    _RptParam[1] = new ReportParameter("Method", method);
                    _RptParam[2] = new ReportParameter("InitiatedBy", Convert.ToString(staffId));
                    _RptParam[3] = new ReportParameter("PharmacyId", "0");
                    reportViewer1.LocalReport.SetParameters(_RptParam);

                    reportViewer1.LocalReport.Refresh();
                    reportViewer1.LocalReport.DataSources.Add(DataSource);
                }
            }
            string         reportType = "PDF";
            IList <Stream> m_streams;
            m_streams = new List <Stream>();
            Microsoft.Reporting.WebForms.Warning[] warnings;
            string deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat><StartPage>0</StartPage></DeviceInfo>";

            if (Session["imgId"] == null)
            {
                Session["imgId"] = 0;
            }
            else
            {
                Session["imgId"] = Convert.ToInt32(Session["imgId"]) + 1;
            }

            string ScriptId = Session["imgId"] + "_" + DateTime.Now.ToString("yyyyMMHHMMss") + "." + seq.ToString();

            try
            {
                using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                {
                    //In case of Ordering method as X Chart copy will be printed

                    //objRDLC.RunPreview(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), Session["imgId"].ToString(), false, false);
                    objRDLC.Run(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), ScriptId, false, false);

                    //Added by Rohit. Ref ticket#84
                    renderedBytes = reportViewer1.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

                    ShowReport(ScriptId);
                }
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                objLogManager = null;
            }
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
    }
コード例 #10
0
    public void ShowReport(string _strScriptIds)
    {
        FileStream fs;
        TextWriter ts;
        ArrayList  ScriptArrays;
        ArrayList  ChartScriptArrays;
        bool       _strFaxSendStatus   = false;
        string     _strFaxFaildMessage = "";

        try
        {
            string strPath  = "";
            string FileName = "";
            fs = new FileStream(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\Report.html"), FileMode.Create);
            ts = new StreamWriter(fs);
            divReportViewer.InnerHtml = "";

            string strPageHtml = "";
            ScriptArrays = new ArrayList();
            ScriptArrays = ApplicationCommonFunctions.StringSplit(_strScriptIds, "^");
            if (method.Trim().ToUpper() == "P")
            {
                //using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                //{

                //    objRDLC.Run(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), this.HiddenFieldAllFaxed.ToString(), false, false);
                //}
                ScriptManager.RegisterStartupScript(LabelClientScript, LabelClientScript.GetType(), ClientID.ToString(), "printRDLC();", true);
                _strFaxFailed = true;
            }
            else if (method.Trim().ToUpper() == "F")
            {
                if (pharmacyId != 0)
                {
                    //Send to Fax
                    SendToFax(pharmacyId);
                    if (_strFaxFailed == true)
                    {
                        _strFaxFaildMessage = "Script could not be faxed at this time.  The fax server is not available.  Please print the script or re-fax the script later.";
                        strPageHtml        += "<span style='float:left;position:absolute;padding-left:30%;color:Red;text-align:center;font-size: 12px;font-family:Microsoft Sans Serif;'><b>" + _strFaxFaildMessage + "</b></span><br/>";
                        //---Send for printing
                        //using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                        //{

                        //    objRDLC.Run(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), this.HiddenFieldAllFaxed.ToString(), false, false);
                        //}
                        ScriptManager.RegisterStartupScript(LabelClientScript, LabelClientScript.GetType(), ClientID.ToString(), "printRDLC();", true);
                    }
                }
                else
                {
                    //Send to Printer
                    ScriptManager.RegisterStartupScript(LabelClientScript, LabelClientScript.GetType(), ClientID.ToString(), "printRDLC();", true);
                }
            }

            for (int i = 0; i < ScriptArrays.Count; i++)
            {
                foreach (string file in Directory.GetFiles(Server.MapPath("RDLC\\" + Context.User.Identity.Name + "\\")))
                {
                    FileName = file.Substring(file.LastIndexOf("\\") + 1);
                    if ((FileName.IndexOf("JPEG") >= 0 || FileName.IndexOf("jpeg") >= 0) && (FileName.IndexOf(ScriptArrays[i].ToString(), 3) >= 0))
                    {
                        strPageHtml += "<img src='.\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName + "' style='width:100%' />";
                    }
                    strPath = "'..\\RDLC\\" + Context.User.Identity.Name + "\\" + FileName;
                }
            }


            divReportViewer.InnerHtml = "";
            divReportViewer.InnerHtml = strPageHtml;

            ts.Close();
            //Response.Write(strPageHtml);
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }