/// <summary>
        /// <Description>Used to Assign data to the controls on the page</Description>
        /// <Author>Pradeep</Author>
        /// <CreatedOn>29 Oct 2009</CreatedOn>
        /// </summary>
        public override void Activate()
        {
            try
            {
                Session["DataSetClientMedicationsHistory"] = null;
                this.TextBoxConsentStartDate.Attributes.Add("onblur", "SetDateFormat(this)");
                this.TextBoxConsentEndDate.Attributes.Add("onblur", "SetDateFormat(this)");
                base.Activate();
                //Code added by Loveena in ref to Task#3234 2.3 Show Client Demographics on All Client Pages
                if (Session["DataSetClientSummary"] != null)
                {
                    DataSet _DataSetClientSummary = (DataSet)Session["DataSetClientSummary"];
                    //Modified by Loveena in ref to Task#3265
                    LabelClientName.Text = _DataSetClientSummary.Tables["ClientInformation"].Rows[0]["ClientInformationLabel"].ToString();
                }
                // TextBoxConsentStartDate.Text = DateTime.Now.AddYears(-1).ToString("MM/dd/yyyy");
                //commented By Priya and Add After Display Medication List
                //As per task no:2979
                GetClientConsentHistory(((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId);
                string currentDate = DateTime.Now.ToString("MM/dd/yyyy");
                FillMedication();
                HiddenFieldMedication.Value  = DropDownConsentMedication.SelectedValue;
                TextBoxConsentStartDate.Text = DateTime.Now.AddYears(-1).ToString("MM/dd/yyyy");
                string sFilter = SetFilter();
                if (sFilter.Length > 0)
                {
                    DisplayMedicationData(sFilter);
                }
                else
                {
                    //    strErrorMessage = "End Date should be Greater than Start Date";
                    //    #region "error message colors"
                    //    Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
                    //    Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
                    //    #endregion
                    //   // ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                }
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "###Source Function Name - ViewMedicationHistory--Page_Load(), ParameterCount -0 ###";
                }
                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);
                if (ex.Message == "Session Expired")
                {
                    ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), " HideViewHistory('" + ex.Message + "');", true);
                }
            }
        }
        /// <summary>
        /// <Description>Used to handles the ButtonApplyFilter click event</Description>
        /// <Author>Pradeep</Author>
        /// <CreatedOn>29 Oct 2009</CreatedOn>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonApplyFilter_Click(object sender, EventArgs e)
        {
            try
            {
                // FillMedication();
                // DropDownConsentMedication.SelectedValue = HiddenFieldMedication.Value;
                HiddenFieldMedication.Value = DropDownConsentMedication.SelectedValue;

                string sFilter = SetFilter();
                if (sFilter.Length > 0)
                {
                    DisplayMedicationData(sFilter);
                }
                else
                {
                    DisplayMedicationData(sFilter);
                    strErrorMessage = "End Date should be Greater than Start Date";
                    #region "error message color"
                    Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
                    Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
                    #endregion
                    ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                }
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "fnHideParentDiv1();", true);
            }
        }
