/// <summary>
 /// Author Sonia
 /// Purpose:-To Download the Client's Medication Summary Data
 /// </summary>
 private void GetClientConsentHistory(Int64 ClientId)
 {
     try
     {
         CommonFunctions.Event_Trap(this);
         _DataSetClientMedications = new DataSet();
         Session["DataSetClientConsentHistory"] = null;
         objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();
         if (ClientId > 0)
         {
             _DataSetClientMedications = objectClientMedications.DownloadClientConsentHistory(ClientId);
             Session["DataSetClientConsentHistory"] = _DataSetClientMedications;
             string currentDate = DateTime.Now.ToShortDateString();
         }
     }
     catch (Exception ex)
     {
         if (ex.Data["CustomExceptionInformation"] == null)
         {
             ex.Data["CustomExceptionInformation"] = "###Source Function Name - GetClientConsentHistory(), ParameterCount -1, First Parameter- " + ClientId + "###";
         }
         if (ex.Data["DatasetInfo"] == null)
         {
             ex.Data["DatasetInfo"] = null;
         }
         Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
     }
     finally
     {
         objectClientMedications = null;
     }
 }
 /// <summary>
 /// Retrieves the Allergies data. and put it in a Grid.
 /// <Author>Author: Sonia</Author>
 /// <CreatedDate>Date: 1-Nov-07</CreatedDate>
 /// </summary>
 private void GetAllergiesData(string SearchCriteria)
 {
     Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
     try
     {
         objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();
         dsAllergiesData         = objectClientMedications.GetAllergiesData(SearchCriteria);
     }
     //Exception ex added by Pratap on 29th June 2007
     catch (Exception ex)
     {
         if (ex.Data["CustomExceptionInformation"] == null)
         {
             ex.Data["CustomExceptionInformation"] = "";
         }
         else
         {
             ex.Data["CustomExceptionInformation"] = "";
         }
         if (ex.Data["DatasetInfo"] == null)
         {
             ex.Data["DatasetInfo"] = null;
         }
         Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
     }
     finally
     {
         objectClientMedications = null;
     }
 }
    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);
        }
    }
예제 #4
0
        private void GetPharmacies()
        {
            DataSet dsTemp       = null;
            DataSet dsPharmacies = null;

            DataRow[] _dr = null;
            try
            {
                CommonFunctions.Event_Trap(this);
                Session["PharmacyId"] = null;
                dsTemp                  = new DataSet();
                dsPharmacies            = new DataSet();
                objectClientMedications = new ClientMedication();
                dsTemp                  = objectClientMedications.GetPharmaciesData();
                _dr = dsTemp.Tables["Pharmacies"].Select("Active = 'Y' And IsNull(RecordDeleted,'N')<>'Y'", "PharmacyName asc");
                dsPharmacies.Merge(_dr);
                ScriptManager.RegisterStartupScript(Label1, Label1.GetType(), "key", "PharmacyManagement.FillPharmacies();", true);
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                _dsPharmacies = null;
                dsTemp        = null;
            }
        }
 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);
     }
 }
예제 #6
0
    private void BindControls()
    {
        try
        {
            CommonFunctions.Event_Trap(this);

            //Clear the controls
            ClearControls();

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

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

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

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

            //Set Values for HiddenFields.
            HiddenPreferredPharmacy1.Value = DropDownListPharmacy1.SelectedValue;
            HiddenPreferredPharmacy2.Value = DropDownListPharmacy2.SelectedValue;
            HiddenPreferredPharmacy3.Value = DropDownListPharmacy3.SelectedValue;
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }
예제 #7
0
        /// Author Sonia
        /// <summary>
        /// This function is used to Bind ScriptHistory Grid and Other Details of Medication Order
        /// </summary>

        private void BindControls()
        {
            DataView DataViewClientMedicationScriptHistory;

            ShowHidePillImage = "display:none";
            try
            {
                DataViewClientMedicationScriptHistory = null;
                if (((Streamline.BaseLayer.StreamlinePrinciple)Context.User) != null)
                {
                    _clientMedicationId = Convert.ToInt32(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientOrderDetailsMedicationId.ToString());
                    HiddenFieldClientMedicationId.Value = _clientMedicationId.ToString();
                    GetMedicationOrderDetails();
                    MedicationClientPersonalInformationControl.showEditableAllergyList = false;
                    MedicationClientPersonalInformationControl.Activate();

                    //Fill the Script History Information
                    objectClientMedications = new ClientMedication();
                    if (HiddenFieldScriptId.Value.ToString() != "")
                    {
                        _DataSetClientMedicationScriptHistory = objectClientMedications.DownloadClientMedicationScriptHistory(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId, _clientMedicationId, Convert.ToInt32(HiddenFieldScriptId.Value.ToString()));
                    }
                    else
                    {
                        _DataSetClientMedicationScriptHistory = objectClientMedications.DownloadClientMedicationScriptHistory(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId, _clientMedicationId, -1);
                    }
                    DataViewClientMedicationScriptHistory            = _DataSetClientMedicationScriptHistory.Tables["ClientMedicationScripts"].DefaultView;
                    DataViewClientMedicationScriptHistory.Sort       = "ClientMedicationScriptId desc";
                    Session["DataViewClientMedicationScriptHistory"] = DataViewClientMedicationScriptHistory;
                    if (DataViewClientMedicationScriptHistory.Table.Rows.Count > 0)
                    {
                        Session["PharmacyName"]          = DataViewClientMedicationScriptHistory.Table.Rows[0]["PharmacyName"];
                        Session["OrderingMethod"]        = DataViewClientMedicationScriptHistory.Table.Rows[0]["OrderingMethod"];
                        DataGridScriptHistory.DataSource = DataViewClientMedicationScriptHistory;
                        DataGridScriptHistory.DataBind();
                        HiddenFieldLatestClientMedicationScriptId.Value = DataViewClientMedicationScriptHistory.Table.Rows[0]["ClientMedicationScriptId"].ToString();
                        HiddenFieldPrescriptionStatus.Value             = DataViewClientMedicationScriptHistory.Table.Rows[0]["Status"].ToString();
                    }
                    else
                    {
                        DataGridScriptHistory.DataBind();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(LabelClientScript, LabelClientScript.GetType(), ClientID.ToString(), "redirectToLoginPage();", true);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                DataViewClientMedicationScriptHistory = null;
            }
        }
예제 #8
0
        public void bindTemplateGrid()
        {
            int StaffId = 0, ClientId = 0;

            StaffId  = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId;
            ClientId = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;

            Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
            try
            {
                objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();
                dsHealthDataAlerts      = objectClientMedications.GetHealthMaintenaceAlertData(ClientId, StaffId);
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }
                else
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }
                if (ex.Data["DatasetInfo"] == null)
                {
                    ex.Data["DatasetInfo"] = null;
                }
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                objectClientMedications = null;
            }

            if (dsHealthDataAlerts != null && dsHealthDataAlerts.Tables.Count > 0)
            {
                if (dsHealthDataAlerts.Tables["HMTemplateDetails"] != null && dsHealthDataAlerts.Tables["HMTemplateDetails"].Rows.Count > 0)
                {
                    if (dsHealthDataAlerts.Tables["HMCriteriaDetails"] != null && dsHealthDataAlerts.Tables["HMCriteriaDetails"].Rows.Count > 0)
                    {
                        dtHMTemplateCriteriaDetails = dsHealthDataAlerts.Tables["HMCriteriaDetails"];
                    }
                    divHMTemplateAndCriteriaRepeater.DataSource = dsHealthDataAlerts.Tables["HMTemplateDetails"];
                    divHMTemplateAndCriteriaRepeater.DataBind();
                    dtHMTemplateCriteriaDetails = null;

                    string clientStr = dsHealthDataAlerts.Tables["HMTemplateDetails"].Rows[0]["ClientName"].ToString() + " (" + dsHealthDataAlerts.Tables["HMTemplateDetails"].Rows[0]["ClientID"].ToString() + ")";
                    hiddenClientName.Value = clientStr;
                    hiddenClientId.Value   = dsHealthDataAlerts.Tables["HMTemplateDetails"].Rows[0]["ClientID"].ToString();
                }
                if (dsHealthDataAlerts.Tables["HMAlertCount"] != null && dsHealthDataAlerts.Tables["HMAlertCount"].Rows.Count > 0)
                {
                    hiddenAlertCount.Value = dsHealthDataAlerts.Tables["HMAlertCount"].Rows[0][0].ToString();
                }
            }
        }
    protected override void Page_Load(object sender, EventArgs e)
    {
        Streamline.UserBusinessServices.ClientMedication objectClientMedications;
        objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();
        DataSet DataSetAgencyKeyPhrases = null;
        Int32   staffid = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId;

        DataSetAgencyKeyPhrases            = GetAgencyKeyPhrases(staffid);
        Session["DataSetAgencyKeyPhrases"] = DataSetAgencyKeyPhrases;
    }
예제 #10
0
        private void GetClientSummaryData()
        {
            Streamline.UserBusinessServices.DataSets.DataSetClientMedications DataSetClientMedications;
            Streamline.UserBusinessServices.ClientMedication objectClientMedications = null;
            DataSet dataSetClientSummary = null;

            Session["DataSetClientSummary"] = null;
            try
            {
                objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();
                CommonFunctions.Event_Trap(this);
                string _ClientRowIdentifier    = "";
                string _ClinicianrowIdentifier = "";

                DataSetClientMedications = new Streamline.UserBusinessServices.DataSets.DataSetClientMedications();
                try
                {
                    _ClinicianrowIdentifier = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).ClinicianRowIdentifier;
                }
                catch (Exception ex)
                {
                    if (ex.Data["CustomExceptionInformation"] == null)
                    {
                        ex.Data["CustomExceptionInformation"] = "";
                    }

                    string ParseMessage = ex.Message;
                    if (ParseMessage.Contains("Object") == true)
                    {
                        throw new Exception("Session Expired");
                    }
                }
                _ClientRowIdentifier = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientRowIdentifier;

                if (_ClientRowIdentifier != "" && _ClinicianrowIdentifier != "")
                {
                    dataSetClientSummary = objectClientMedications.DownloadClientMedicationSummary(_ClientRowIdentifier, _ClinicianrowIdentifier);
                    Session["DataSetClientMedications"] = null;
                    Session["DataSetClientSummary"]     = dataSetClientSummary;

                    DataSetClientMedications.EnforceConstraints = false;
                    DataSetClientMedications.Tables["ClientMedications"].Merge(dataSetClientSummary.Tables["ClientMedications"]);
                    DataSetClientMedications.Tables["ClientMedicationInstructions"].Merge(dataSetClientSummary.Tables["ClientMedicationInstructions"]);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                objectClientMedications = null;
            }
        }
예제 #11
0
        public override bool DocumentCloseDocument()
        {
            _DataSetOrderDetails = null;
            _DataSetClientMedicationScriptHistory = null;
            objectClientMedications = null;
            _DataSetClientSummary   = null;
            Session["DataViewClientMedicationScriptHistory"] = null;
            GridViewMedicationInstructions.Dispose();
            DataGridScriptHistory.Dispose();



            return(true);
        }
    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);
        }
    }
