예제 #1
0
    public void GenerateAllergyReconciliationRows(int GlobalCodeId, int DocumentVersionId)
    {
        try
        {
            String RowIdentifier = null;
            int    AllergyType   = 8794;
            int    ClientId      = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
            int    StaffId       = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId;
            Streamline.UserBusinessServices.ClientMedication objClientMedications = new ClientMedication();

            Streamline.UserBusinessServices.DataSets.DataSetClientMedications dsClientMedications = new Streamline.UserBusinessServices.DataSets.DataSetClientMedications();
            if (Session["DataSetClientMedications"] != null)
            {
                dsClientMedications = (Streamline.UserBusinessServices.DataSets.DataSetClientMedications)Session["DataSetClientMedications"];
            }
            if (dsClientMedications.Tables["ClientMedications"].Rows.Count > 0)
            {
                RowIdentifier = dsClientMedications.Tables["ClientMedications"].Rows[0]["RowIdentifier"].ToString();
            }
            objClientMedications.GetMedReconciliationData(GlobalCodeId, DocumentVersionId, ClientId, StaffId, AllergyType, RowIdentifier);
        }
        catch (Exception ex)
        {
        }
    }
    public void GetTitrationTemplateData(int MadicationNameId)
    {
        Streamline.UserBusinessServices.ClientMedication objClientMedication = null;
        DataSet _dataSetTitrationTemplate = new DataSet();

        Streamline.UserBusinessServices.DataSets.DataSetTitrationTemplate _dsTitrationTemplate = null;
        try
        {
            objClientMedication       = new ClientMedication();
            _dataSetTitrationTemplate = objClientMedication.GetTitrationTemplateData(MadicationNameId);
            _dsTitrationTemplate      = new Streamline.UserBusinessServices.DataSets.DataSetTitrationTemplate();
            if (_dataSetTitrationTemplate != null)
            {
                _dsTitrationTemplate.Merge(_dataSetTitrationTemplate);
            }

            if (_dsTitrationTemplate != null)
            {
                Session["DataSetTitrationTemplate"] = _dsTitrationTemplate;
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
 public void InsertFaxActivity(int ClientMedicationId, int pharmacyId)
 {
     try
     {
         DataSet DataSetDiscontinueMedications = null;
         Streamline.UserBusinessServices.ClientMedication ObjClientMedication = new Streamline.UserBusinessServices.ClientMedication();
         Streamline.UserBusinessServices.DataSets.DataSetDiscontinueMedication _dsDiscontinueMedication = null;
         Streamline.UserBusinessServices.DataSets.DataSetDiscontinueMedication.ClientMedicationFaxActivitiesRow _drFaxActivitiesRow = null;
         _dsDiscontinueMedication = new Streamline.UserBusinessServices.DataSets.DataSetDiscontinueMedication();
         _drFaxActivitiesRow      = (Streamline.UserBusinessServices.DataSets.DataSetDiscontinueMedication.ClientMedicationFaxActivitiesRow)_dsDiscontinueMedication.ClientMedicationFaxActivities.NewRow();
         _drFaxActivitiesRow.ClientMedicationId    = ClientMedicationId;
         _drFaxActivitiesRow.FaxEventType          = 5582;
         _drFaxActivitiesRow.FaxStatus             = "Queued";
         _drFaxActivitiesRow.PharmacyId            = pharmacyId;
         _drFaxActivitiesRow.FaxStatusDate         = DateTime.Now;
         _drFaxActivitiesRow.FaxExternalIdentifier = faxUniqueId;
         _drFaxActivitiesRow.RowIdentifier         = System.Guid.NewGuid();
         _drFaxActivitiesRow.CreatedBy             = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
         _drFaxActivitiesRow.CreatedDate           = DateTime.Now;
         _drFaxActivitiesRow.ModifiedBy            = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
         _drFaxActivitiesRow.ModifiedDate          = DateTime.Now;
         _dsDiscontinueMedication.ClientMedicationFaxActivities.Rows.Add(_drFaxActivitiesRow);
         ObjClientMedication = new ClientMedication();
         ObjClientMedication.SetRenderedImageData(_dsDiscontinueMedication, _drFaxActivitiesRow, ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode, renderedBytes);
         DataSetDiscontinueMedications = ObjClientMedication.UpdateDocuments(_dsDiscontinueMedication);
     }
     catch (Exception ex)
     {
         Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
     }
 }
예제 #4
0
    public void GetRecData(int DocumentVersionId, int ReconciliationTypeId)
    {
        int ClientId = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
        int StaffId  = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId;

        Streamline.UserBusinessServices.ClientMedication objClientMedications = new ClientMedication();
        DataSet _dsReconciliationDataList = objClientMedications.GetRecData(DocumentVersionId, ReconciliationTypeId, ClientId, StaffId);

        lvMedReconciliation.DataSource = _dsReconciliationDataList.Tables["RecDataList"];
        lvMedReconciliation.DataBind();
    }
예제 #5
0
    //Ended over here

    #region Update

    public bool DocumentUpdateDocument()
    {
        DataRow BlankRow = null;

        try
        {
            Streamline.UserBusinessServices.DataSets.DataSetClientMedications dsClientMedications = new Streamline.UserBusinessServices.DataSets.DataSetClientMedications();
            CommonFunctions.Event_Trap(this);
            if (Session["DataSetClientMedications"] != null)
            {
                dsClientMedications = (Streamline.UserBusinessServices.DataSets.DataSetClientMedications)Session["DataSetClientMedications"];
            }
            if (dsClientMedications.Tables["ClientMedications"].Rows.Count > 0)
            {
                ClientMedication objClientMedication = new ClientMedication();
                if (dsClientMedications != null)
                {
                    DataSet dsTemp = objClientMedication.UpdateDocuments(dsClientMedications);
                    Session["DataSetClientMedications"] = dsTemp;
                }
            }
            Session["LoadMgt"] = true;
            Session["ClientIdForValidateToken"] = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;

            Session["CurrentControl"]   = "~/UserControls/MedicationMgt.ascx";
            Session["InitializeClient"] = true;

            return(true);
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = "";
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            return(false);
        }
    }
    public void DeleteTitrationTemplate(int TitrationTemplateId, string filterCondition)
    {
        Streamline.UserBusinessServices.DataSets.DataSetTitrationTemplate.TitrationTemplatesRow _drTitrationTemplates = null;
        Streamline.UserBusinessServices.DataSets.DataSetTitrationTemplate _dsTitrationTemplate = null;

        DataTable dataTableTitrationTemplate = null;

        Streamline.UserBusinessServices.ClientMedication objClientMedication = null;
        try
        {
            if (Session["DataSetTitrationTemplate"] != null)
            {
                _dsTitrationTemplate = (Streamline.UserBusinessServices.DataSets.DataSetTitrationTemplate)Session["DataSetTitrationTemplate"];
            }
            else
            {
                _dsTitrationTemplate = new Streamline.UserBusinessServices.DataSets.DataSetTitrationTemplate();
            }
            dataTableTitrationTemplate = _dsTitrationTemplate.TitrationTemplates;
            DataRow[] dataRowTitrationTemplate = dataTableTitrationTemplate.Select("TitrationTemplateId=" + TitrationTemplateId);
            if (dataRowTitrationTemplate.Length > 0)
            {
                dataRowTitrationTemplate[0]["RecordDeleted"] = "Y";
                dataRowTitrationTemplate[0]["DeletedDate"]   = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                //dataRowTitrationTemplate[0]["DeletedBy"] = Context.User.Identity.Name;
                dataRowTitrationTemplate[0]["DeletedBy"]    = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                dataRowTitrationTemplate[0]["ModifiedBy"]   = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                dataRowTitrationTemplate[0]["ModifiedDate"] = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            }

            objClientMedication = new ClientMedication();
            DataSet temp = new DataSet();
            temp = objClientMedication.UpdateDocuments(_dsTitrationTemplate);
            _dsTitrationTemplate.Clear();
            _dsTitrationTemplate.Merge(temp.Tables["TitrationTemplates"]);
            _dsTitrationTemplate.Merge(temp.Tables["TitrationTemplateInstructions"]);
            Session["DataSetTitrationTemplate"] = _dsTitrationTemplate;
            GenerateTitrationTemplateRows(filterCondition);
            //return 1;
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
예제 #7
0
        public void DenySureScriptsRefillRequests(Int32 SureScriptREfillRequestId, string DenialReasonCode, string DenialReasonText, string UserCode, int PrescriberId)
        {
            string denialMessageId = "RF_Deny_" + DateTime.UtcNow.Ticks.ToString();

            Streamline.UserBusinessServices.SureScriptRefillRequest objSureScriptsRefillrequest = null;
            Streamline.UserBusinessServices.ClientMedication        ObjectClientMedication      = null;
            try
            {
                objSureScriptsRefillrequest = new Streamline.UserBusinessServices.SureScriptRefillRequest();
                string GetDenialReasonText = DenialReasonText.Replace("\n", "");
                GetDenialReasonText = GetDenialReasonText.Replace("\r", "");
                int DenialReasonID = 0;
                if (DenialReasonCode != "")
                {
                    DenialReasonID = Convert.ToInt32(DenialReasonCode);
                }
                objSureScriptsRefillrequest.DenySureScriptsRefillRequests(SureScriptREfillRequestId, DenialReasonID, GetDenialReasonText, UserCode, denialMessageId);
                using (DataSet dataSetSureScriptsRefillRequest = (DataSet)(Session["DataSetSureScriptRequestRefill"]))
                {
                    DataRow[] drSureScriptsRefillRequests = dataSetSureScriptsRefillRequest.Tables["SureScriptsRefillRequests"].Select("SureScriptsRefillRequestId=" + SureScriptREfillRequestId);
                    if (drSureScriptsRefillRequests.Length > 0)
                    {
                        drSureScriptsRefillRequests[0]["StatusOfRequest"] = "D";
                    }
                    ObjectClientMedication = new ClientMedication();
                    ObjectClientMedication.UpdateDocuments(dataSetSureScriptsRefillRequest);

                    //using(Streamline.UserBusinessServices.SureScriptRefillRequest objSureScriptRefillRequest = new Streamline.UserBusinessServices.SureScriptRefillRequest() )
                    //{
                    using (DataSet dsSureScripts = new DataSet())
                    {
                        objSureScriptsRefillrequest = new Streamline.UserBusinessServices.SureScriptRefillRequest();
                        dsSureScripts.Merge(objSureScriptsRefillrequest.GetSureScriptRefill(((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId, PrescriberId));
                        Session["DataSetSureScriptRequestRefill"] = dsSureScripts;
                    }
                    //}
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
예제 #8
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            Streamline.UserBusinessServices.ClientMedication objClientMedications = new ClientMedication();
            DataSet _dsReconciliationDataList = objClientMedications.GetElectronicPrescriptionData(Session["ElectronicScriptIds"].ToString(), 0);

            SubstancesListView.DataSource = _dsReconciliationDataList.Tables["MedicationData"];
            SubstancesListView.DataBind();

            Disclaimer.Text    = "";
            Disclaimer.Visible = false;
            DataTable dt        = _dsReconciliationDataList.Tables["MedicationData"];
            bool      EPCSCheck = ((StreamlinePrinciple)Context.User).HasPermission(Permissions.EPCS);

            if (EPCSCheck == false)
            {
                HiddenEPCSPermisions.Value = "false";
            }

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr[21].ToString() != "0")
                    {
                        Disclaimer.Text    = "By completing the two-factor authentication protocol at this time, you are legally sigining the prescriptions(s) \n and authorizing the transmission of the above information to the pharmacy for dispensing. The two-factor authentication protocol may only be completed by the practitioner whose name and DEA registration number appear above.".Replace("\n", Environment.NewLine);
                        Disclaimer.Visible = true;
                        break;
                    }
                }
            }

            if (_dsReconciliationDataList.Tables["OtherData"] != null)
            {
                ClientInformation     = _dsReconciliationDataList.Tables["OtherData"].Rows[0]["PATIENTDETAILS"].ToString();
                PrescriberInformation = _dsReconciliationDataList.Tables["OtherData"].Rows[0]["PRESCRIBERDETAILS"].ToString();
                PharmacyInformation   = _dsReconciliationDataList.Tables["OtherData"].Rows[0]["PHARMACYDETIALS"].ToString();
                //  _dsReconciliationDataList.Tables["MedicationData"].Rows[0]["WRITTENDATE"];
            }
            if (_dsReconciliationDataList.Tables["MedicationData"].Rows.Count > 0 && _dsReconciliationDataList.Tables["MedicationData"].Rows[0]["ControlledMedicationScriptIds"] != null)
            {
                Session["ControlledMedicationScriptIds"] = _dsReconciliationDataList.Tables["MedicationData"].Rows[0]["ControlledMedicationScriptIds"].ToString();
            }
        }
예제 #9
0
    public void GenerateReconciliationRows(int DocumentVersionId, int ReconciliationTypeId)
    {
        try
        {
            Streamline.UserBusinessServices.ClientMedication objClientMedications = new ClientMedication();
            DataSet _dsReconciliationDataList = objClientMedications.GetReconciliationData(DocumentVersionId, ReconciliationTypeId);
            lvReconciliation.DataSource = _dsReconciliationDataList.Tables["ReconciliationDataList"];
            lvReconciliation.DataBind();

            if (_dsReconciliationDataList.Tables["ReconciliationDataList"].Rows.Count > 0)
            {
                DataTable dt = _dsReconciliationDataList.Tables["ReconciliationDataList"].Copy();
                dt.Clear();
                dt.ImportRow(_dsReconciliationDataList.Tables["ReconciliationDataList"].Rows[0]);
                lvReconciliationHeader.DataSource = dt;
                status = _dsReconciliationDataList.Tables["ReconciliationDataList"].Rows[0]["Status"].ToString();
                lvReconciliationHeader.DataBind();
            }
        }
        catch (Exception ex)
        {
        }
    }
    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
    }
예제 #11
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
        }
    }
        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;
            reportViewer1 = new Microsoft.Reporting.WebForms.ReportViewer();
            string strIds = "";
            try
            {
                _ReportPath = Server.MapPath(".") + System.Configuration.ConfigurationManager.AppSettings["MedicationPerscriptionReportUrl"];
                if (_ReportPath == "")
                {
                    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
            {
                Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
                objectClientMedications = new ClientMedication();
                _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();
                    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();
                        _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();
                        //Testing By Vikas Vyas
                        reportViewer1.LocalReport.Refresh();
                        //End

                        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                        _DataSetRdlForMainReport = objectClientMedications.GetDataForHarborStandardConsentRdlC(_StoredProcedureName, Convert.ToInt32((((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId)), str, Convert.ToInt32(HiddenFieldLatestDocumentVersionId.Value));
                        Microsoft.Reporting.WebForms.ReportDataSource DataSource = new Microsoft.Reporting.WebForms.ReportDataSource("RDLReportDataSet_" + _StoredProcedureName, _DataSetRdlForMainReport.Tables[0]);
                        DataSet dstemp = (DataSet)Session["DataSetRdlTemp"];
                        if (dstemp == null)
                        {
                            dstemp = _DataSetRdlForMainReport;
                        }
                        else
                        {
                            dstemp.Merge(_DataSetRdlForMainReport);
                        }
                        Session["DataSetRdlTemp"] = dstemp;

                        #endregion
                        if (_DataSetGetRdlCName.Tables["DocumentCodesRDLSubReports"].Rows.Count > 0)
                        {
                            _drSubReport = _DataSetGetRdlCName.Tables["DocumentCodesRDLSubReports"].Select();
                            reportViewer1.LocalReport.SubreportProcessing -= new Microsoft.Reporting.WebForms.SubreportProcessingEventHandler(SetSubDataSource);
                            reportViewer1.LocalReport.SubreportProcessing += new Microsoft.Reporting.WebForms.SubreportProcessingEventHandler(SetSubDataSource);
                            for (int i = 0; i < _drSubReport.Length; i++)
                            {
                                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();
                                    string str2 = Session["MedicationIdsForConsentDetailPage"].ToString();
                                    _DataSetRdlForSubReport = objectClientMedications.GetDataForHarborStandardConsentRdlC(_SubReportStoredProcedure, Convert.ToInt32((((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId)), str2, Convert.ToInt32(HiddenFieldLatestDocumentVersionId.Value));
                                    Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(_SubReportName, _DataSetRdlForSubReport.Tables[0]);
                                    reportViewer1.LocalReport.DataSources.Add(rds);
                                    string strRootPath = Server.MapPath(".");
                                    System.IO.StreamReader RdlSubReport = new System.IO.StreamReader(_ReportPath + "\\" + _SubReportName.Trim() + ".rdlc");
                                    reportViewer1.LocalReport.LoadReportDefinition(RdlSubReport);
                                    #endregion
                                }
                            }
                        }
                        _RptParam    = new ReportParameter[3];
                        _RptParam[0] = new ReportParameter("ClientId", Convert.ToString(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId));
                        string str1 = Session["MedicationIdsForConsentDetailPage"].ToString();
                        _RptParam[1] = new ReportParameter("ClientMedicationId", str1);
                        _RptParam[2] = new ReportParameter("ClientName", Convert.ToString(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.LastName + ", " + ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.FirstName));
                        reportViewer1.LocalReport.SetParameters(_RptParam);
                        reportViewer1.LocalReport.Refresh();
                        reportViewer1.LocalReport.DataSources.Add(DataSource);
                        strIds = str1;
                        //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowPrintDiv('" + Session["ChangedOrderMedicationIds"].ToString() + "');", true);
                    }
                }
                #endregion
                try
                {
                    if (Session["imgId1"] == null || Session["imgId1"] == "")
                    {
                        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                        Session["imgId1"] = str;
                    }
                    else
                    {
                        Session["imgId1"] = Convert.ToInt32(Session["imgId1"]) + 1;
                    }
                }
                catch (Exception ex)
                {
                }
                #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

                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>";
                //try
                //{
                //    if (Session["imgId1"] == null)
                //    {
                //        string str = Session["MedicationIdsForConsentDetailPage"].ToString();
                //        Session["imgId1"] = str;
                //    }
                //    else
                //    {
                //        Session["imgId1"] = Convert.ToInt32(Session["imgId1"]) + 1;
                //    }
                //}
                //catch (Exception ex)
                //{
                //}
                if (Session["imgId1"] == null)
                {
                    Session["imgId1"] = strIds;
                }
                using (Streamline.BaseLayer.RDLCPrint objRDLC = new RDLCPrint())
                {
                    //objRDLC.Run(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), Session["imgId1"].ToString(), false, false);
                    objRDLC.RunConsent(this.reportViewer1.LocalReport, Server.MapPath("RDLC\\" + Context.User.Identity.Name), Session["imgId1"].ToString(), false, false);

                    renderedBytes = reportViewer1.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
                }
                //ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), ClientID.ToString(), "ShowPrintDiv('" + Session["imgId1"].ToString() + "');", true);
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                _DataSetGetRdlCName      = null;
                _DataSetRdlForMainReport = null;
                _DataSetRdlForSubReport  = null;
                _RptParam = null;
            }
        }
예제 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int intLoop = 0;
            if (Request["FunctionId"].ToString() != string.Empty)
            {
                switch (Request["FunctionId"].ToString())
                {
                case "GetPrinterList":
                {
                    try
                    {
                        //if (Session["DataSetClientMedications"] != null)
                        // {
                        //Streamline.UserBusinessServices.DataSets.DataSetPharmacies _dsPharmacies = new Streamline.UserBusinessServices.DataSets.DataSetPharmacies();
                        Streamline.UserBusinessServices.ClientMedication objectClientMedications = new ClientMedication();
                        DataSet   dsTemp   = new DataSet();
                        DataRow[] _DataRow = null;
                        objectClientMedications = new ClientMedication();
                        dsTemp = objectClientMedications.GetPrinterData();
                        //if (Request["par1"] == "All")
                        //{
                        //    _DataRow = dsTemp.Tables[0].Select(null, Request["par" + intLoop.ToString()]);
                        //}
                        //else
                        //{
                        // _DataRow = dsTemp.Tables[0].Select("Active='Y'", Request["par" +  intLoop.ToString()]);
                        // }
                        //DataSet _dsPrinter = new DataSet();
                        // _dsPrinter.Merge(_DataRow);
                        PrinterList1.SortString = Request["par" + intLoop.ToString()];
                        if (dsTemp != null && dsTemp.Tables.Count > 0)
                        {
                            PrinterList1.GenerateRows(dsTemp.Tables[0]);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    //}
                    break;
                }

                case "GetPrinterListOnHeaderClick":
                {
                    try
                    {
                        Streamline.UserBusinessServices.ClientMedication objectClientMedications = new ClientMedication();
                        DataSet   dsTemp   = new DataSet();
                        DataRow[] _DataRow = null;
                        objectClientMedications = new ClientMedication();
                        dsTemp   = objectClientMedications.GetPrinterData();
                        _DataRow = dsTemp.Tables[0].Select(null, Request["par0"]);
                        DataSet _dsPrinter = new DataSet();
                        _dsPrinter.Merge(_DataRow);
                        PrinterList1.SortString = Request["par0"];
                        if (_dsPrinter != null && _dsPrinter.Tables.Count > 0)
                        {
                            PrinterList1.GenerateRows(_dsPrinter.Tables[0]);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    break;
                }
                }
            }
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
    }
예제 #14
0
    public bool SendToPrinter(int ScriptReason, int PharmacyId)
    {
        #region Sending Results to printer
        // Declare objects

        DataSet DataSetTemp = null;
        try
        {
            DataSetClientScriptActivities = new Streamline.UserBusinessServices.DataSets.DataSetClientScripts();

            #region InsertRowsIntoClientScriptActivities
            ////Insert Rows into ClientScriptActivities
            DataRow drClientMedicationScriptsActivity = DataSetClientScriptActivities.Tables["ClientMedicationScriptActivities"].NewRow();
            drClientMedicationScriptsActivity["ClientMedicationScriptId"] = Convert.ToInt32(HiddenFieldLatestClientMedicationScriptId.Value);
            drClientMedicationScriptsActivity["Method"]                = 'P';
            drClientMedicationScriptsActivity["PharmacyId"]            = PharmacyId;
            drClientMedicationScriptsActivity["Reason"]                = ScriptReason;
            drClientMedicationScriptsActivity["FaxStatusDate"]         = DateTime.Now;
            drClientMedicationScriptsActivity["FaxStatus"]             = System.DBNull.Value;
            drClientMedicationScriptsActivity["FaxExternalIdentifier"] = System.DBNull.Value;
            drClientMedicationScriptsActivity["RowIdentifier"]         = System.Guid.NewGuid();
            drClientMedicationScriptsActivity["CreatedBy"]             = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
            drClientMedicationScriptsActivity["CreatedDate"]           = DateTime.Now;
            drClientMedicationScriptsActivity["ModifiedBy"]            = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
            drClientMedicationScriptsActivity["ModifiedDate"]          = DateTime.Now;
            DataSetClientScriptActivities.Tables["ClientMedicationScriptActivities"].Rows.Add(drClientMedicationScriptsActivity);
            using (
                ClientMedication _clientMedication = objectClientMedications != null
                                                         ? objectClientMedications
                                                         : new ClientMedication())
            {
                _clientMedication.SetRenderedImageData(DataSetClientScriptActivities, drClientMedicationScriptsActivity,
                                                       ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity)
                                                       .UserCode, null);
            }
            DataSetTemp = objectClientMedications.UpdateClientScriptActivities(DataSetClientScriptActivities);


            #endregion


            if (DataSetTemp.Tables["ClientMedicationScriptActivities"].Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }



        catch (System.Runtime.InteropServices.COMException ex)
        {
            string strEx = ex.Message.ToString();
            throw (ex);
        }
        finally
        {
            DataSetTemp = null;
        }

        #endregion
    }
예제 #15
0
    public bool SendToFax(int ScriptReason, int PharmacyId)
    {
        #region Sending Fax
        // Declare objects
        DataSet DataSetTemp = null;
        string  FaxUniqueId = "";
        try
        {
            DataSetClientScriptActivities = new Streamline.UserBusinessServices.DataSets.DataSetClientScripts();

            #region Get RDLC Contents

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

            DataSet _DataSetRdl = new DataSet();
            Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;

            objectClientMedications = new ClientMedication();
            reportViewer1           = new Microsoft.Reporting.WebForms.ReportViewer();
            _DataSetRdl             = objectClientMedications.GetClientMedicationRDLDataSet(Convert.ToInt32(HiddenFieldLatestClientMedicationScriptId.Value));
            _ReportPath             = Server.MapPath("RDLC\\MedicationReport.rdlc");
            ProcessRdlReport("DataSetMedication_ssp_SCGetClientMedicationScriptDatatry", _DataSetRdl, _ReportPath);


            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>";
            renderedBytes = reportViewer1.LocalReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

            // Create PDF from rendered Bytes to send as an attachment

            //Stream fs = new FileStream(Server.MapPath("RDLC\\MedicationScript.pdf"), FileMode.Create);
            Stream fs = new FileStream(Server.MapPath("RDLC") + "\\" + Context.User.Identity.Name + "\\MedicationScript.pdf", FileMode.Create);
            fs.Write(renderedBytes, 0, renderedBytes.Length);
            fs.Close();

            #endregion

            //Send to Fax server

            try
            {
                Streamline.Faxing.StreamlineFax _streamlineFax = new Streamline.Faxing.StreamlineFax();
                //FaxUniqueId = _streamlineFax.SendFax(PharmacyId, ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId, (Server.MapPath("RDLC") + "\\" + Context.User.Identity.Name + "\\MedicationScript.pdf"), "Prescription Medication Script") ? "True" : "";
                FaxUniqueId = _streamlineFax.SendFax(PharmacyId, ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId, (Server.MapPath("RDLC") + "\\" + Context.User.Identity.Name + "\\MedicationScript.pdf"), "Prescription Medication Script");
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "Source function SendToFax() of Print Order Dialog";
                }
                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);
            }


            #region InsertRowsIntoClientScriptActivities
            ////Insert Rows into ClientScriptActivities
            DataRow drClientMedicationScriptsActivity = DataSetClientScriptActivities.Tables["ClientMedicationScriptActivities"].NewRow();
            drClientMedicationScriptsActivity["ClientMedicationScriptId"] = Convert.ToInt32(HiddenFieldLatestClientMedicationScriptId.Value);
            drClientMedicationScriptsActivity["Method"]                = 'F';
            drClientMedicationScriptsActivity["PharmacyId"]            = PharmacyId;
            drClientMedicationScriptsActivity["Reason"]                = ScriptReason;
            drClientMedicationScriptsActivity["FaxStatusDate"]         = DateTime.Now;
            drClientMedicationScriptsActivity["FaxStatus"]             = "QUEUED";
            drClientMedicationScriptsActivity["FaxExternalIdentifier"] = FaxUniqueId;
            drClientMedicationScriptsActivity["RowIdentifier"]         = System.Guid.NewGuid();
            drClientMedicationScriptsActivity["CreatedBy"]             = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
            drClientMedicationScriptsActivity["CreatedDate"]           = DateTime.Now;
            drClientMedicationScriptsActivity["ModifiedBy"]            = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
            drClientMedicationScriptsActivity["ModifiedDate"]          = DateTime.Now;
            DataSetClientScriptActivities.Tables["ClientMedicationScriptActivities"].Rows.Add(drClientMedicationScriptsActivity);
            using (
                ClientMedication _clientMedication = objectClientMedications != null
                                                         ? objectClientMedications
                                                         : new ClientMedication())
            {
                _clientMedication.SetRenderedImageData(DataSetClientScriptActivities, drClientMedicationScriptsActivity,
                                                       ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity)
                                                       .UserCode, renderedBytes);
            }
            DataSetTemp = objectClientMedications.UpdateClientScriptActivities(DataSetClientScriptActivities);


            #endregion



            if (DataSetTemp.Tables["ClientMedicationScriptActivities"].Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }



        catch (System.Runtime.InteropServices.COMException ex)
        {
            string strEx = ex.Message.ToString();
            throw (ex);
        }
        finally
        {
            DataSetTemp = null;
        }

        #endregion
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int intLoop = 0;
            if (Request["FunctionId"].ToString() != string.Empty)
            {
                switch (Request["FunctionId"].ToString())
                {
                case "GetPharmacyList":
                {
                    try
                    {
                        Streamline.UserBusinessServices.ClientMedication objectClientMedications = new ClientMedication();
                        DataSet   dsTemp   = new DataSet();
                        DataRow[] _DataRow = null;
                        objectClientMedications = new ClientMedication();
                        dsTemp   = objectClientMedications.GetPharmaciesData();
                        _DataRow = dsTemp.Tables[0].Select(null, Request["par" + intLoop.ToString()]);
                        DataSet _dsPharmacies = new DataSet();
                        _dsPharmacies.Merge(_DataRow);
                        PharmacyList1.Visible    = true;
                        PharmacyList1.SortString = Request["par" + intLoop.ToString()];
                        if (_dsPharmacies != null && _dsPharmacies.Tables.Count > 0)
                        {
                            PharmacyList1.GenerateRows(_dsPharmacies.Tables[0], false);
                        }
                        Session["PharmacyId"] = null;
                    }
                    catch (Exception ex)
                    {
                    }
                    break;
                }

                case "GetAllPharmaciesList":
                {
                    DataRow[] _DataRow = null;
                    Streamline.UserBusinessServices.ClientMedication objectClientMedications = new ClientMedication();
                    DataSet dsTemp = new DataSet();
                    objectClientMedications = new ClientMedication();
                    dsTemp   = objectClientMedications.GetPharmaciesData();
                    _DataRow = dsTemp.Tables[0].Select("isnull(recorddeleted,'N')<>'Y'", "PharmacyName asc");
                    DataSet _dsPharmacies = new DataSet();
                    _dsPharmacies.Merge(_DataRow);
                    PharmacyList1.Visible    = true;
                    PharmacyList1.SortString = "PharmacyName asc";
                    if (_dsPharmacies != null && _dsPharmacies.Tables.Count > 0)
                    {
                        PharmacyList1.GenerateRows(_dsPharmacies.Tables[0], false);
                    }
                    Session["PharmacyId"] = null;
                    break;
                }

                //Ref:Task no:85
                case "GetSearchPharmaciesList":
                {
                    int    PharmacyId           = 0;
                    string PharmacyName         = "";
                    string Phone                = "";
                    string Fax                  = "";
                    string State                = "";
                    string City                 = "";
                    string Address              = "";
                    string Zip                  = "";
                    string SureScriptIdentifier = "";
                    string Specialty            = "";
                    if (Request["PharmacyId"].ToString() != "")
                    {
                        PharmacyId = Convert.ToInt32(Request["PharmacyId"].ToString());
                    }
                    Phone                = Request["Phone"].ToString();
                    PharmacyName         = Request["PharmacyName"].ToString();
                    Address              = Request["Address"].ToString();
                    Fax                  = Request["Fax"].ToString();
                    City                 = Request["City"].ToString();
                    State                = Request["State"].ToString();
                    Zip                  = Request["Zip"].ToString();
                    SureScriptIdentifier = Request["SureScriptIdentifier"].ToString();
                    Specialty            = Request["Specialty"].ToString();
                    Streamline.UserBusinessServices.ClientMedication objectClientMedications = new ClientMedication();
                    DataSet dsTemp = new DataSet();
                    if (Request["CurrentPage"].ToString() != "")
                    {
                        CurrentPage = Convert.ToInt32(Request["CurrentPage"].ToString());
                    }
                    startrowIndex = (CurrentPage * PageSize) + 1;
                    endRowIndex   = (PageSize * CurrentPage) + PageSize;
                    PharmacySerachList.Visible = true;
                    PharmacySerachList.GridBind(PharmacyName, Address, City, State, Zip, Phone, Fax, PharmacyId, SureScriptIdentifier, Specialty, startrowIndex, endRowIndex, CurrentPage, PageSize);
                    Session["SearchList"] = dsTemp;
                    break;
                }

                case "GetPharmacySearchListSort":
                {
                    try
                    {
                        PharmacySerachList.Visible = true;
                        string Sortcolumn    = Request["SortColumn"].ToString();
                        string Sortdirection = Request["SortDirection"].ToString();
                        int    CurrentPage   = 0;
                        if (Request["CurrentPage"].ToString() != "")
                        {
                            CurrentPage = Convert.ToInt32(Request["CurrentPage"].ToString());
                        }
                        PharmacySerachList.GridBindOnSorting(Sortcolumn, Sortdirection, CurrentPage);
                    }
                    catch (Exception ex)
                    {
                    }
                    break;
                }
                }
            }
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
    }
    /// <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);
        }
    }
예제 #18
0
    public void GenerateRows(int HealthDataCategoryId)
    {
        try
        {
            System.Drawing.Color[] _color =
            {
                System.Drawing.Color.Pink,
                System.Drawing.Color.Red,
                System.Drawing.Color.Yellow,
                System.Drawing.Color.Green,
                System.Drawing.Color.Plum,
                System.Drawing.Color.Aqua,
                System.Drawing.Color.PaleGoldenrod,
                System.Drawing.Color.Peru,
                System.Drawing.Color.Tan,
                System.Drawing.Color.Khaki,
                System.Drawing.Color.DarkGoldenrod,
                System.Drawing.Color.Maroon,
                System.Drawing.Color.OliveDrab,
                System.Drawing.Color.Crimson,
                System.Drawing.Color.Beige,
                System.Drawing.Color.DimGray,
                System.Drawing.Color.ForestGreen,
                System.Drawing.Color.Indigo,
                System.Drawing.Color.LightCyan
            };
            PanelHealthDataList.Controls.Clear();
            DataSet _DataSetHealthDataList = null;
            Streamline.UserBusinessServices.ClientMedication objectClientMedications;
            objectClientMedications = new ClientMedication();
            Table tblHealthdata = new Table();
            tblHealthdata.ID    = System.Guid.NewGuid().ToString();
            tblHealthdata.Width = new Unit(98, UnitType.Percentage);
            TableHeaderRow  thTitle         = new TableHeaderRow();
            TableHeaderCell thcBlank1       = new TableHeaderCell();
            TableHeaderCell thcBlank2       = new TableHeaderCell();
            TableHeaderCell thcDateRecorded = new TableHeaderCell();
            TableHeaderCell thcItemValue1   = new TableHeaderCell();
            TableHeaderCell thcItemValue2   = new TableHeaderCell();
            TableHeaderCell thcItemValue3   = new TableHeaderCell();
            TableHeaderCell thcItemValue4   = new TableHeaderCell();
            TableHeaderCell thcItemValue5   = new TableHeaderCell();
            TableHeaderCell thcItemValue6   = new TableHeaderCell();

            int ClientId = 0;
            ClientId = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
            _DataSetHealthDataList = objectClientMedications.GetHeathDataListRecords(ClientId, HealthDataCategoryId);
            DataSet dataSetHealthData = new DataSet();
            dataSetHealthData.Merge(_DataSetHealthDataList.Tables["HealthData"]);
            Session["HealthDataList"] = dataSetHealthData;
            //Creating table header Cell
            thcDateRecorded.Text           = "Date";
            thcDateRecorded.Font.Underline = true;
            //thcDateRecorded.Attributes.Add("onClick", "onHealthDataHeaderClick(this)");
            //thcDateRecorded.Attributes.Add("ColumnName", "Date");
            //thcDateRecorded.Attributes.Add("SortOrder", setAttributes());
            //thcDateRecorded.CssClass = "handStyle";
            thcDateRecorded.Width = new Unit(10, UnitType.Percentage);

            if (_DataSetHealthDataList.Tables["HealthDataListHeader"].Rows.Count > 0)
            {
                string itemValue1 = _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName1"] == DBNull.Value ? "" : _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName1"].ToString();
                string itemValue2 = _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName2"] == DBNull.Value ? "" : _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName2"].ToString();
                string itemValue3 = _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName3"] == DBNull.Value ? "" : _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName3"].ToString();
                string itemValue4 = _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName4"] == DBNull.Value ? "" : _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName4"].ToString();
                string itemValue5 = _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName5"] == DBNull.Value ? "" : _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName5"].ToString();
                string itemValue6 = _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName6"] == DBNull.Value ? "" : _DataSetHealthDataList.Tables["HealthDataListHeader"].Rows[0]["ItemName6"].ToString();

                thcItemValue1.Text           = itemValue1;
                thcItemValue1.Width          = new Unit(14, UnitType.Percentage);
                thcItemValue1.Font.Underline = true;
                // thcItemValue1.Attributes.Add("onClick", "onHealthDataHeaderClick(this)");
                // thcItemValue1.Attributes.Add("ColumnName", itemValue1);
                // thcItemValue1.Attributes.Add("SortOrder", setAttributes());
                //thcItemValue1.CssClass = "handStyle";


                thcItemValue2.Text           = itemValue2;
                thcItemValue2.Font.Underline = true;
                thcItemValue2.Width          = new Unit(14, UnitType.Percentage);
                //thcItemValue2.Attributes.Add("onClick", "onHealthDataHeaderClick(this)");
                // thcItemValue2.Attributes.Add("ColumnName", itemValue2);
                // thcItemValue2.Attributes.Add("SortOrder", setAttributes());
                //thcItemValue2.CssClass = "handStyle";


                thcItemValue3.Text           = itemValue3;
                thcItemValue3.Font.Underline = true;
                thcItemValue3.Width          = new Unit(14, UnitType.Percentage);
                //thcItemValue3.Attributes.Add("onClick", "onHealthDataHeaderClick(this)");
                // thcItemValue3.Attributes.Add("ColumnName", itemValue3);
                // thcItemValue3.Attributes.Add("SortOrder", setAttributes());
                //thcItemValue3.CssClass = "handStyle";


                thcItemValue4.Text           = itemValue4;
                thcItemValue4.Font.Underline = true;
                thcItemValue4.Width          = new Unit(14, UnitType.Percentage);
                //thcItemValue4.Attributes.Add("onClick", "onHealthDataHeaderClick(this)");
                // thcItemValue4.Attributes.Add("ColumnName", itemValue4);
                //thcItemValue4.Attributes.Add("SortOrder", setAttributes());
                // thcItemValue4.CssClass = "handStyle";

                thcItemValue5.Text           = itemValue5;
                thcItemValue5.Font.Underline = true;
                thcItemValue5.Width          = new Unit(14, UnitType.Percentage);
                // thcItemValue5.Attributes.Add("onClick", "onHealthDataHeaderClick(this)");
                //thcItemValue5.Attributes.Add("ColumnName", itemValue5);
                // thcItemValue5.Attributes.Add("SortOrder", setAttributes());
                //thcItemValue5.CssClass = "handStyle";

                thcItemValue6.Text           = itemValue6;
                thcItemValue6.Font.Underline = true;
                thcItemValue6.Width          = new Unit(14, UnitType.Percentage);
                // thcItemValue6.Attributes.Add("onClick", "onHealthDataHeaderClick(this)");
                // thcItemValue6.Attributes.Add("ColumnName", itemValue6);
                // thcItemValue6.Attributes.Add("SortOrder", setAttributes());
                // thcItemValue6.CssClass = "handStyle";
                // End Creating table header cell


                //Adding HeaderCells in HeaderRow
                thTitle.Cells.Add(thcBlank1);
                thTitle.Cells.Add(thcBlank2);
                thTitle.Cells.Add(thcDateRecorded);

                if (itemValue1 != null && itemValue1 != "")
                {
                    thTitle.Cells.Add(thcItemValue1);
                }
                if (itemValue2 != null && itemValue2 != "")
                {
                    thTitle.Cells.Add(thcItemValue2);
                }
                if (itemValue3 != null && itemValue3 != "")
                {
                    thTitle.Cells.Add(thcItemValue3);
                }
                if (itemValue4 != null && itemValue4 != "")
                {
                    thTitle.Cells.Add(thcItemValue4);
                }
                if (itemValue5 != null && itemValue5 != "")
                {
                    thTitle.Cells.Add(thcItemValue5);
                }
                if (itemValue6 != null && itemValue6 != "")
                {
                    thTitle.Cells.Add(thcItemValue6);
                }
            }
            //End Adding HeaderCells in HeaderRow
            thTitle.CssClass = "GridViewHeaderText";
            tblHealthdata.Rows.Add(thTitle);


            string myscript = "##SDelete##<script id='HealthDataListScript' type='text/javascript'>";
            myscript += "function $deleteRecord(sender,e){";
            if (!string.IsNullOrEmpty(_deleteRowMessage))
            {
                myscript += " if(confirm('" + _deleteRowMessage + " ')==true){ " + this._onDeleteEventHandler + "(sender,e);  }}";
            }
            else
            {
                myscript += "}";
            }
            myscript += "function RegisterHealthDataListControlEvents(){try{ ";
            //int ClientId = 0;
            //ClientId = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
            //_DataSetHealthDataList = objectClientMedications.GetHeathDataListRecords(ClientId, HealthDataCategoryId);
            if (_DataSetHealthDataList.Tables["HealthDataList"].Rows.Count > 0)
            {
                foreach (DataRow drHealthData in _DataSetHealthDataList.Tables["HealthDataList"].Rows)
                {
                    int healthDataId = Convert.ToInt32(drHealthData["HealthDataId"]);
                    //int healthDataCategoryId = Convert.ToInt32(drHealthData["HealthDataCategoryId"]);
                    string itemValue1   = drHealthData["ItemValue1"] == DBNull.Value ? "" : drHealthData["ItemValue1"].ToString();
                    string itemValue2   = drHealthData["ItemValue2"] == DBNull.Value ? "" : drHealthData["ItemValue2"].ToString();
                    string itemValue3   = drHealthData["ItemValue3"] == DBNull.Value ? "" : drHealthData["ItemValue3"].ToString();
                    string itemValue4   = drHealthData["ItemValue4"] == DBNull.Value ? "" : drHealthData["ItemValue4"].ToString();
                    string itemValue5   = drHealthData["ItemValue5"] == DBNull.Value ? "" : drHealthData["ItemValue5"].ToString();
                    string itemValue6   = drHealthData["ItemValue6"] == DBNull.Value ? "" : drHealthData["ItemValue6"].ToString();
                    string DateRecorded = "";
                    //Code added by Loveena in ref to Changes for changing the text color
                    string itemColor1 = drHealthData["ItemColor1"] == DBNull.Value ? "" : drHealthData["ItemColor1"].ToString();
                    string itemColor2 = drHealthData["ItemColor2"] == DBNull.Value ? "" : drHealthData["ItemColor2"].ToString();
                    string itemColor3 = drHealthData["ItemColor3"] == DBNull.Value ? "" : drHealthData["ItemColor3"].ToString();
                    string itemColor4 = drHealthData["ItemColor4"] == DBNull.Value ? "" : drHealthData["ItemColor4"].ToString();
                    string itemColor5 = drHealthData["ItemColor5"] == DBNull.Value ? "" : drHealthData["ItemColor5"].ToString();
                    string itemColor6 = drHealthData["ItemColor6"] == DBNull.Value ? "" : drHealthData["ItemColor6"].ToString();
                    //Code ends over here.

                    DateRecorded = drHealthData["DateRecorded"] == DBNull.Value ? "" : drHealthData["DateRecorded"].ToString();
                    if (DateRecorded != "")
                    {
                        DateRecorded = Convert.ToDateTime(DateRecorded).ToString("MM/dd/yyyy");
                    }
                    else
                    {
                        DateRecorded = "";
                    }
                    string   newId           = System.Guid.NewGuid().ToString();
                    TableRow trHealthDataRow = new TableRow();
                    trHealthDataRow.ID = "Tr_" + newId;
                    string    rowId              = trHealthDataRow.ClientID;
                    string    tableId            = tblHealthdata.ClientID;
                    TableCell tdDeleteHealthData = new TableCell();
                    HtmlImage imgTemp            = new HtmlImage();
                    imgTemp.ID = "Img_" + healthDataId.ToString();
                    imgTemp.Attributes.Add("HealthDataId", drHealthData["HealthDataId"].ToString());

                    imgTemp.Src = "~/App_Themes/Includes/Images/deleteIcon.gif";
                    imgTemp.Attributes.Add("class", "handStyle");
                    if (((Streamline.BaseLayer.StreamlinePrinciple)Context.User).HasPermission(Permissions.HealthData) == true)
                    {
                        //Modified by Loveena in ref to Task#29
                        imgTemp.Attributes.Add("onClick", "onHealthDataDeleteClick('" + healthDataId + "','" + tableId + "','" + rowId + "')");
                        //imgTemp.Attributes.Add("onClick", "onHealthDataDeleteClick('" + healthDataId + "','" + tableId + "','" + rowId + "','" + PanelHealthDataList.ClientID + "')");
                    }
                    else
                    {
                        imgTemp.Disabled = true;
                    }
                    tdDeleteHealthData.Controls.Add(imgTemp);
                    //myscript += "var Imagecontext" + healthDataId + "={HealthDataId:" + healthDataId + ",TableId:'" + tableId + "',RowId:'" + rowId + "'};";
                    //myscript += "var ImageclickCallback" + healthDataId + " =";
                    //myscript += " Function.createCallback($deleteRecord, Imagecontext" + healthDataId + ");";
                    //myscript += "$addHandler($get('" + this.ClientID + this.ClientIDSeparator + imgTemp.ClientID + "'), 'click', ImageclickCallback" + healthDataId + ");";

                    trHealthDataRow.Cells.Add(tdDeleteHealthData);

                    //Code added by Loveena in ref to Task#2978 2.0 - Allow In-Place Edit of Health Data
                    TableCell  tdEditHealthData = new TableCell();
                    HtmlButton buttonEdit       = new HtmlButton();
                    buttonEdit.ID        = "buttonEdit" + healthDataId.ToString();
                    buttonEdit.InnerText = "Edit";
                    buttonEdit.Attributes.Add("HealthDataId", drHealthData["HealthDataId"].ToString());
                    buttonEdit.Attributes.Add("class", "btnimgexsmall");
                    if (((Streamline.BaseLayer.StreamlinePrinciple)Context.User).HasPermission(Permissions.HealthData) == true)
                    {
                        buttonEdit.Attributes.Add("onClick", "onHealthDataEditClick('" + healthDataId + "','" + HealthDataCategoryId + "'); return false;");
                        //buttonEdit.Attributes.Add("onClick", "javascript:alert(test);");
                    }
                    else
                    {
                        buttonEdit.Disabled = true;
                    }
                    tdEditHealthData.Controls.Add(buttonEdit);
                    trHealthDataRow.Cells.Add(tdEditHealthData);
                    //Code ends over here.

                    TableCell tdDateRecorded = new TableCell();
                    tdDateRecorded.CssClass = "Label";
                    tdDateRecorded.Text     = DateRecorded;
                    trHealthDataRow.Cells.Add(tdDateRecorded);

                    TableCell tdItemValue1 = new TableCell();
                    tdItemValue1.CssClass = "Label";
                    tdItemValue1.Width    = new Unit(14, UnitType.Percentage);
                    if (itemValue1 != null && itemValue1 != "")
                    {
                        tdItemValue1.Text = itemValue1;
                        if (itemColor1 != null && itemColor1 != "")
                        {
                            switch (itemColor1)
                            {
                            case "R":
                                tdItemValue1.Style.Add("color", "Red");
                                break;

                            case "Y":
                                tdItemValue1.Style.Add("color", "#F5B800");    //Added by Chandan on 17/02/2010 for list yellow color task#34
                                break;
                            }
                        }
                        //trHealthDataRow.Cells.Add(tdItemValue1);
                    }
                    trHealthDataRow.Cells.Add(tdItemValue1);


                    TableCell tdItemValue2 = new TableCell();
                    tdItemValue2.CssClass = "Label";
                    tdItemValue2.Width    = new Unit(14, UnitType.Percentage);
                    if (itemValue2 != null && itemValue2 != "")
                    {
                        tdItemValue2.Text = itemValue2;
                        if (itemColor2 != null && itemColor2 != "")
                        {
                            switch (itemColor2)
                            {
                            case "R":
                                tdItemValue2.Style.Add("color", "Red");
                                break;

                            case "Y":
                                tdItemValue2.Style.Add("color", "#F5B800");    //Added by Chandan on 17/02/2010 for list yellow color task#34
                                break;
                            }
                        }
                        //trHealthDataRow.Cells.Add(tdItemValue2);
                    }
                    trHealthDataRow.Cells.Add(tdItemValue2);

                    TableCell tdItemValue3 = new TableCell();
                    tdItemValue3.CssClass = "Label";
                    tdItemValue3.Width    = new Unit(14, UnitType.Percentage);
                    if (itemValue3 != null && itemValue3 != "")
                    {
                        tdItemValue3.Text = itemValue3;
                        if (itemColor3 != null && itemColor3 != "")
                        {
                            switch (itemColor3)
                            {
                            case "R":
                                tdItemValue3.Style.Add("color", "Red");
                                break;

                            case "Y":
                                tdItemValue3.Style.Add("color", "#F5B800");    //Added by Chandan on 17/02/2010 for list yellow color task#34
                                break;
                            }
                        }
                        //trHealthDataRow.Cells.Add(tdItemValue3);
                    }
                    trHealthDataRow.Cells.Add(tdItemValue3);

                    TableCell tdItemValue4 = new TableCell();
                    tdItemValue4.CssClass = "Label";
                    tdItemValue4.Width    = new Unit(14, UnitType.Percentage);
                    if (itemValue4 != null && itemValue4 != "")
                    {
                        tdItemValue4.Text = itemValue4;
                        if (itemColor4 != null && itemColor4 != "")
                        {
                            switch (itemColor4)
                            {
                            case "R":
                                tdItemValue4.Style.Add("color", "Red");
                                break;

                            case "Y":
                                tdItemValue4.Style.Add("color", "#F5B800");    //Added by Chandan on 17/02/2010 for list yellow color task#34
                                break;
                            }
                        }
                        //    trHealthDataRow.Cells.Add(tdItemValue4);
                    }
                    trHealthDataRow.Cells.Add(tdItemValue4);

                    TableCell tdItemValue5 = new TableCell();
                    tdItemValue5.CssClass = "Label";
                    tdItemValue5.Width    = new Unit(14, UnitType.Percentage);
                    if (itemValue5 != null && itemValue5 != "")
                    {
                        tdItemValue5.Text = itemValue5;
                        if (itemColor5 != null && itemColor5 != "")
                        {
                            switch (itemColor5)
                            {
                            case "R":
                                tdItemValue5.Style.Add("color", "Red");
                                break;

                            case "Y":
                                tdItemValue5.Style.Add("color", "#F5B800");    //Added by Chandan on 17/02/2010 for list yellow color task#34
                                break;
                            }
                        }
                        //trHealthDataRow.Cells.Add(tdItemValue5);
                    }
                    trHealthDataRow.Cells.Add(tdItemValue5);

                    TableCell tdItemValue6 = new TableCell();
                    tdItemValue6.CssClass = "Label";
                    tdItemValue6.Width    = new Unit(14, UnitType.Percentage);
                    if (itemValue6 != null && itemValue6 != "")
                    {
                        tdItemValue6.Text = itemValue6;
                        if (itemColor6 != null && itemColor6 != "")
                        {
                            switch (itemColor6)
                            {
                            case "R":
                                tdItemValue6.Style.Add("color", "Red");
                                break;

                            case "Y":
                                tdItemValue6.Style.Add("color", "#F5B800");    //Added by Chandan on 17/02/2010 for list yellow color task#34
                                break;
                            }
                        }
                        //trHealthDataRow.Cells.Add(tdItemValue6);
                    }
                    trHealthDataRow.Cells.Add(tdItemValue6);

                    tblHealthdata.Rows.Add(trHealthDataRow);


                    //TableRow trLine = new TableRow();
                    //TableCell tdHorizontalLine = new TableCell();
                    //tdHorizontalLine.ColumnSpan = 14;
                    //tdHorizontalLine.CssClass = "blackLine";
                    //trLine.Cells.Add(tdHorizontalLine);
                    //tblHealthdata.Rows.Add(trLine);
                }
            }
            PanelHealthDataList.Controls.Add(tblHealthdata);
            myscript += "}catch(e){  Streamline.SmartClient.ExceptionManager.getInstance().publishException(ERROR_CODE_REGULAR, e);}}</script>##EDelete##";
            ScriptManager.RegisterStartupScript(DivHealthDataList, DivHealthDataList.GetType(), DivHealthDataList.ClientID.ToString(), myscript, false);
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            throw (ex);
        }
    }