Example #3
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        try
        {
            CommonFunctions.Event_Trap(this);
            //Added by Loveena in ref to task#2378 - CopyrightInfo
            if (Session["UserContext"] != null)
            {
                LabelCopyrightInfo.Text = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).CopyrightInfo;
            }

            #region "error message color added by rohit ref. #121"
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
            #endregion
            if (!Page.IsPostBack)
            {
                this.RadioButtonFaxToPharmacy.Attributes.Add("onclick", "return EnablesDisable('" + ButtonOk.ClientID + "','" + RadioButtonFaxToPharmacy.ClientID + "','" + RadioButtonPrintScript.ClientID + "')");
                this.RadioButtonPrintScript.Attributes.Add("onclick", "return EnablesDisable('" + ButtonOk.ClientID + "','" + RadioButtonFaxToPharmacy.ClientID + "','" + RadioButtonPrintScript.ClientID + "')");
                this.ButtonOk.Attributes.Add("onclick", "javascript:return ValidateInputsPrint('" + DropDownListPharmacies.ClientID + "','" + RadioButtonFaxToPharmacy.ClientID + "','" + RadioButtonPrintScript.ClientID + "','" + DropDownListScriptReason.ClientID + "');");
                FillPharmaciesCombo();
                FillScriptReasonCombo();
                HiddenFieldLatestClientMedicationScriptId.Value = Request.QueryString["ClientMedicationScriptId"].ToString();
                HiddenFieldOrderMethod.Value = Request.QueryString["OrderingMethod"].ToString();
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "###Source Function Name - MedicationPrintOrderDialog--Page_Load(), ParameterCount -0 ###";
            }
            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 = "";

            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "closeDiv();", true);
        }
        finally
        {
        }
    }
        protected override void Page_Load(object sender, EventArgs e)
        {
            try
            {
                CommonFunctions.Event_Trap(this);
                //Added in ref to Task#2895
                if (System.Configuration.ConfigurationSettings.AppSettings["OpenFromSmartCare"].ToString().ToUpper() == "FALSE")
                {
                    LinkButtonLogout.Style["display"]    = "block";
                    LinkButtonStartPage.Style["display"] = "block";
                }
                this.ButtonApplyFilter.Attributes.Add("onclick", "javascript:return CheckDates('" + this.TextBoxConsentStartDate.ClientID + "'" + ",'" + this.TextBoxConsentEndDate.ClientID + "','" + LabelError.ClientID + "')");
                DropDownConsentMedication.Attributes.Add("onchange", "SetMedicationFilterValue()");
                #region --Error Message color
                Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
                Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
                #endregion
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "###Source Function Name - ViewMedicationHistory--Page_Load(), ParameterCount -0 ###";
                }
                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);
                if (ex.Message == "Session Expired")
                {
                    ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), " HideViewHistory('" + ex.Message + "');", true);
                }
            }
        }
Example #5
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        FileStream fs;
        TextWriter ts;
        string     _strScriptIds = "";
        ArrayList  ScriptArrays;
        string     _strChartScriptIds = "";
        ArrayList  ChartScriptArrays;
        bool       _strFaxSendStatus             = false;
        string     _strFaxFaildMessage           = "";
        Dictionary <string, string> filePathList = new Dictionary <string, string>();

        string imagePath = string.Empty;

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

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

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


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

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

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

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

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

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

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

            ts.Close();
            if (printWithWatermark && pageHTMLWithWatermark != "")
            {
                Response.Write(pageHTMLWithWatermark);
            }
            else
            {
                strPageHtml = strPageHtml.Replace(@"\", "/");
            }
            Response.Write(strPageHtml);
            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "printScript();", true);
        }
        catch (Exception ex)
        {
            Response.Write("Error While Generating Report" + ex.Message.ToString());
        }
        finally
        {
            fs                 = null;
            ts                 = null;
            _strScriptIds      = null;
            ScriptArrays       = null;
            ChartScriptArrays  = null;
            _strChartScriptIds = null;
        }
    }
        protected override void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                AllergySearchCriteria = "";

                //Added by Loveena in ref to task#2378 - CopyrightInfo
                if (Session["UserContext"] != null)
                {
                    LabelCopyrightInfo.Text = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).CopyrightInfo;
                }
                if (Page.IsPostBack == false)
                {
                    try
                    {
                        GetAllergiesData(Request.QueryString["SearchCriteria"].ToString());
                        string ss = "";
                        ss = Request.QueryString["SearchCriteria"].ToString();

                        if (ss.IndexOf('!') > 0)
                        {
                            ss = ss.Replace('!', '&');
                        }
                        if (ss.IndexOf('^') > 0)
                        {
                            ss = ss.Replace('^', '#');
                        }

                        AllergySearchCriteria = ss;
                        BindGridAllergies();
                        //this.PlaceHolderScript.Controls.Clear();
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + ex.Message.ToString() + "', true);", true);
                    }
                }


                DataRow[] DataRowAllergyReaction = Streamline.UserBusinessServices.SharedTables.DataSetGlobalCodes.Tables[0].Select("CATEGORY='ALLERGYREACTION' AND ISNULL(RecordDeleted,'N')<>'Y' and Active='Y' ", "CodeName asc");
                DataRow[] DataRowAllergySeverity = Streamline.UserBusinessServices.SharedTables.DataSetGlobalCodes.Tables[0].Select("CATEGORY='ALLERGYSEVERITY' AND ISNULL(RecordDeleted,'N')<>'Y' and Active='Y' ", "CodeName asc");



                DataSet DataSetAllergyReaction = new DataSet();
                DataSetAllergyReaction.Merge(DataRowAllergyReaction);
                if (DataSetAllergyReaction.Tables.Count > 0)
                {
                    DataSetAllergyReaction.Tables[0].TableName = "GlobalCodesAllergyReaction";
                    if (DataSetAllergyReaction.Tables["GlobalCodesAllergyReaction"].Rows.Count > 0)
                    {
                        DropDownListAllergyReaction.DataSource     = DataSetAllergyReaction.Tables["GlobalCodesAllergyReaction"];
                        DropDownListAllergyReaction.DataTextField  = "CodeName";
                        DropDownListAllergyReaction.DataValueField = "GlobalCodeId";
                        DropDownListAllergyReaction.DataBind();
                        ListItem itemAllergyReaction = new ListItem(" ", "-1");
                        DropDownListAllergyReaction.Items.Insert(0, itemAllergyReaction);
                    }
                }

                DataSet DataSetAllergySeverity = new DataSet();
                DataSetAllergySeverity.Merge(DataRowAllergySeverity);
                if (DataSetAllergySeverity.Tables.Count > 0)
                {
                    DataSetAllergySeverity.Tables[0].TableName = "GlobalCodesAllergySeverity";
                    if (DataSetAllergySeverity.Tables["GlobalCodesAllergySeverity"].Rows.Count > 0)
                    {
                        DropDownListAllergySeverity.DataSource     = DataSetAllergySeverity.Tables["GlobalCodesAllergySeverity"];
                        DropDownListAllergySeverity.DataTextField  = "CodeName";
                        DropDownListAllergySeverity.DataValueField = "GlobalCodeId";
                        DropDownListAllergySeverity.DataBind();
                        ListItem itemAllergySeverity = new ListItem(" ", "-1");
                        DropDownListAllergySeverity.Items.Insert(0, itemAllergySeverity);
                    }
                }
            }
            catch (Exception ex)
            {
                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);
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + ex.Message.ToString() + "', true);", true);
            }
        }