예제 #13
0
 private void BindMedReconciliationDataDropDown()
 {
     try
     {
         Streamline.UserBusinessServices.ClientMedication objClientMedications = new Streamline.UserBusinessServices.ClientMedication();
         _DataSetMedReconciliationDataList = objClientMedications.GetMedReconciliationDropDown();
         if (_DataSetMedReconciliationDataList.Tables["MedReconciliationDropDownList"].Rows.Count > 0)
         {
             DropDownMedReconciliation.DataValueField = "GlobalCodeId";
             DropDownMedReconciliation.DataTextField  = "CodeName";
             DropDownMedReconciliation.DataSource     = _DataSetMedReconciliationDataList;
             DropDownMedReconciliation.DataBind();
         }
     }
     catch (Exception ex)
     {
     }
 }
예제 #14
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);
            }
        }
예제 #15
0
    /// <summary>
    ///<Author>Sony </Author>
    /// Purpose:To Get the drug Interactions between Medications and Merge the interactions in DataSet accordingly
    /// </summary>
    /// <param name="dsTemp"></param>
    private void getDrugInteraction(Streamline.UserBusinessServices.DataSets.DataSetClientMedications dsTemp)
    {
        try
        {
            CommonFunctions.Event_Trap(this);
            string MedicationIds = "";
            foreach (DataRow dr in dsTemp.ClientMedicationInstructions.Select("isnull(Recorddeleted,'N')<>'Y'"))
            {
                MedicationIds += dr["StrengthId"].ToString() + ",";
            }

            if (MedicationIds.Length > 1)
            {
                MedicationIds = MedicationIds.TrimEnd(',');
            }

            Streamline.UserBusinessServices.ClientMedication objClientMed = new Streamline.UserBusinessServices.ClientMedication();

            DataSet dsTempInteraction = objClientMed.GetClientMedicationDrugInteraction(MedicationIds, ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId, ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId);
            if (dsTempInteraction.Tables.Count > 0)
            {
                createClientMedicationInteraction(dsTempInteraction);
                Streamline.UserBusinessServices.DataSets.DataSetClientMedications dsClientMedicationsTemp = (Streamline.UserBusinessServices.DataSets.DataSetClientMedications)Session["DataSetClientMedications"];
                dsClientMedicationsTemp.ClientAllergiesInteraction.Merge(dsTempInteraction.Tables["ClientAllergyInteraction"]);
            }
        }
        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);
        }
    }
예제 #16
0
 private void BindReconciliationDataDropDown()
 {
     try
     {
         int ClientId = 0;
         ClientId = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
         Streamline.UserBusinessServices.ClientMedication objClientMedications = new Streamline.UserBusinessServices.ClientMedication();
         _DataSetReconciliationDataList = objClientMedications.GetReconciliationDropDown(ClientId);
         if (_DataSetReconciliationDataList.Tables["ReconciliationDropDownList"].Rows.Count > 0)
         {
             DropDownReconciliationSourceFilter.DataValueField = "DocumentVersionId";
             DropDownReconciliationSourceFilter.DataTextField  = "Name";
             DropDownReconciliationSourceFilter.DataSource     = _DataSetReconciliationDataList;
             DropDownReconciliationSourceFilter.DataBind();
         }
     }
     catch (Exception ex)
     {
     }
 }
예제 #17
0
    private void BindHealthDataGraphDropDown()
    {
        DataSet _DataSetHealthDataListGraph = null;

        _DataSetHealthDataListGraph = new DataSet();
        int ClientId = 0;

        ClientId = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
        objectClientMedications = new ClientMedication();
        try
        {
            _DataSetHealthDataListGraph = objectClientMedications.GetHeathDataGraphDropDown(ClientId);
            if (_DataSetHealthDataListGraph.Tables["HealthDataListGraph"].Rows.Count > 0)
            {
                DataView dataViewgraph = _DataSetHealthDataListGraph.Tables["HealthDataListGraph"].DefaultView;
                dataViewgraph.Sort = "ItemDescription ASC";
                DropDownHealthDataListGraph.DataValueField = "HealthDataCategoryId";
                DropDownHealthDataListGraph.DataTextField  = "ItemDescription";
                DropDownHealthDataListGraph.DataSource     = dataViewgraph;
                DropDownHealthDataListGraph.DataBind();
            }
        }
        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);
        }
    }
예제 #18
0
        public void DenySureScriptsRefillRequestsWithNewRx(Int32 SureScriptREfillRequestId, string DenialReasonCode, string DenialReasonText, string UserCode, int PrescriberId)
        {
            string denialMessageId = "RF_DenyNew_" + 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.DenySureScriptsRefillRequestsWithNewRx(SureScriptREfillRequestId, DenialReasonID, GetDenialReasonText, UserCode, denialMessageId);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
예제 #19
0
    private void GetPatientoverviewdetails()
    {
        int Clientid = 0;

        try
        {
            Clientid = (((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId);
            if (Clientid > 0)
            {
                dsPatientoverviewdetails = objectClientMedications.GetPatientoverviewdetails(Clientid);
                _DataSetClientSummary.Tables["ClientInfoAreaHtml"].Clear();
                _DataSetClientSummary.Tables["ClientInfoAreaHtml"].Merge(dsPatientoverviewdetails.Tables["ClientInfoAreaHtml"]);
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }
        finally
        {
            objectClientMedications = null;
        }
    }
예제 #20
0
        /// <summary>
        /// Purpose:This function will be used to Get Client Medication Summary Data
        /// </summary>
        private void GetClientSummaryData()
        {
            try
            {
                objectClientMedications = new ClientMedication();
                objectCommonFunctions   = new ApplicationCommonFunctions();
                CommonFunctions.Event_Trap(this);

                _DataSetClientSummary = new DataSet();

                if (Session["DataSetClientSummary"] != null)
                {
                    _DataSetClientSummary = (DataSet)Session["DataSetClientSummary"];
                }
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }
                else
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }
                if (ex.Data["DatasetInfo"] == null)
                {
                    ex.Data["DatasetInfo"] = _DataSetClientSummary;
                }
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                objectClientMedications = null;
                objectCommonFunctions   = null;
            }
        }
        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;
            }
        }
예제 #22
0
    protected void ButtonOk_Click(object sender, EventArgs e)
    {
        int  PharmacyId     = 0;
        char OrderingMethod = 'F';

        int ScriptReason = -1;

        bool strUpdateDatabase = false;

        try
        {
            CommonFunctions.Event_Trap(this);
            objectClientMedications = new ClientMedication();

            if (RadioButtonFaxToPharmacy.Checked == true)
            {
                OrderingMethod = 'F';
            }
            else
            {
                OrderingMethod = 'P';
            }


            if (OrderingMethod == 'F')
            {
                if (DropDownListPharmacies.SelectedIndex != 0)
                {
                    PharmacyId = Convert.ToInt32(DropDownListPharmacies.SelectedValue.ToString());
                }
            }


            if (DropDownListScriptReason.SelectedIndex != 0)
            {
                ScriptReason = Convert.ToInt32(DropDownListScriptReason.SelectedValue.ToString());
            }

            //ClientMedicationScriptActivityId = objectClientMedications.InsertIntoClientMedicationScriptActivities(Convert.ToInt32(HiddenFieldLatestClientMedicationScriptId.Value), OrderingMethod, PharmacyId, ScriptReason, CreatedBy);
            //Send Fax for non-controlled medications if ordering Method is Fax
            if (OrderingMethod == 'F')
            {
                if (HiddenFieldOrderMethod.Value.IndexOf("Faxed") < 0 && HiddenFieldOrderMethod.Value.IndexOf("F") < 0)
                {
                    strUpdateDatabase = SendToPrinter(ScriptReason, PharmacyId);
                    ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "alert('Some Medications could not be Faxed,Please review script History!');", true);
                }
                strUpdateDatabase = SendToFax(ScriptReason, PharmacyId);
            }

            if (strUpdateDatabase)
            {
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "closeDiv();", true);
            }
            else
            {
                string strErrorMessage = "Error in Updating Database";
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
            }
        }


        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "Source function ButtonOk_Click 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);

            string strErrorMessage = "Error in Updating Database";
            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
        }
        finally
        {
            DataSetClientScriptActivities = null;
        }
    }