Example #7
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;
        }
    }
Example #8
0
    protected override void Page_Load(object sender, EventArgs e)
    {
        FileStream fs;
        TextWriter ts;
        string     _strClientMedicationIds = "";
        ArrayList  MedicationArrays;

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

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

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


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

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


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

            if (Request.QueryString["ReportViewer"].ToString() == "true")
            {
                divReportViewer1.InnerHtml = "";
                strPageHtml = strPageHtml.Replace(@"\", "/");
                divReportViewer1.InnerHtml = strPageHtml;
                ts.Close();
            }
            else if (Request.QueryString["ReportViewer"].ToString() == "false")
            {
                ts.Close();
                //Response.Write(strPageHtml);
                strPageHtml = strPageHtml.Replace(@"\", "/");
                divNonReportViewer.InnerHtml = strPageHtml;
                divReportViewer1.Visible     = false;
                divNonReportViewer.Visible   = true;
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "printScript1();", true);
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "###Source Event Name -Page_Load()";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            fs = null;
            ts = null;
        }
    }
Example #9
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["AjaxAction"] == "saveHMTemplateUserDecisions")
            {
                string acceptedKeys = Request.QueryString["AcceptedKeys"].ToString();
                string rejectedKeys = Request.QueryString["RejectedKeys"].ToString();
                string clientIdStr  = Request.QueryString["ClientId"].ToString();
                int    clientId     = 0;
                if (clientIdStr != null && clientIdStr != "")
                {
                    clientId = Convert.ToInt32(clientIdStr);
                }
                using (Streamline.UserBusinessServices.HealthMaintenanceTemplate HealthMaintenanceObj = new Streamline.UserBusinessServices.HealthMaintenanceTemplate())
                {
                    string  pendingAlertCount = "";
                    DataSet dataSetObj        = HealthMaintenanceObj.SaveHealthMaintenaceUserDecisions(acceptedKeys, rejectedKeys, clientId);
                    if (dataSetObj != null && dataSetObj.Tables.Count > 0)
                    {
                        if (dataSetObj.Tables[0] != null && dataSetObj.Tables[0].Rows.Count > 0)
                        {
                            pendingAlertCount = dataSetObj.Tables[0].Rows[0][0].ToString();
                        }
                    }
                    Response.Clear();
                    Response.Write(pendingAlertCount);
                    Response.End();
                }
            }
            if (Request.QueryString["AjaxAction"] == "HealthMaintenanceAlertCheck")
            {
                string CheckAlert    = "true";
                int    CheckClientID = ((Streamline.BaseLayer.StreamlinePrinciple)Context.User).Client.ClientId;

                string retValue = HealthMaintenanceAlertCheck(CheckAlert, CheckClientID);
                Response.Write(retValue);
                Response.End();
            }

            try
            {
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                if (Session["UserContext"] != null)
                {
                    LabelCopyrightInfo.Text = ((Streamline.BaseLayer.StreamlineIdentity)Context.User.Identity).CopyrightInfo;
                }
                if (Page.IsPostBack == false)
                {
                    try
                    {
                        bindTemplateGrid();
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + ex.Message.ToString() + "', true);", true);
                    }
                }
            }
            catch (Exception ex)
            {
                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);
                ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + ex.Message.ToString() + "', true);", true);
            }
        }
        /// <summary>
        /// <Description>Used to display those medication data which are consent</Description>
        /// <Author>Pradeep</Author>
        /// <CreatedOn>Oct 29,2009</CreatedOn>
        /// </summary>
        /// <param name="Filter"></param>
        private void DisplayMedicationData(string Filter)
        {
            DataSet _DataSetClientConsentHistory;

            DataRow[] DataRowsClientMedications            = null;
            DataRow[] DataRowsClientMedicationInstructions = null;
            DataSet   _DataSetClientConsentFilteredHistory = null;
            string    Medicationsfilter = "";

            try
            {
                _DataSetClientConsentHistory = new Streamline.UserBusinessServices.DataSets.DataSetClientMedications();
                // _DataSetClientConsentHistory = new DataSet();
                //Session["DataSetConsentMedicationHistory"] = null;
                string MedicationId = "";
                if (Session["DataSetClientConsentHistory"] != null)
                {
                    _DataSetClientConsentHistory = (DataSet)Session["DataSetClientConsentHistory"];
                }

                DataTable dtTempMedicationInstructions = new DataTable();
                DataTable dtTempMedications            = new DataTable();
                dtTempMedicationInstructions = _DataSetClientConsentHistory.Tables["ClientMedicationInstructions"].Clone();
                dtTempMedications            = _DataSetClientConsentHistory.Tables["ClientMedications"].Clone();
                // _DataSetClientConsentHistory.Merge(_DataSetClientMedications);

                if (Filter == "")
                {
                    DataRowsClientMedications            = _DataSetClientConsentHistory.Tables["ClientMedications"].Select("1=0");
                    DataRowsClientMedicationInstructions = _DataSetClientConsentHistory.Tables["ClientMedicationInstructions"].Select("1=0");
                }
                else
                {
                    DataRowsClientMedications = _DataSetClientConsentHistory.Tables["ClientMedications"].Select("1=1");
                    //added By Priya Ref:Task No:2979
                    if (Filter == "All")
                    {
                        DataRowsClientMedicationInstructions = _DataSetClientConsentHistory.Tables["ClientMedicationInstructions"].Select("1=1");
                    }
                    else
                    {
                        DataRowsClientMedicationInstructions = _DataSetClientConsentHistory.Tables["ClientMedicationInstructions"].Select(Filter);
                    }
                }

                _DataSetClientConsentFilteredHistory = new DataSet();
                _DataSetClientConsentFilteredHistory.Merge(DataRowsClientMedications);
                if (_DataSetClientConsentFilteredHistory.Tables.Count > 0)
                {
                    _DataSetClientConsentFilteredHistory.Tables[0].TableName = "ClientMedications";
                }
                _DataSetClientConsentFilteredHistory.Merge(DataRowsClientMedicationInstructions);
                if (_DataSetClientConsentFilteredHistory.Tables.Count > 1)
                {
                    _DataSetClientConsentFilteredHistory.Tables[1].TableName = "ClientMedicationInstructions";
                }
                //The following session is used for sorting purpose
                Session["DataSetConsentMedicationHistory"] = _DataSetClientConsentFilteredHistory;
                ConsentHistoryList1.Activate();
                ConsentHistoryList1.SortString = "ConsentStartDate DESC";
                ConsentHistoryList1.GenerationConsentTabControlRows(_DataSetClientConsentFilteredHistory.Tables["ClientMedications"], _DataSetClientConsentFilteredHistory.Tables["ClientMedicationInstructions"]);
                if (Filter != "")
                {
                    if (_DataSetClientConsentFilteredHistory.Tables["ClientMedicationInstructions"] != null)
                    {
                        if (_DataSetClientConsentFilteredHistory.Tables["ClientMedicationInstructions"].Rows.Count == 0)
                        {
                            string strErrorMessage = "No Records Found matching Search Criteria";
                            #region "error message color added by rohit ref. #121"
                            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageBackColor(LabelError);
                            Streamline.BaseLayer.CommonFunctions.SetErrorMegssageForeColor(LabelError);
                            #endregion
                            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
                string strErrorMessage = "Error in loading page";
                //ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), ClientID.ToString(), "ShowError('" + strErrorMessage + "', true);", true);
            }
            finally
            {
                _DataSetClientConsentHistory         = null;
                DataRowsClientMedications            = null;
                DataRowsClientMedicationInstructions = null;
            }
        }
    protected void ButtonLogon_Click(object sender, EventArgs e)
    {
        objMedicationLogin = new Streamline.UserBusinessServices.MedicationLogin();
        //Optimization Added by Sony
        DataSet ds = null;
        DataSet userAuthenticationType = null;
        string  authType = string.Empty;
        string  enableADAuthentication = string.Empty;
        bool    isValidUser            = false;

        try
        {
            if (TextBoxUsername.Text.Trim() == string.Empty || TextBoxPassword.Text.Trim() == string.Empty)
            {
                this.LabelError.Text = "Please enter Username/Password";
                return;
            }
            try
            {
                userAuthenticationType = objMedicationLogin.GetUserAuthenticationType(TextBoxUsername.Text.Trim());

                if (userAuthenticationType.Tables["Authentication"].Rows.Count > 0)
                {
                    authType = userAuthenticationType.Tables["Authentication"].Rows[0]["AuthenticationType"].ToString();
                }

                if (userAuthenticationType.Tables["EnableActiveDirectory"] != null)
                {
                    enableADAuthentication = userAuthenticationType.Tables["EnableActiveDirectory"].Rows[0]["EnableADAuthentication"].ToString();
                }

                if (enableADAuthentication.ToUpperInvariant().Equals("Y") && authType.ToUpperInvariant().Equals("A"))
                {
                    isValidUser = objMedicationLogin.ADAuthenticateUser(TextBoxUsername.Text.Trim(), TextBoxPassword.Text.Trim(),
                                                                        userAuthenticationType.Tables["Authentication"].Rows[0]["Domain"].ToString()
                                                                        );
                    if (isValidUser)
                    {
                        var secureADPassword = new SecureString();
                        ds = objMedicationLogin.GetAuthenticatedStaffInfo(Convert.ToInt32(userAuthenticationType.Tables["Authentication"].Rows[0]["StaffId"]), TextBoxUsername.Text.Trim());
                        TextBoxPassword.Text.ToCharArray().ToList().ForEach(secureADPassword.AppendChar);
                        Session["ADPassword"] = secureADPassword;
                    }
                }
                else
                {
                    ds = objMedicationLogin.chkServerLogin(TextBoxUsername.Text.Trim(), TextBoxPassword.Text.Trim());
                }

                if (HiddenFieldUseName.Value.Trim().ToLower() != TextBoxUsername.Text.Trim().ToLower())
                {
                    HiddenFieldLoginCount.Value = "0";
                    HiddenFieldUseName.Value    = TextBoxUsername.Text;
                }
                HiddenFieldLoginCount.Value = Convert.ToString(Convert.ToInt32(HiddenFieldLoginCount.Value) + 1);
                hiddenOldPassword.Value     = TextBoxPassword.Text.Trim();
            }
            catch (Exception ex)
            {
                this.LabelError.Text = "Invalid Username/Password";
                TextBoxPassword.Text = "";
                throw ex;
            }
            //Added in ref to Task#2595
            if (Convert.ToInt32(HiddenFieldLoginCount.Value) > 5)
            {
                objMedicationLogin.chkCountLogin(TextBoxUsername.Text.Trim());
                this.LabelError.Text = "Your account is disabled.Please contact system administrator.";
                TextBoxPassword.Focus();
                HiddenFieldLoginCount.Value = "";
                return;
            }
            if (ds.Tables[0].Rows.Count <= 0)
            {
                this.LabelError.Text = "Invalid Username/Password";
                TextBoxPassword.Text = "";
                return;
            }

            //if (ds.Tables[0].Rows.Count > 0)
            //    {
            //    Response.Redirect("ValidatePage.aspx?ClientId=0&StaffId=" + ds.Tables[0].Rows[0]["StaffID"].ToString());
            //    }
            else
            {
                //Added by Loveena in ref to Task#3269-2.6 User Management: When Staff Created or Updated Set AccessSmartCare flag.
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0][0].ToString() == "Not an authorized user")
                    {
                        this.LabelError.Text = "Not an authorized user";
                    }
                    else
                    {
                        int _logStatus = Convert.ToInt32((ds.Tables[0].Rows[0][5]).ToString());
                        // Password Expire Functionality
                        if (_logStatus == 1 || _logStatus == 2)
                        {
                            ScriptManager.RegisterStartupScript(LabelError, LabelError.GetType(), "key", "javascript:OpenChangePassword('" + TextBoxPassword.Text + "','" + TextBoxUsername.Text + "');", true);

                            if (hiddenCancelled.Value == "0")
                            {
                                ScriptManager.RegisterClientScriptBlock(LabelError, LabelError.GetType(), "key", "javascript:alert('Password changed successfully')", true);
                                TextBoxPassword.Text = hiddenOldPassword.Value;
                            }
                            if (hiddenCancelled.Value == "1")
                            {
                                ScriptManager.RegisterClientScriptBlock(LabelError, LabelError.GetType(), "key", "alert('Password changed failed')", true);
                                return;
                            }
                        }
                        else
                        {
                            //Added in ref to Task#2595
                            //Comented by Pradeep for testing needs to be uncoment later
                            //if (ds.Tables[0].Rows[0]["QuestionsAnswered"] != System.DBNull.Value)
                            //    {
                            //    this.LabelError.Text = ds.Tables[0].Rows[0]["QuestionsAnswered"].ToString();
                            //    TextBoxPassword.Focus();
                            //    }
                            //else
                            //    {
                            //Commented in ref to Task#2700
                            Response.Redirect("ValidatePage.aspx?ClientId=0&StaffId=" + ds.Tables[0].Rows[0]["StaffID"].ToString(), false);
                            //}
                            //Added in ref to Task#2595
                            //if (ds.Tables[0].Rows[0]["QuestionsAnswered"] != System.DBNull.Value)
                            //{
                            //    //Modified by Loveena in ref to Task#2700
                            //    //this.LabelError.Text = ds.Tables[0].Rows[0]["QuestionsAnswered"].ToString();
                            //    //TextBoxPassword.Focus();
                            //    Response.Redirect("ValidatePage.aspx?ClientId=0&StaffId=" + ds.Tables[0].Rows[0]["StaffID"].ToString() + "&QuestionsAnswered=" + ds.Tables[0].Rows[0]["QuestionsAnswered"].ToString());
                            //}
                            //else
                            //{
                            //    Response.Redirect("ValidatePage.aspx?ClientId=0&StaffId=" + ds.Tables[0].Rows[0]["StaffID"].ToString() + "&QuestionsAnswered=");
                            //}
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "###Source Function Name - MedicationLogin--Page_Load(), ParameterCount -0 ###";
            }
            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);
        }
    }