예제 #23
0
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();
        dsClientPharmacies      = new DataSet();
        try
        {
            CommonFunctions.Event_Trap(this);
            dsClientPharmacies.Merge(objectClientMedications.GetClientPharmacies(
                                         Convert.ToInt32(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId), false, HiddenPreferredPharmacy1.Value, HiddenPreferredPharmacy2.Value, HiddenPreferredPharmacy3.Value));
            //Add New Row
            if (dsClientPharmacies != null && dsClientPharmacies.Tables["ClientPharmacies"].Rows.Count == 0)
            {
                DataRow drClientPharmacies = dsClientPharmacies.Tables["ClientPharmacies"].NewRow();
                if (HiddenPreferredPharmacy1.Value != "0")
                {
                    drClientPharmacies["ClientId"]       = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
                    drClientPharmacies["SequenceNumber"] = 1;
                    drClientPharmacies["PharmacyId"]     = Convert.ToInt32(HiddenPreferredPharmacy1.Value);
                    if (Request.QueryString["ExternalReferenceId"] != null)
                    {
                        drClientPharmacies["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                    }
                    drClientPharmacies["CreatedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies["CreatedDate"]   = DateTime.Now.ToShortDateString();
                    drClientPharmacies["RowIdentifier"] = System.Guid.NewGuid();
                    drClientPharmacies["ModifiedBy"]    = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies["ModifiedDate"]  = DateTime.Now.ToShortDateString();
                    dsClientPharmacies.Tables["ClientPharmacies"].Rows.Add(drClientPharmacies);
                }
                if (HiddenPreferredPharmacy2.Value != "0")
                {
                    drClientPharmacies                   = null;
                    drClientPharmacies                   = dsClientPharmacies.Tables["ClientPharmacies"].NewRow();
                    drClientPharmacies["ClientId"]       = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
                    drClientPharmacies["SequenceNumber"] = 2;
                    drClientPharmacies["PharmacyId"]     = Convert.ToInt32(HiddenPreferredPharmacy2.Value);
                    if (Request.QueryString["ExternalReferenceId"] != null)
                    {
                        drClientPharmacies["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                    }
                    drClientPharmacies["CreatedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies["CreatedDate"]   = DateTime.Now.ToShortDateString();
                    drClientPharmacies["RowIdentifier"] = System.Guid.NewGuid();
                    drClientPharmacies["ModifiedBy"]    = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies["ModifiedDate"]  = DateTime.Now.ToShortDateString();
                    dsClientPharmacies.Tables["ClientPharmacies"].Rows.Add(drClientPharmacies);
                }
                if (HiddenPreferredPharmacy3.Value != "0")
                {
                    drClientPharmacies                   = null;
                    drClientPharmacies                   = dsClientPharmacies.Tables["ClientPharmacies"].NewRow();
                    drClientPharmacies["ClientId"]       = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
                    drClientPharmacies["SequenceNumber"] = 3;
                    drClientPharmacies["PharmacyId"]     = Convert.ToInt32(HiddenPreferredPharmacy3.Value);
                    if (Request.QueryString["ExternalReferenceId"] != null)
                    {
                        drClientPharmacies["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                    }
                    drClientPharmacies["CreatedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies["CreatedDate"]   = DateTime.Now.ToShortDateString();
                    drClientPharmacies["RowIdentifier"] = System.Guid.NewGuid();
                    drClientPharmacies["ModifiedBy"]    = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies["ModifiedDate"]  = DateTime.Now.ToShortDateString();
                    dsClientPharmacies.Tables["ClientPharmacies"].Rows.Add(drClientPharmacies);
                }
            }
            //Edit Present Data
            //Added by Loveena in ref to task#187 to allow null enteries for Preferred Pharmacies.
            else if (dsClientPharmacies != null && dsClientPharmacies.Tables["ClientPharmacies"].Rows.Count > 0)
            {
                DataRow[] _drClientPharmacies1 = dsClientPharmacies.Tables["ClientPharmacies"].Select("ClientId=" + ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId + " and SequenceNumber=1");
                if (_drClientPharmacies1.Length > 0)
                {
                    if (HiddenPreferredPharmacy1.Value != "0" && HiddenPreferredPharmacy1.Value != "")
                    {
                        _drClientPharmacies1[0]["PharmacyId"] = Convert.ToInt32(HiddenPreferredPharmacy1.Value);
                        if (Request.QueryString["ExternalReferenceId"] != null)
                        {
                            _drClientPharmacies1[0]["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                        }
                    }
                    else
                    {
                        _drClientPharmacies1[0]["RecordDeleted"] = "Y";
                        _drClientPharmacies1[0]["DeletedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                        _drClientPharmacies1[0]["DeletedDate"]   = DateTime.Now.ToShortDateString();
                    }
                }
                else if (_drClientPharmacies1.Length == 0 && HiddenPreferredPharmacy1.Value != "0")
                {
                    DataRow drClientPharmacies1 = dsClientPharmacies.Tables["ClientPharmacies"].NewRow();
                    drClientPharmacies1["ClientId"]       = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
                    drClientPharmacies1["SequenceNumber"] = 1;
                    drClientPharmacies1["PharmacyId"]     = Convert.ToInt32(HiddenPreferredPharmacy1.Value);
                    if (Request.QueryString["ExternalReferenceId"] != null)
                    {
                        drClientPharmacies1["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                    }
                    drClientPharmacies1["CreatedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies1["CreatedDate"]   = DateTime.Now.ToShortDateString();
                    drClientPharmacies1["RowIdentifier"] = System.Guid.NewGuid();
                    drClientPharmacies1["ModifiedBy"]    = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies1["ModifiedDate"]  = DateTime.Now.ToShortDateString();
                    dsClientPharmacies.Tables["ClientPharmacies"].Rows.Add(drClientPharmacies1);
                }
                DataRow[] _drClientPharmacies2 = dsClientPharmacies.Tables["ClientPharmacies"].Select("ClientId=" + ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId + " and SequenceNumber=2");
                if (_drClientPharmacies2.Length > 0)
                {
                    if (HiddenPreferredPharmacy2.Value != "0" && HiddenPreferredPharmacy2.Value != "")
                    {
                        _drClientPharmacies2[0]["PharmacyId"] = Convert.ToInt32(HiddenPreferredPharmacy2.Value);
                        if (Request.QueryString["ExternalReferenceId"] != null)
                        {
                            _drClientPharmacies2[0]["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                        }
                    }
                    else
                    {
                        _drClientPharmacies2[0]["RecordDeleted"] = "Y";
                        _drClientPharmacies2[0]["DeletedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                        _drClientPharmacies2[0]["DeletedDate"]   = DateTime.Now.ToShortDateString();
                    }
                }
                else if (_drClientPharmacies2.Length == 0 && HiddenPreferredPharmacy2.Value != "0")
                {
                    DataRow drClientPharmacies2 = dsClientPharmacies.Tables["ClientPharmacies"].NewRow();
                    drClientPharmacies2                   = dsClientPharmacies.Tables["ClientPharmacies"].NewRow();
                    drClientPharmacies2["ClientId"]       = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
                    drClientPharmacies2["SequenceNumber"] = 2;
                    drClientPharmacies2["PharmacyId"]     = Convert.ToInt32(HiddenPreferredPharmacy2.Value);
                    if (Request.QueryString["ExternalReferenceId"] != null)
                    {
                        drClientPharmacies2["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                    }
                    drClientPharmacies2["CreatedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies2["CreatedDate"]   = DateTime.Now.ToShortDateString();
                    drClientPharmacies2["RowIdentifier"] = System.Guid.NewGuid();
                    drClientPharmacies2["ModifiedBy"]    = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies2["ModifiedDate"]  = DateTime.Now.ToShortDateString();
                    dsClientPharmacies.Tables["ClientPharmacies"].Rows.Add(drClientPharmacies2);
                }
                DataRow[] _drClientPharmacies3 = dsClientPharmacies.Tables["ClientPharmacies"].Select("ClientId=" + ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId + " and SequenceNumber=3");
                if (_drClientPharmacies3.Length > 0)
                {
                    if (HiddenPreferredPharmacy3.Value != "0" && HiddenPreferredPharmacy3.Value != "")
                    {
                        _drClientPharmacies3[0]["PharmacyId"] = Convert.ToInt32(HiddenPreferredPharmacy3.Value);
                        if (Request.QueryString["ExternalReferenceId"] != null)
                        {
                            _drClientPharmacies3[0]["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                        }
                    }
                    else
                    {
                        _drClientPharmacies3[0]["RecordDeleted"] = "Y";
                        _drClientPharmacies3[0]["DeletedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                        _drClientPharmacies3[0]["DeletedDate"]   = DateTime.Now.ToShortDateString();
                    }
                }
                else if (_drClientPharmacies3.Length == 0 && HiddenPreferredPharmacy3.Value != "0")
                {
                    DataRow drClientPharmacies3 = dsClientPharmacies.Tables["ClientPharmacies"].NewRow();
                    drClientPharmacies3                   = dsClientPharmacies.Tables["ClientPharmacies"].NewRow();
                    drClientPharmacies3["ClientId"]       = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;
                    drClientPharmacies3["SequenceNumber"] = 3;
                    drClientPharmacies3["PharmacyId"]     = Convert.ToInt32(HiddenPreferredPharmacy2.Value);
                    if (Request.QueryString["ExternalReferenceId"] != null)
                    {
                        drClientPharmacies3["ExternalReferenceId"] = Request.QueryString["ExternalReferenceId"];
                    }
                    drClientPharmacies3["CreatedBy"]     = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies3["CreatedDate"]   = DateTime.Now.ToShortDateString();
                    drClientPharmacies3["RowIdentifier"] = System.Guid.NewGuid();
                    drClientPharmacies3["ModifiedBy"]    = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode;
                    drClientPharmacies3["ModifiedDate"]  = DateTime.Now.ToShortDateString();
                    dsClientPharmacies.Tables["ClientPharmacies"].Rows.Add(drClientPharmacies3);
                }
            }

            //Commented by Loveena in ref to task#187 to allow null enteries for Preferred Pharmacies.
            //Edit Present Data;
            //if (dsClientPharmacies.Tables["ClientPharmacies"].Rows.Count > 0)
            //{
            //    DataRow[] _drClientPharmacies = dsClientPharmacies.Tables["ClientPharmacies"].Select("ClientId=" + ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId);
            //    if (_drClientPharmacies.Length > 0)
            //    {
            //        _drClientPharmacies[0]["PharmacyId"] = Convert.ToInt32(HiddenPreferredPharmacy1.Value);
            //        _drClientPharmacies[1]["PharmacyId"] = Convert.ToInt32(HiddenPreferredPharmacy2.Value);
            //    }

            //}
            //Commented Code Ends over here.
            //Code added in ref to Task#85 - Sure Scripts
            if (HiddenPreferredPharmacy1.Value != "0")
            {
                DataRow[] drPharmacy = dsClientPharmacies.Tables["Pharmacies"].Select("PharmacyId=" + Convert.ToInt32(HiddenPreferredPharmacy1.Value));
                if (drPharmacy.Length > 0)
                {
                    if (drPharmacy[0]["PreferredPharmacy"] != "Y")
                    {
                        drPharmacy[0]["PreferredPharmacy"] = "Y";
                    }
                }
            }
            if (HiddenPreferredPharmacy2.Value != "0")
            {
                DataRow[] drPharmacy = dsClientPharmacies.Tables["Pharmacies"].Select("PharmacyId=" + Convert.ToInt32(HiddenPreferredPharmacy2.Value));
                if (drPharmacy.Length > 0)
                {
                    if (drPharmacy[0]["PreferredPharmacy"] != "Y")
                    {
                        drPharmacy[0]["PreferredPharmacy"] = "Y";
                    }
                }
            }
            if (HiddenPreferredPharmacy3.Value != "0")
            {
                DataRow[] drPharmacy = dsClientPharmacies.Tables["Pharmacies"].Select("PharmacyId=" + Convert.ToInt32(HiddenPreferredPharmacy3.Value));
                if (drPharmacy.Length > 0)
                {
                    if (drPharmacy[0]["PreferredPharmacy"] != "Y")
                    {
                        drPharmacy[0]["PreferredPharmacy"] = "Y";
                    }
                }
            }
            objectClientMedications.UpdateDocuments(dsClientPharmacies);
            objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();

            //#ka02022014 dsClientPharmacies = objectClientMedications.GetClientPharmacies(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId);



            //After saving the dsClientPharmacies
            //Again fetch the Client pharmacies data
            //and merge the same in DataSetClientSummary
            //and store same in session["DataSetClientSummary"]

            _DataSetClientSummary = (DataSet)Session["DataSetClientSummary"];
            _DataSetClientSummary.Tables["ClientPharmacies"].Clear();
            _DataSetClientSummary.Tables["ClientPharmacies"].Merge(dsClientPharmacies.Tables["ClientPharmacies"]);
            GetPatientoverviewdetails();
            Session["DataSetClientSummary"] = _DataSetClientSummary;
            //call ClosePharmaciesDiv(true)
            ScriptManager.RegisterStartupScript(LabelClientName, LabelClientName.GetType(), "key", "closeDivPharmacies(true);", true);
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            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);
        }
    }
    public void BindControl()
    {
        DataSet   dSClientEducationResources = null;
        DataTable dtClientEducationResources = null;
        string    reportUrl = null;
        DataSet   ds        = null;
        string    clientId  = null;

        try
        {
            var _ReportName = Request.QueryString["reportName"];

            Streamline.UserBusinessServices.ClientMedication ObjClientMedication = new Streamline.UserBusinessServices.ClientMedication();
            ds = ObjClientMedication.GetSystemReports(_ReportName);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    reportUrl = ds.Tables[0].Rows[0]["ReportUrl"].ToString();
                }
            }

            if (!_ReportName.IsNullOrWhiteSpace())
            {
                clientId = (((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId).ToString();

                if (reportUrl.IndexOf("<SessionId>") > -1)
                {
                    string selectedMedicationIds = Request.QueryString["medicationIds"];

                    Guid sessionId = Guid.NewGuid();
                    System.Data.SqlClient.SqlParameter[] reportParameters = null;

                    var dtMedicationIds = new DataTable();
                    dtMedicationIds.Columns.Add(new DataColumn("Value"));
                    dtMedicationIds.Columns.Add(new DataColumn("Type"));
                    DataRow dr;
                    if (!string.IsNullOrEmpty(selectedMedicationIds))
                    {
                        foreach (var medicationId in selectedMedicationIds.Split(','))
                        {
                            dr          = dtMedicationIds.NewRow();
                            dr["Value"] = medicationId;
                            dr["Type"]  = "Integer";
                            dtMedicationIds.Rows.Add(dr);
                        }
                    }

                    var objUserInfo = new UserInfo();
                    objUserInfo.InsertReport(sessionId, dtMedicationIds, "");

                    reportUrl     = reportUrl.Replace("<SessionId>", sessionId.ToString());
                    parameters    = new ReportParameter[1];
                    parameters[0] = new ReportParameter("SessionId", sessionId.ToString());
                    writeByteArray(reportUrl);
                }
                else
                {
                    switch (_ReportName)
                    {
                    case "Medications - Current":
                        reportUrl     = reportUrl.Replace("<ClientId>", clientId);
                        parameters    = new ReportParameter[1];
                        parameters[0] = new ReportParameter("ClientId", clientId);
                        writeByteArray(reportUrl);
                        break;

                    case "Medication Card":
                        reportUrl     = reportUrl.Replace("<ClientId>", clientId);
                        parameters    = new ReportParameter[1];
                        parameters[0] = new ReportParameter("ClientId", clientId);
                        writeByteArray(reportUrl);
                        break;

                    case "Medications - View History":
                        reportUrl     = reportUrl.Replace("<ClientId>", clientId);
                        reportUrl     = reportUrl.Replace("<StartDate>", Request.QueryString["StartDate"]);
                        reportUrl     = reportUrl.Replace("<EndDate>", Request.QueryString["EndDate"]);
                        reportUrl     = reportUrl.Replace("<ExpandCollapseAll>", Request.QueryString["ExpandCollapseAll"]);
                        parameters    = new ReportParameter[4];
                        parameters[0] = new ReportParameter("ClientId", clientId);
                        parameters[1] = new ReportParameter("StartDate", Request.QueryString["StartDate"]);
                        parameters[2] = new ReportParameter("EndDate", Request.QueryString["EndDate"]);
                        parameters[3] = new ReportParameter("ExpandCollapseAll", Request.QueryString["ExpandCollapseAll"]);
                        writeByteArray(reportUrl);
                        break;

                    case "ClientHistory":
                        reportUrl     = reportUrl.Replace("<ClientId>", clientId);
                        parameters    = new ReportParameter[1];
                        parameters[0] = new ReportParameter("ClientId", clientId);
                        writeByteArray(reportUrl);
                        break;

                    case "Medications - View Client Consent History":
                        string _medicationNameId = Request.QueryString["MedicationNameId"];
                        if (_medicationNameId == "null")
                        {
                            _medicationNameId = "0";
                        }
                        reportUrl     = reportUrl.Replace("<ClientId>", clientId);
                        reportUrl     = reportUrl.Replace("<StartDate>", Request.QueryString["StartDate"]);
                        reportUrl     = reportUrl.Replace("<EndDate>", Request.QueryString["EndDate"]);
                        reportUrl     = reportUrl.Replace("<MedicationNameId>", _medicationNameId);
                        parameters    = new ReportParameter[4];
                        parameters[0] = new ReportParameter("ClientId", clientId);
                        parameters[1] = new ReportParameter("StartDate", Request.QueryString["StartDate"]);
                        parameters[2] = new ReportParameter("EndDate", Request.QueryString["EndDate"]);
                        parameters[3] = new ReportParameter("MedicationNameId", _medicationNameId);
                        writeByteArray(reportUrl);
                        break;

                    default:
                        try
                        {
                            reportUrl     = reportUrl.Replace("<ClientId>", clientId);
                            parameters    = new ReportParameter[1];
                            parameters[0] = new ReportParameter("ClientId", clientId);
                            writeByteArray(reportUrl);
                        }
                        catch (Exception ex)
                        {
                            Response.End();
                        }
                        break;
                        return;
                    }
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ErrorReport", "alert('Failed to load report.\\nPlease check the report server settings or contact your system administrator.');window.close();", true);
            }
        }
        catch (ArgumentOutOfRangeException ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ErrorReport", "alert('Failed to load report.\\nPlease check the report server settings or contact your system administrator.');window.close();", true);
        }
        catch (System.Threading.ThreadAbortException)
        {
        }
        catch (Exception ex)
        {
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ErrorReport", "alert('Failed to load report. Some unknown error occured. \\nPlease check the log for detail error or contact your system administrator.');window.close();", true);
        }
        finally
        {
            if (dSClientEducationResources != null)
            {
                dSClientEducationResources.Dispose();
            }
            if (dtClientEducationResources != null)
            {
                dtClientEducationResources.Dispose();
            }
        }
    }
    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
    }
예제 #26
0
    /// <summary>
    /// Purpose:This function will be used to Get Client Medication Summary Data
    /// </summary>
    private void GetClientSummaryData()
    {
        Streamline.UserBusinessServices.DataSets.DataSetClientMedications DataSetClientMedications;

        try
        {
            objectClientMedications = new ClientMedication();
            //objectCommonFunctions = new ApplicationCommonFunctions();
            CommonFunctions.Event_Trap(this);
            string _ClientRowIdentifier    = "";
            string _ClinicianrowIdentifier = "";

            DataSetClientMedications = new Streamline.UserBusinessServices.DataSets.DataSetClientMedications();
            try
            {
                _ClinicianrowIdentifier = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).ClinicianRowIdentifier;
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }

                string ParseMessage = ex.Message;
                if (ParseMessage.Contains("Object") == true)
                {
                    throw new Exception("Session Expired");
                }
            }
            _ClientRowIdentifier = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientRowIdentifier;

            if (_ClientRowIdentifier != "" && _ClinicianrowIdentifier != "")
            {
                _DataSetClientSummary = objectClientMedications.DownloadClientMedicationSummary(_ClientRowIdentifier, _ClinicianrowIdentifier);
                Session["DataSetClientMedications"]           = null;
                Session["DataSetPrescribedClientMedications"] = null;//Added As per task#3323 By Pradeep on 4 March 2011
                Session["DataSetClientSummary"] = _DataSetClientSummary;

                DataSetClientMedications.EnforceConstraints = false;
                DataSetClientMedications.Tables["ClientMedications"].Merge(_DataSetClientSummary.Tables["ClientMedications"]);
                DataSetClientMedications.Tables["ClientMedicationInstructions"].Merge(_DataSetClientSummary.Tables["ClientMedicationInstructions"]);

                //Activate the MedicationClientPersonalInformation Control
                //MedicationClientPersonalInformation1.showEditableAllergyList = true;
                //MedicationClientPersonalInformation1.Activate();
                //LabelClientName.Text = "";
                //LabelClientName.Text = _DataSetClientSummary.Tables["ClientInformation"].Rows[0]["ClientInformationLabel"].ToString(); //DataSetClientSummary.Tables["ClientInformation"].Rows[0]["ClientInformationLabel"].ToString();
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = _DataSetClientSummary;
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            objectClientMedications = null;
            //objectCommonFunctions = null;
        }
    }
예제 #27
0
    //Added By Anuj on 25 Nov,2009 for task ref #34 SDI venture -10
    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();
            objectClientMedications = new ClientMedication();
            Table tblHealthdata = new Table();
            tblHealthdata.ID    = System.Guid.NewGuid().ToString();
            tblHealthdata.Width = new Unit(100, UnitType.Percentage);
            TableHeaderRow  thTitle         = new TableHeaderRow();
            TableHeaderCell thcBlank1       = 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);
            //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    = 120;

            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.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.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.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.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.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.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(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 = "<script id='HealthDataListScript' type='text/javascript'>";
            myscript += "function $deleteRecord(sender,e){";
            if (!string.IsNullOrEmpty(_deleteRowMessage))
            {
                // myscript += " if(confirm('" + _deleteRowMessage + " ')==true){ " + this._onDeleteEventHandler + "(sender,e);  }}";
                myscript += 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              = this.ClientID + this.ClientIDSeparator + trHealthDataRow.ClientID;
                    string    tableId            = this.ClientID + this.ClientIDSeparator + 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");
                    imgTemp.Attributes.Add("onClick", "onHealthDataDeleteClick('" + healthDataId + "','" + tableId + "','" + rowId + "')");
                    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);

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

                    TableCell tdItemValue1 = new TableCell();
                    //tdItemValue1.CssClass = "textbolditalic";
                    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);
                    }


                    TableCell tdItemValue2 = new TableCell();
                    //tdItemValue2.CssClass = "textbolditalic";
                    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);
                    }

                    TableCell tdItemValue3 = new TableCell();
                    //tdItemValue3.CssClass = "textbolditalic";
                    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);
                    }
                    TableCell tdItemValue4 = new TableCell();
                    //tdItemValue4.CssClass = "textbolditalic";
                    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);
                    }
                    TableCell tdItemValue5 = new TableCell();
                    //tdItemValue5.CssClass = "textbolditalic";
                    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);
                    }

                    TableCell tdItemValue6 = new TableCell();
                    //tdItemValue6.CssClass = "textbolditalic";
                    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);
                    }

                    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>";
            ScriptManager.RegisterStartupScript(DropDownHealthDataCategory, DropDownHealthDataCategory.GetType(), DropDownHealthDataCategory.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);
        }
    }
예제 #28
0
    /// <summary>
    /// Handles the Click event of the btnSelect control.
    /// On click of this button sets the client id and name of client and closes the form.
    /// <Author>Author: Sandeep Kumar Trivedi</Author>
    /// <CreatedDate>Date: 22-June-07</CreatedDate>
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSelect_Click(object sender, EventArgs e)
    {
        Streamline.UserBusinessServices.DataSets.DataSetClientAllergies DataSetClientAllergies;
        DataView    DataViewClientAllergies;
        DataRowView DataRowClientAllergies;

        Streamline.UserBusinessServices.ClientMedication objectClientMedications;
        DataSet DataSetFinal;

        try
        {
            string selectedValue = Request.Form["HiddenAllergyId"].ToString();
            DataSetClientAllergies  = new Streamline.UserBusinessServices.DataSets.DataSetClientAllergies();
            DataViewClientAllergies = DataSetClientAllergies.Tables["ClientAllergies"].DefaultView;

            DataViewClientAllergies.AddNew();
            DataRowClientAllergies = DataViewClientAllergies[0];

            DataRowClientAllergies["ClientAllergyId"] = 0;
            // DataRowClientAllergies["ClientId"] = Convert.ToInt32(Streamline.UserBusinessServices.ApplicationCommonFunctions._ClientId);
            DataRowClientAllergies["ClientId"] = 102786;


            DataRowClientAllergies["AllergenConceptId"] = selectedValue;
            DataRowClientAllergies["CreatedBy"]         = Convert.ToInt32(Streamline.UserBusinessServices.ApplicationCommonFunctions._StaffRowID);
            DataRowClientAllergies["CreatedDate"]       = DateTime.Now;
            DataRowClientAllergies["ModifiedBy"]        = Convert.ToInt32(Streamline.UserBusinessServices.ApplicationCommonFunctions._StaffRowID);
            DataRowClientAllergies["ModifiedDate"]      = DateTime.Now;
            DataRowClientAllergies["RecordDeleted"]     = 'N';
            DataRowClientAllergies["RowIdentifier"]     = System.Guid.NewGuid();
            DataRowClientAllergies.EndEdit();
            objectClientMedications = new Streamline.UserBusinessServices.ClientMedication();
            DataSetFinal            = objectClientMedications.UpdateClientAllergies(DataSetClientAllergies, ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserId, ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).UserCode);

            string script = "<script language='javascript'>\n";
            script += "AllergySearch.closeDiv(1);";
            script += "</script>";
            RegisterStartupScript("CloseWindow", script);
        }
        //Exception ex added by Pratap on 29th June 2007
        catch (Exception ex)
        {
            // Added by Pratap In order to Implement Exception Management functionality on 29th June 2007
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "";
            }

            string ParseMessage = ex.Message;
            if (ParseMessage.IndexOf("System.Data.SqlClient.SqlException:") > 0)
            {
                int SubstringLen = ParseMessage.IndexOf("\n") - ParseMessage.IndexOf("System.Data.SqlClient.SqlException:");
                ParseMessage = ParseMessage.Substring(ParseMessage.IndexOf("System.Data.SqlClient.SqlException:") + 35, SubstringLen - 35);
                ShowError(ParseMessage, true);
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            DataViewClientAllergies = null;
            DataSetClientAllergies  = null;
            DataRowClientAllergies  = null;
        }
    }
예제 #29
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
    }
    private void CreateControls()
    {
        try
        {
            objClientMedications = new ClientMedication();
            CommonFunctions.Event_Trap(this);

            PanelHarborConsent.Controls.Clear();
            Table tblHarborStandardConsent = new Table();
            tblHarborStandardConsent.ID = System.Guid.NewGuid().ToString();

            tblHarborStandardConsent.Width = new Unit(98, UnitType.Percentage);


            string myscript = "<script id='HarborStandarConsent' type='text/javascript'>";
            myscript += "function RegisterMedicationListControlEvents(){try{ ";

            DataSet DataSetClientMedications = new DataSet();
            if (Session["DataSetClientMedications"] != null)
            {
                DataSetClientMedications = (DataSet)Session["DataSetClientMedications"];

                foreach (DataRow drMedication in DataSetClientMedications.Tables["ClientMedications"].Rows)
                {
                    string   newId  = System.Guid.NewGuid().ToString();
                    string   tblId  = this.ClientID + this.ClientIDSeparator + tblHarborStandardConsent.ClientID;
                    TableRow trTemp = new TableRow();
                    trTemp.ID = "Tr_" + newId;

                    TableCell tdMedication = new TableCell();
                    tdMedication.Text     = "Medication";
                    tdMedication.CssClass = "labelFont";
                    //tdMedication.Width = new Unit(20, UnitType.Pixel);

                    TableCell tdMedicationName = new TableCell();
                    tdMedicationName.Text = drMedication["MedicationName"].ToString();
                    //tdMedicationName.Wrap = false;
                    tdMedicationName.CssClass = "LabelClaimline";
                    //tdMedicationName.Width = new Unit(100, UnitType.Pixel);

                    trTemp.Cells.Add(tdMedication);
                    trTemp.Cells.Add(tdMedicationName);

                    tblHarborStandardConsent.Rows.Add(trTemp);

                    DataRow[] _drMedicationInstructions = DataSetClientMedications.Tables["ClientMedicationInstructions"].Select("ClientMedicationId=" + Convert.ToInt32(drMedication["ClientMedicationId"]));

                    TableCell tdInstructions = new TableCell();
                    tdInstructions.Text     = "Instructions";
                    tdInstructions.CssClass = "labelFont";
                    //tdInstructions.Width = new Unit(20, UnitType.Pixel);

                    TableCell tdInstructionsText = new TableCell();
                    tdInstructionsText.Text = _drMedicationInstructions[0]["Instruction"].ToString();
                    //tdInstructionsText.Wrap = false;
                    tdInstructionsText.CssClass = "LabelClaimline";
                    //tdInstructionsText.Width = new Unit(150, UnitType.Pixel);

                    TableCell tdFrom = new TableCell();
                    tdFrom.Text     = "From";
                    tdFrom.CssClass = "labelFont";
                    //tdFrom.Width = new Unit(20, UnitType.Pixel);

                    TableCell tdFromDate = new TableCell();
                    if (_drMedicationInstructions[0]["StartDate"] != System.DBNull.Value)
                    {
                        tdFromDate.Text = Convert.ToDateTime(_drMedicationInstructions[0]["StartDate"]).ToString("MM/dd/yyyy");
                    }
                    tdFromDate.CssClass = "LabelClaimline";
                    //tdFromDate.Width = new Unit(50, UnitType.Pixel);
                    //tdFromDate.Wrap = false;

                    TableCell tdTo = new TableCell();
                    tdTo.Text     = "To";
                    tdTo.CssClass = "labelFont";
                    //tdTo.Width = new Unit(20, UnitType.Pixel);

                    TableCell tdToDate = new TableCell();
                    if (_drMedicationInstructions[0]["EndDate"] != System.DBNull.Value)
                    {
                        tdToDate.Text = Convert.ToDateTime(_drMedicationInstructions[0]["EndDate"]).ToString("MM/dd/yyyy");
                    }
                    tdToDate.CssClass = "LabelClaimline";
                    //tdToDate.Width = new Unit(50, UnitType.Pixel);
                    //tdToDate.Wrap = false;

                    trTemp.Cells.Add(tdInstructions);
                    trTemp.Cells.Add(tdInstructionsText);
                    trTemp.Cells.Add(tdFrom);
                    trTemp.Cells.Add(tdFromDate);
                    trTemp.Cells.Add(tdTo);
                    trTemp.Cells.Add(tdToDate);

                    tblHarborStandardConsent.Rows.Add(trTemp);

                    if (_drMedicationInstructions.Length > 1)
                    {
                        for (int index = 1; index < _drMedicationInstructions.Length; index++)
                        {
                            TableCell tdDummy = new TableCell();
                            tdDummy.ColumnSpan = 2;

                            TableCell tdInstructionsNewRow = new TableCell();
                            tdInstructionsNewRow.Text     = "Instructions";
                            tdInstructionsNewRow.CssClass = "labelFont";
                            //tdInstructionsNewRow.Width = new Unit(20, UnitType.Pixel);

                            TableCell tdInstructionsTextNewRow = new TableCell();
                            tdInstructionsTextNewRow.Text = _drMedicationInstructions[index]["Instruction"].ToString();
                            //tdInstructionsTextNewRow.Wrap = false;
                            tdInstructionsTextNewRow.CssClass = "LabelClaimline";
                            //tdInstructionsTextNewRow.Width = new Unit(150, UnitType.Pixel);

                            TableCell tdFromNewRow = new TableCell();
                            tdFromNewRow.Text     = "From";
                            tdFromNewRow.CssClass = "labelFont";

                            TableCell tdFromDateNewRow = new TableCell();
                            if (_drMedicationInstructions[index]["StartDate"] != System.DBNull.Value)
                            {
                                tdFromDateNewRow.Text = Convert.ToDateTime(_drMedicationInstructions[index]["StartDate"]).ToShortDateString();
                            }
                            //tdFromDateNewRow.Wrap = false;
                            tdFromDateNewRow.CssClass = "LabelClaimline";
                            //tdFromDateNewRow.Width = new Unit(50, UnitType.Pixel);

                            TableCell tdToNewRow = new TableCell();
                            tdToNewRow.Text     = "To";
                            tdToNewRow.CssClass = "labelFont";

                            TableCell tdToDateNewRow = new TableCell();
                            if (_drMedicationInstructions[index]["EndDate"] != System.DBNull.Value)
                            {
                                tdToDateNewRow.Text = Convert.ToDateTime(_drMedicationInstructions[index]["EndDate"]).ToShortDateString();
                            }
                            //tdToDateNewRow.Wrap = false;
                            tdToDateNewRow.CssClass = "LabelClaimline";
                            //tdToDateNewRow.Width = new Unit(50, UnitType.Pixel);

                            TableRow trTempInstuctions = new TableRow();
                            trTempInstuctions.ID = "Tr_" + newId;

                            trTempInstuctions.Cells.Add(tdDummy);
                            trTempInstuctions.Cells.Add(tdInstructionsNewRow);
                            trTempInstuctions.Cells.Add(tdInstructionsTextNewRow);
                            trTempInstuctions.Cells.Add(tdFromNewRow);
                            trTempInstuctions.Cells.Add(tdFromDateNewRow);
                            trTempInstuctions.Cells.Add(tdToNewRow);
                            trTempInstuctions.Cells.Add(tdToDateNewRow);

                            tblHarborStandardConsent.Rows.Add(trTempInstuctions);
                        }
                    }



                    TableRow trTempSideEffects = new TableRow();
                    trTempSideEffects.ID = "Tr_" + newId;

                    TableCell tdSideEffects = new TableCell();
                    tdSideEffects.Text     = "Common Side Effects";
                    tdSideEffects.CssClass = "labelFont";

                    TextBox txtCommonsideEffects = new TextBox();
                    txtCommonsideEffects.TextMode = TextBoxMode.MultiLine;
                    txtCommonsideEffects.Height   = new Unit(70, UnitType.Percentage);;
                    txtCommonsideEffects.Width    = new Unit(98, UnitType.Percentage);
                    txtCommonsideEffects.ReadOnly = true;
                    txtCommonsideEffects.Style.Add("font-family", "Microsoft Sans Serif");
                    if (DataSetClientMedications.Tables.Contains("PatientMonographId"))
                    {
                        if (DataSetClientMedications.Tables["PatientMonographId"].Rows.Count > 0)
                        {
                            DataRow[] _drPatientMonographText = DataSetClientMedications.Tables["PatientMonographId"].Select("ClientMedicationId=" + Convert.ToInt32(drMedication["ClientMedicationId"]));
                            if (_drPatientMonographText.Length > 0)
                            {
                                DataSet DataSetPatientEducationMonographText = null;
                                DataSetPatientEducationMonographText = objClientMedications.GetPatientEducationMonographSideEffects(Convert.ToInt32(_drPatientMonographText[0]["PatientEducationMonographId"]));
                                if (DataSetPatientEducationMonographText.Tables[0].Rows.Count > 0)
                                {
                                    txtCommonsideEffects.Text = DataSetPatientEducationMonographText.Tables[0].Rows[0]["FormattedSideEffectsText"].ToString();
                                }
                            }
                        }
                    }
                    TableCell tdSideEffectsText = new TableCell();
                    tdSideEffectsText.EnableTheming = false;
                    tdSideEffectsText.Controls.Add(txtCommonsideEffects);
                    tdSideEffectsText.ColumnSpan = 6;

                    TableRow  trLine           = new TableRow();
                    TableCell tdHorizontalLine = new TableCell();
                    tdHorizontalLine.ColumnSpan = 8;
                    tdHorizontalLine.Width      = new Unit(100, UnitType.Percentage);
                    tdHorizontalLine.Height     = new Unit(20, UnitType.Pixel);
                    trLine.Cells.Add(tdHorizontalLine);

                    trTempSideEffects.Cells.Add(tdSideEffects);
                    trTempSideEffects.Cells.Add(tdSideEffectsText);
                    tblHarborStandardConsent.Rows.Add(trTempSideEffects);
                    tblHarborStandardConsent.Rows.Add(trLine);
                }
            }

            PanelHarborConsent.Controls.Add(tblHarborStandardConsent);
            myscript += "}catch(e){  Streamline.SmartClient.ExceptionManager.getInstance().publishException(ERROR_CODE_REGULAR, e);}}</script>";
            //Page.ClientScript.re

            //if (!Page.ClientScript.IsClientScriptBlockRegistered("MedicationListScript"))
            Page.RegisterClientScriptBlock(this.ClientID, myscript);
            //    Page.ClientScript.RegisterStartupScript(this.GetType(), "MedicationListScript", myscript);
        }
        catch (Exception ex)
        {
        }
    }