Exemplo n.º 1
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            // Verifiy items passed in url
            if (!string.IsNullOrEmpty(Request.QueryString["pIds"]))
            {
                // Get a list of patients for which to print label
                string pIds = CustomCryptoHelper.Decrypt(Request.QueryString["pIds"]);
                //string pIds = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34";

                patientIds = pIds.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                MaxLabels  = GetMaxLabelsPerPage();
                //MaxLabels = 1;

                // Build List

                // Option 1. Bind to Repeater

                // Populates repeater with list of patient info
                //rptLabels.DataSource = data;
                //rptLabels.DataBind();

                // Operion 2. Insert controls dynamically
                CreateChildControls(patientIds);
            }
        }
Exemplo n.º 2
0
        override protected void Page_Load(object sender, System.EventArgs e)
        {
            // this logic can be moved someplace else if better suited
            //Should take encrypted patientId and returns patientMRN, Last Name, First Name
            if (Request.QueryString.Get("epid") != null && !Request.QueryString.Get("epid").Equals(""))
            {
                int patientId = int.Parse(CustomCryptoHelper.Decrypt((string)Request.QueryString.Get("epid")));
                // this clause is true only if you are arriving at this page by clicking on a patient
                // in a clinic list.  Checks if the patient is in the Patients table, possibly not true since
                // patients can be deleted from the patients table
                if (Request.QueryString["verifyPatientId"] != null && Request.QueryString["verifyPatientId"].ToUpper() == "TRUE")
                {
                    Patient pt = new Patient();
                    pt.Get(patientId);
                    //if (pt.DataSourceView.Table.Rows.Count > 0)
                    if (!pt.IsEmpty)
                    {
                        this.SetPatientSessionVariables(patientId);
                    }
                    else
                    {
                        //Response.Redirect("../PatientList/PatientListPage.aspx?selectedPatientDeleted=true");
                        Server.Transfer("../PatientLists/PatientListPage.aspx?selectedPatientDeleted=true");
                    }
                }
                else
                {
                    this.SetPatientSessionVariables(patientId);
                }
            }

            base.Page_Load(sender, e); // disables view state
        }
Exemplo n.º 3
0
        protected string formatUrl(string patientID)
        {
            string        urlVars = "epid=" + CustomCryptoHelper.Encrypt(patientID) + "&patientList=yes";
            StringBuilder sb      = new StringBuilder(Request.ApplicationPath);

            sb.Append("/Core/DataEntryForms/index.aspx?");
            sb.Append(urlVars);
            sb.Append("&verifyPatientId=true");
            return(sb.ToString());
        }
Exemplo n.º 4
0
        public static SqlConnection GetConnection()
        {
            string dbConnStr = System.Configuration.ConfigurationSettings.AppSettings["dbConnectionString"];

            if (ConfigurationSettings.AppSettings["encryptDbConnectString"] != null && ConfigurationSettings.AppSettings["encryptDbConnectString"].ToString().Equals("true"))
            {
                dbConnStr = CustomCryptoHelper.Decrypt(dbConnStr);
            }

            return(new SqlConnection(dbConnStr));
        }
Exemplo n.º 5
0
        protected override void Page_Load(object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);

            EFormTitle.Text = base.EFormTitle;

//			PatientName.Text = "";

            if (Session[SessionKey.PtFirstName] != null && Session[SessionKey.PtFirstName].ToString().Length > 0)
            {
                PatientName.Text  = "";
                PatientName.Text += Session[SessionKey.PtFirstName].ToString();
            }
            if (Session[SessionKey.PtLastName] != null && Session[SessionKey.PtLastName].ToString().Length > 0)
            {
                PatientName.Text += " " + Session[SessionKey.PtLastName].ToString();
            }

            // centralize setting of new eform drop down this with eform list
            ListItemCollection lic = new ListItemCollection();

            lic.Add(new ListItem("", ""));
            XmlNodeList list = CaisisConfiguration.GetEFormsList();

            foreach (XmlNode node in list)
            {
                string   name  = node.Attributes["displayname"].Value;
                string   value = node.Attributes["name"].Value;
                ListItem item  = new ListItem(name, value);
                lic.Add(item);
            }
            // Old Code to populate dropdown list
            //lic.Add(new ListItem("Prostate Surgery EForm", "Prostate Surgery EForm"));
            ////lic.Add(new ListItem("Prostate New Patient EForm", "Prostate New Patient EForm"));
            //lic.Add(new ListItem("Urology Prostate Follow Up", "Uro Pros FU"));
            //lic.Add(new ListItem("GU Prostate Follow Up", "GU Pros FU"));
            EFormDropDown.DataSource     = lic;
            EFormDropDown.DataTextField  = "Text";
            EFormDropDown.DataValueField = "Value";
            EFormDropDown.DataBind();

            string epid = CustomCryptoHelper.Encrypt(Session[SessionKey.PatientId].ToString());

            StartNewEFormImg.Attributes.Add("onClick", "if (checkEformTypeChosen('" + EFormDropDown.ClientID + "')) { startBtnClick(this.id, '" + epid + "' ) } else { alert('Please select an EForm type.') }");

            // set repeater
            this.SetPatientEFormList();

//			this.ShowEFormNarrative();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets user permissions and puts them in an encrypted cookie
        /// </summary>
        /// <param name="purposeVal"></param>
        /// <param name="datasetIdVal"></param>
        /// <param name="loginId"></param>
        /// <param name="userName"></param>
        public void SetPermissions(string purposeVal, int datasetIdVal, int loginId, string userName)
        {
            string permissionList = GetPermissions(loginId, purposeVal, datasetIdVal, userName);
            string encryptedPerms = CustomCryptoHelper.EasyEncrypt(permissionList);

            HttpCookie perms = new HttpCookie("dsPerms", encryptedPerms);

            perms.Expires = DateTime.Now.AddYears(1);
            System.Web.HttpContext.Current.Response.Cookies.Add(perms);

            // log default dataset
            int userId = GetUserId(userName);

            this.UpdateUserAttribute(UserAttributeName.DatasetId, datasetIdVal.ToString(), UserAttributeType.DefaultDataset, userId);
        }
Exemplo n.º 7
0
        public static SqlConnection GetConnection()
        {
            string dbConnStr = ConfigurationSettings.AppSettings["dbConnectionString"].ToString();

            if (ConfigurationSettings.AppSettings["encryptDbConnectString"] != null && ConfigurationSettings.AppSettings["encryptDbConnectString"].ToString().Equals("true"))
            {
                dbConnStr = CustomCryptoHelper.Decrypt(dbConnStr);
            }

            SqlConnection conn = new System.Data.SqlClient.SqlConnection();

            conn.ConnectionString = dbConnStr;

            return(conn);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns the connection string for the Data Warehouse
        /// </summary>
        /// <returns></returns>
        public static SqlConnection GetWarehouseConnection()
        {
            string warehouseKey        = "warehouseConnectionString";
            string encryptWarehouseKey = "encryptWarehouseConnectionString";
            string warehouseConnection = ConfigurationSettings.AppSettings[warehouseKey].ToString();

            if (ConfigurationSettings.AppSettings[encryptWarehouseKey] != null && ConfigurationSettings.AppSettings[encryptWarehouseKey].ToString().ToLower().Equals("true"))
            {
                warehouseConnection = CustomCryptoHelper.Decrypt(warehouseConnection);
            }
            SqlConnection conn = new System.Data.SqlClient.SqlConnection();

            conn.ConnectionString = warehouseConnection;

            return(conn);
        }
Exemplo n.º 9
0
        protected void Page_PreInit(object sender, EventArgs e)
        {
            if (Request.QueryString["patientIds"] != null && Request.QueryString["patientIds"].Length > 0)
            {
                string pIds = CustomCryptoHelper.Decrypt(Request.QueryString["patientIds"].ToString());
                patientIds = pIds.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                if (Request.QueryString["surveyRuleType"] != null && Request.QueryString["surveyRuleType"].Length > 0)
                {
                    _surveyRuleType = Request.QueryString["surveyRuleType"].ToString();
                }

                string sourceFolder = Server.MapPath("../../../Modules/FollowUp/Surveys/");

                BaseLongitudinalControl lControl = new BaseLongitudinalControl();

                foreach (string pId in patientIds)
                {
                    //get survey(s) due for patient
                    string   fileNames      = GetSurveyPacketFileNames(_surveyRuleType, Int32.Parse(pId));
                    string[] fileNamesArray = fileNames.Split(',');

                    // get page number(s) of any pages to skip
                    string[] pagesToSkip = new string[] { String.Empty };

                    foreach (string fileName in fileNamesArray)
                    {
                        // if file is for coverletter (.xml)
                        if (fileName.Contains(".xml"))
                        {
                            lControl           = new BaseLongitudinalControl();
                            lControl           = (BaseLongitudinalControl)this.LoadControl("~/Modules/FollowUp/LongitudinalFollowUp/LongitudinalLetter.ascx");
                            lControl.PatientId = Int32.Parse(pId);
                            lControl.CoverLetterXmlFileName = fileName;

                            _objMergePdf.AddControlPage(MergedFileForm, lControl);
                        }
                        else if (fileName.Contains(".pdf"))
                        {
                            _objMergePdf.AddFile(fileName, sourceFolder, pagesToSkip);
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        protected void rptClinicItemCreated(Object Sender, RepeaterItemEventArgs e)
        {
            // create a reference to the current tr
            System.Web.UI.HtmlControls.HtmlContainerControl clinicListRow;
            clinicListRow = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("clinicListRow");

            Literal eformStatus;

            eformStatus = (System.Web.UI.WebControls.Literal)e.Item.FindControl("eformStatus");

            // if the patient ID for this row is empty, clicking the row will cause a javascript alert.
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string localApptPatientId = ((DataRowView)e.Item.DataItem)["ApptPatientId"].ToString();

                if (localApptPatientId == "")
                {
                    clinicListRow.Attributes.Add("onclick", "alert('This patient is not in the database.  No information about this patient beyond the data listed on this page is currently available.');");
                }
                else
                {
                    string urlVars = "epid=" + CustomCryptoHelper.Encrypt(localApptPatientId) + "&patientList=yes&listType=" + Server.UrlEncode(this.listTitle);
                    string url     = PageUtil.EscapeSingleQuotes("../DataEntryForms/index.aspx?" + urlVars + "&verifyPatientId=true");
                    clinicListRow.Attributes.Add("onclick", "parent.location='" + url + "';");
                }

                string currentStatus = ((DataRowView)e.Item.DataItem)["CurrentStatus"].ToString();

                if (!currentStatus.Equals(""))
                {
                    string summary         = ((DataRowView)e.Item.DataItem)["EFormName"].ToString() + " last updated by " + ((DataRowView)e.Item.DataItem)["UpdatedBy"].ToString() + " on " + ((DataRowView)e.Item.DataItem)["UpdatedTime"].ToString();
                    string spanOpeningText = "<a span onmouseover=\"showToolTipMessage('" + summary + "')\" onmouseout=\"hideToolTip()\">";
                    string spanClosingText = "</span>";

                    if (currentStatus.Equals(EformStatusManager.Status_DataEntryComplete) || currentStatus.Equals(EformStatusManager.Status_DataEntryInProgress) || currentStatus.Equals(EformStatusManager.Status_Narrated))
                    {
                        eformStatus.Text = spanOpeningText + "EForm Initiated" + spanClosingText;
                    }
                    else if (currentStatus.Equals(EformStatusManager.Status_Approved))
                    {
                        eformStatus.Text = spanOpeningText + "EForm Approved" + spanClosingText;
                    }
                }
            }
        }
Exemplo n.º 11
0
        private void SetPermissions(int loginSessionId, int datasetIdVal, string userName)
        {
            string purposeVal = "ClinicEforms";

            UserController secControl = new UserController();

            string permissionList = secControl.GetPermissions(loginSessionId, purposeVal, datasetIdVal, userName);
            string encryptedPerms = CustomCryptoHelper.EasyEncrypt(permissionList);

            HttpCookie perms = new HttpCookie("dsPerms", encryptedPerms);

            perms.Expires = DateTime.Now.AddYears(1);
            Response.Cookies.Add(perms);

            Session[SessionKey.GroupViewCode] = secControl.SetGroupViewCode(datasetIdVal, userName);

            // Hide
            Response.Redirect(Request.Path + "?hide=true");             //must reload page so that the permissions can be reloaded into the principal object in the Global.asax
        }
Exemplo n.º 12
0
        /// <summary>
        /// Gets user permissions and puts them in an encrypted cookie
        /// </summary>
        /// <param name="purposeVal">user purpose</param>
        /// <param name="datasetIdVal">dataset id</param>
        public void SetPermissions(string purposeVal, int datasetIdVal, int loginId)
        {
            //int loginId = (int)Session[SessionKey.LoginId];

            //UserController secControl = new UserController();

            string permissionList = this.LogDatasetGetPermissions(loginId, purposeVal, datasetIdVal);
            string encryptedPerms = CustomCryptoHelper.EasyEncrypt(permissionList);

            HttpCookie perms = new HttpCookie("dsPerms", encryptedPerms);

            perms.Expires = DateTime.Now.AddYears(1);
            System.Web.HttpContext.Current.Response.Cookies.Add(perms);

            //SetGroupViewCode(datasetIdVal);

            // TODO: BEWARE THIS WAS REMOVED ON 1/26/08 and there may be repercussions!!!
            // HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Path); //must reload page so that the permissions can be reloaded into the principal object in the Global.asax
        }
Exemplo n.º 13
0
        protected void rptInPatientItemCreated(Object Sender, RepeaterItemEventArgs e)
        {
            // create a reference to the current tr
            System.Web.UI.HtmlControls.HtmlContainerControl inPatientRow;
            inPatientRow = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("inPatientRow");

            // if the patient ID for this row is empty, clicking the row will cause a javascript alert.
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string currentPatientId = ((DataRowView)e.Item.DataItem)["PatientId"].ToString();

                if (currentPatientId.Equals(""))
                {
                    inPatientRow.Attributes.Add("onclick", "alert('This patient is not in the database.  No information about this patient beyond the data listed on this page is currently available.');");
                }
                else
                {
                    string urlVars = "epid=" + CustomCryptoHelper.Encrypt(currentPatientId) + "&patientList=yes&listType=" + Server.UrlEncode(this.listTitle);
                    string url     = PageUtil.EscapeSingleQuotes("../DataEntryForms/index.aspx?" + urlVars + "&verifyPatientId=true");
                    inPatientRow.Attributes.Add("onclick", "parent.location='" + url + "';");
                }
            }
        }
Exemplo n.º 14
0
        private void SetLinkToPagePatientData(Object Sender, RepeaterItemEventArgs e, HtmlControl ctrl)
        {
            // if the patient ID for this row is empty, clicking the row will cause a javascript alert.
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                if (((DataRowView)e.Item.DataItem)["patientId"].ToString().Length > 0)
                {
                    string localPatientId = ((DataRowView)e.Item.DataItem)["patientId"].ToString();

                    string currentClass = ctrl.Attributes["class"].ToString();
                    ctrl.Style["cursor"] = "pointer";
                    if (localPatientId == "")
                    {
                        ctrl.Attributes.Add("onClick", "javascript:alert('This patient is not in the database.  No information about this patient beyond the data listed on this page is currently available.');");
                    }
                    else
                    {
                        string urlVars = "epid=" + CustomCryptoHelper.Encrypt(localPatientId) + "&patientList=yes";
                        string url     = Page.ResolveUrl("~/Core/DataEntryForms/Index.aspx?findClicked=true&epid=" + CustomCryptoHelper.Encrypt(localPatientId)) + "&patientList=yes";
                        ctrl.Attributes.Add("onClick", "top.location='" + url + "';");
                    }
                }
            }
        }
Exemplo n.º 15
0
        protected void rptItemCreated(Object sender, RepeaterItemEventArgs e)
        {
            // create a reference to the current tr
            System.Web.UI.HtmlControls.HtmlContainerControl listRow;
            listRow = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("listRow");


            // if the patient ID for this row is empty, clicking the row will cause a javascript alert.
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string localPatientId = ((DataRowView)e.Item.DataItem)["patientId"].ToString();

                if (localPatientId == "")
                {
                    listRow.Attributes.Add("onClick", "alert('This patient is not in the database.  No information about this patient beyond the data listed on this page is currently available.');");
                }
                else
                {
                    string urlVars = "epid=" + CustomCryptoHelper.Encrypt(localPatientId) + "&patientList=yes";

                    listRow.Attributes.Add("onClick", "parent.location='../DataEntryForms/index.aspx?" + urlVars + "';");
                }
            }
        }
Exemplo n.º 16
0
        protected void Application_AuthenticateRequest(Object sender, EventArgs e)
        {
            SecurityController sc = new SecurityController();

            // when in DEVELOPMENT mode set default values so developers do not have to log in after each build
            if (sc.CheckDevelopmentMode())
            {
                FormsAuthenticationTicket ticket = new    FormsAuthenticationTicket(
                    1,                                                      // version
                    "DevModeUser",                                          // user name
                    DateTime.Now,                                           // issue time
                    DateTime.Now.AddMinutes(120),                           // EXPIRES
                    false,
                    ""
                    );

                FormsIdentity id = new FormsIdentity(ticket);

                string [] allPerms = { "EditData",   "ViewData",      "DeleteData",   "UnlockData",
                                       "AddPatient", "DeletePatient", "EditSecurity", "EditNarrative","EditEForm",  "InitiateEForm", "ApproveEForm" };
                //
                CustomPrincipal cp = new CustomPrincipal(id, allPerms);
                if (Request.Cookies["diseaseView"] != null)
                {
                    cp.UserProfile["diseaseView"] = Request.Cookies["diseaseView"].Value.ToString();
                }

                HttpContext.Current.User = cp;
                return;
            }


            HttpContext currentContext = HttpContext.Current;

            if (HttpContext.Current.User != null)
            {
                if (HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    if (HttpContext.Current.User.Identity is FormsIdentity)
                    {
                        FormsIdentity id = HttpContext.Current.User.Identity as FormsIdentity;

                        //getting roles from cookie
                        FormsAuthenticationTicket ticket = id.Ticket;

                        string[] roleList = null;


                        if (Request.Cookies["dsPerms"] != null)
                        {
                            //will add logic to un hash permissions before storing
                            string encryptedStr = Request.Cookies["dsPerms"].Value.ToString();
                            try
                            {
                                roleList = ((CustomCryptoHelper.EasyDecrypt(encryptedStr)).Split(','));
                            }
                            catch (ClientException ex)
                            {
                                if (ex.ExceptionType == ClientExceptionType.InvalidPassword)
                                {
                                    FormsAuthentication.SignOut();
                                    Response.Cookies["dsPerms"].Expires = new DateTime(2002, 1, 1);
                                }
                            }
                        }

                        CustomPrincipal cp = new CustomPrincipal(id, roleList);

                        if (Request.Cookies["diseaseView"] != null)
                        {
                            cp.UserProfile["diseaseView"] = Request.Cookies["diseaseView"].Value.ToString();
                        }

                        HttpContext.Current.User = cp;
                    }
                }
            }
        }
Exemplo n.º 17
0
/*		old functionality - remove after testing - jf
 *              private void ShowEFormNarrative()
 *              {
 *                      EFormController ctr = new EFormController();
 *
 *                      int eformId = Convert.ToInt32(Request.QueryString["eformId"]);
 *
 *                      // get record using eform id because both approved and reviewed eforms may be displayed
 *                      DataSet eds = ctr.GetRecord(eformId);
 *
 *                      if(eds.Tables[0].Rows.Count > 0)
 *                      {
 *                              // display html from database,status must be "Previewed"
 *                              if(eds.Tables[0].Rows[0][Caisis.BOL.EForm.EFormReport].ToString().Length > 0)
 *                              {
 *                                      theNarrative.InnerHtml = eds.Tables[0].Rows[0][Caisis.BOL.EForm.EFormReport].ToString();
 *                              }
 *                      }
 *              }
 */
        protected void OnItemCreate(Object Sender, RepeaterItemEventArgs e)
        {
            HtmlContainerControl EFormCell;

            EFormCell = (HtmlContainerControl)e.Item.FindControl("EFormCell");

            HtmlContainerControl EFormRow;

            EFormRow = (HtmlContainerControl)e.Item.FindControl("EFormRow");

            HtmlImage EFormStatusImg;

            EFormStatusImg = (HtmlImage)e.Item.FindControl("EFormStatusImg");


            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string eformId = ((DataRowView)e.Item.DataItem)[EForm.EFormId].ToString();

                string eformStatus = ((DataRowView)e.Item.DataItem)[EForm.CurrentStatus].ToString();

                string patientId = ((DataRowView)e.Item.DataItem)["PatientId"].ToString();

                string epid = CustomCryptoHelper.Encrypt(patientId);

                if (eformStatus == EformStatusManager.Status_Deleted)
                {
                    // hide it
                    EFormRow.Visible = false;
                }
                else if (eformStatus == EformStatusManager.Status_Approved)
                {
                    // link to this page

                    EFormCell.Attributes.Add("onClick", "loadApprovedEForm('" + eformId + "');");

// this is old functionality, remove after testing - jf
//					EFormCell.Attributes.Add("onClick","document.location='PatientEFormList.aspx?eformId=" + eformId + "';");

                    EFormStatusImg.Src = "../../Images/EFormStatus_Approved.gif";

                    string ImgTitleString = "Approved " + ((DataRowView)e.Item.DataItem)["UpdatedTime"].ToString() + "\nby " + ((DataRowView)e.Item.DataItem)["UpdatedBy"].ToString();

                    EFormStatusImg.Attributes.Add("title", ImgTitleString);
                }
                else
                {
                    string ImgTitleString = "Last Updated " + ((DataRowView)e.Item.DataItem)["UpdatedTime"].ToString() + "\nby " + ((DataRowView)e.Item.DataItem)["UpdatedBy"].ToString();
                    EFormStatusImg.Attributes.Add("title", ImgTitleString);


                    if (eformStatus == EformStatusManager.Status_Narrated)
                    {
                        EFormStatusImg.Src = "../../Images/EFormStatus_DataReviewed.gif";
                    }
                    else if (eformStatus == EformStatusManager.Status_DataEntryComplete)
                    {
                        EFormStatusImg.Src = "../../Images/EFormStatus_DataComplete.gif";
                    }

                    // link back to workflow so user can finish the eform

                    EFormCell.Attributes.Add("OnClick", "document.location.href='PatientEFormList.aspx?eformId=" + eformId + "';");

                    string urlVars = "epid=" + epid + "&eformId=" + eformId + "&status=" + eformStatus;

                    EFormCell.Attributes.Add("onClick", "parent.location='Index.aspx?" + urlVars + "';");
                }
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Logs the exception to the Caisis database.
        /// </summary>
        /// <param name="ex">The exception to be published.</param>
        public static void WriteToDatabaseLog(Exception ex)
        {
            string ErrUserName = "";

            HttpRequest      req = HttpContext.Current.Request;
            HttpSessionState ses = HttpContext.Current.Session;

            string ErrURL      = req.Url.ToString();
            string ErrFullPath = req.PhysicalPath.ToString();//.Replace("\\",".");

            string ErrFileName = ErrFullPath.Substring(ErrFullPath.LastIndexOf("\\") + 1);

            string ErrQueryString = req.QueryString.ToString();
            string ErrForm        = req.Form.ToString();

            //Remove viewstate and such
            if (ErrForm.Length > 0)
            {
                string[] aErrForm = ErrForm.Split('&');
                ErrForm = "";
                for (int i = 0; i < aErrForm.Length; i++)
                {
                    if (!aErrForm[i].StartsWith("__"))
                    {
                        ErrForm = ErrForm + aErrForm[i] + "&";
                    }
                }
            }

            string ErrBrowser       = req.Browser.Type.ToString() + " (" + req.Browser.Version.ToString() + ")";
            string ErrPlatform      = req.Browser.Platform.ToString();
            string ErrCookies       = req.Browser.Cookies.ToString();
            string ErrJavascript    = req.Browser.JavaScript.ToString() + " (" + req.Browser.EcmaScriptVersion + ")";
            string ErrIP            = req.UserHostAddress.ToString();
            string ErrAuthenticated = req.IsAuthenticated.ToString();
            string ErrHostName      = req.UserHostName;

            // user Roles
            string ErrPermList = "";

            //session info
            string ErrSessionIsNew   = "";
            int    ErrLoginId        = -1;
            int    ErrSessionTimeOut = -1;
            int    ErrPatientId      = -1;
            int    ErrDatasetId      = -1;

            //TODO: Add tab info

            //path after core
            //to show the section

            DateTime?ErrTicketIssueDate  = null;
            DateTime?ErrTicketExpiration = null;

            DateTime ErrorTime = DateTime.Now;

            string ErrMachineName = HttpContext.Current.Server.MachineName;

            string ErrorName     = "";
            string ErrorMessage  = "";
            string ErrStackTrace = "";

            if (HttpContext.Current.User != null)
            {
                ErrUserName = HttpContext.Current.User.Identity.Name;
            }


            if (req.Cookies["dsPerms"] != null)
            {
                ErrPermList = CustomCryptoHelper.EasyDecrypt(req.Cookies["dsPerms"].Value.ToString());
            }
            else
            {
                ErrPermList = "User permissions cookie does not exist.";
            }

            if (ses != null)
            {
                ErrSessionIsNew = ses.IsNewSession.ToString();

                if (ses[SessionKey.LoginId] != null)
                {
                    if (PageUtil.IsInteger(ses[SessionKey.LoginId].ToString()))
                    {
                        ErrLoginId = int.Parse(ses[SessionKey.LoginId].ToString());
                    }

                    ErrSessionTimeOut = ses.Timeout;

                    if (ses[SessionKey.PatientId] != null)
                    {
                        if (PageUtil.IsInteger(ses[SessionKey.PatientId].ToString()))
                        {
                            ErrPatientId = int.Parse(ses[SessionKey.PatientId].ToString());
                        }
                    }

                    if (ses[SessionKey.DatasetId] != null)
                    {
                        if (PageUtil.IsInteger(ses[SessionKey.DatasetId].ToString()))
                        {
                            ErrDatasetId = int.Parse(ses[SessionKey.DatasetId].ToString());
                        }
                    }
                }
                else
                {
                    //"User does not have a Session.LoginId."
                }
            }
            else
            {
                //"HttpContext.Current.Session is null. No session information available."
            }


            //cookie info
            if (HttpContext.Current.User != null && HttpContext.Current.User.Identity is FormsIdentity)
            {
                FormsAuthenticationTicket ticket = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket;

                ErrTicketIssueDate  = ticket.IssueDate;
                ErrTicketExpiration = ticket.Expiration;
            }

            if (ex != null)
            {
                ErrorName    = ex.GetType().Name;
                ErrorMessage = ex.Message;
                // ErrStackTrace = ex.StackTrace;
                ErrStackTrace = ex.ToString();
            }

            // log error details to db
            ErrorLogDa elda = new ErrorLogDa();

            elda.LogError(ErrLoginId,
                          ErrDatasetId,
                          ErrPatientId,
                          ErrUserName,
                          ErrURL,
                          ErrFullPath,
                          ErrFileName,
                          ErrForm,
                          ErrQueryString,
                          ErrBrowser,
                          ErrPlatform,
                          ErrJavascript,
                          ErrIP,
                          ErrAuthenticated,
                          ErrHostName,
                          ErrPermList,
                          ErrSessionIsNew,
                          ErrSessionTimeOut,
                          ErrTicketIssueDate,
                          ErrTicketExpiration,
                          ErrorTime,
                          ErrMachineName,
                          ErrorName,
                          ErrorMessage,
                          ErrStackTrace
                          );
        }
Exemplo n.º 19
0
        /// <summary>
        /// Send exception to error email specified in web.config with errorType as subject
        /// </summary>
        /// <param name="ex">The exception containing the message to email</param>
        /// <param name="errorType">Optional user error subject text.</param>
        public static void SendErrorEmail(Exception ex, string errorType)
        {
            //ExceptionHandler.Publish(ex);

            string userName = "";

            if (HttpContext.Current.User != null)
            {
                userName = HttpContext.Current.User.Identity.Name;
            }


            HttpRequest      req = HttpContext.Current.Request;
            HttpSessionState ses = HttpContext.Current.Session;


            string userBrowser       = req.Browser.Type.ToString() + " (" + req.Browser.Version.ToString() + ")";
            string userPlatform      = req.Browser.Platform.ToString();
            string userJavascript    = req.Browser.JavaScript.ToString() + " (" + req.Browser.EcmaScriptVersion.ToString() + ")";;
            string userCookies       = req.Browser.Cookies.ToString();
            string userIpAddress     = req.UserHostAddress.ToString();
            string userAuthenticated = req.IsAuthenticated.ToString();

            // user Roles
            string userRoleList = "";

            if (req.Cookies["dsPerms"] != null)
            {
                userRoleList = CustomCryptoHelper.EasyDecrypt(req.Cookies["dsPerms"].Value.ToString());
            }
            else
            {
                userRoleList = "User permissions cookie does not exist.";
            }

            //session info
            string sessionInfo = "";

            if (ses != null)
            {
                sessionInfo = "\n Is new session : " + ses.IsNewSession.ToString();

                if (ses[SessionKey.LoginId] != null)
                {
                    sessionInfo += "\n LoginId: " + ses[SessionKey.LoginId];
                    sessionInfo += "\n Session TimeOut: " + ses.Timeout;
                    sessionInfo += "\n Patient Id: ";
                    if (ses[SessionKey.PatientId] != null)
                    {
                        sessionInfo += ses[SessionKey.PatientId].ToString();
                    }

                    sessionInfo += "\n User Dataset: ";
                    if (ses[SessionKey.DatasetId] != null)
                    {
                        sessionInfo += ses[SessionKey.DatasetId].ToString();
                    }
                }
                else
                {
                    sessionInfo = "\n User does not have a Session.LoginId.";
                }
            }
            else
            {
                sessionInfo = "\n HttpContext.Current.Session is null. No session information available.";
            }


            //cookie info
            string ticketIssueDate = "No Ticket Issued";
            string ticketExpDate   = "No Ticket Issued";

            if (HttpContext.Current.User != null && HttpContext.Current.User.Identity is FormsIdentity)
            {
                FormsAuthenticationTicket ticket = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket;

                ticketIssueDate = ticket.IssueDate.ToString();
                ticketExpDate   = ticket.Expiration.ToString();
            }

            string ticketInfo = "";

            ticketInfo += "\n User ticket issued (same as user login Time) : " + ticketIssueDate;
            ticketInfo += "\n User ticket expiration Date :" + ticketExpDate;

            string messageBody = "Time of error:  " + DateTime.Now;

            messageBody += "\nUser name:  " + userName;
            messageBody += "\n";
            messageBody += "\nMachine environment -------------------------------";
            messageBody += "\nMachineName: " + HttpContext.Current.Server.MachineName;
            messageBody += "\nUser Host Address: " + req.UserHostName;
            messageBody += "\nURL: " + req.Url;
            messageBody += "\nPlatform: " + userPlatform;
            messageBody += "\nBrowser Type: " + userBrowser;
            messageBody += "\nJavaScript Enabled: " + userJavascript;
            messageBody += "\nUser IP Address: " + userIpAddress;

            messageBody += "\n";
            messageBody += "\nUser Session\\Ticket Info -------------------------------:" + sessionInfo;
            messageBody += "\n User Was Logged Into Caisis:  " + userAuthenticated;
            messageBody += "\n User Permissions : " + userRoleList;
            messageBody += ticketInfo;

            //if clause added 9/22 fs;
            //TODO: SendErrorEmail should use BuildErrorEmail unless an explicit exception has been passed in
            if (ex != null)
            {
                messageBody += "\n\n Exception message : " + ex.Message;

                messageBody += "\n\n Stack Trace --------------------------------------------\n " + ex.ToString() + "\n";
            }
            else
            {
                messageBody += "\n\n Unable to publish stack trace. Caught exception was null.";
            }

            //new 2.2 error handling logic
            // messageBody += "\n\n Exception:  " + BuildErrorMessage();
            //end error logic 2.2

            string subject = USER_ERROR_TYPE;

            // is error type specified, set subject "User Error: Eform Merge Issue"
            if (!string.IsNullOrEmpty(errorType))
            {
                subject = string.Format("{0} : {1}", USER_ERROR_TYPE, errorType);
            }
            SendEmail(messageBody, subject);
        }
Exemplo n.º 20
0
        /// <summary>
        /// If login url contains datasetId and page name then validate and redirect, otherwise continue on to default splash page
        /// Only works for eforms at the moment; easily generalized
        /// </summary>
        private void RedirectUser()
        {
            //http://localhost/dev4/Login.aspx?redirect=%2fdev4%2fCore%2fEforms%2fIndex.aspx%3feform%3dUro+Pros+FU&status=new&dsId=1&user=admin&epid=791D41350A007063

            if (Request.QueryString["eform"] != null && Request.QueryString["eform"].Length > 0 && Request.QueryString["ptId"] != null && PageUtil.IsInteger(Request.QueryString["ptId"]))
            {
                // need to automatically set purpose, user dataset, and make sure patient is in the dataset
                // reference UserController to SetPermissions and GroupViewCode
                int    loginId     = (int)Session[SessionKey.LoginId];
                string userPurpose = Request.Form["purpose"];
                // int datasetId = int.Parse(Request.QueryString["dsId"]);
                int    patientId = int.Parse(Request.QueryString["ptId"]);
                string eformName = Request.QueryString["eform"];

                // if redirecting to an existing eform, retrive eformId to ensure a new eform will now be created
                string eformId = String.Empty;
                if (Request.QueryString["eformId"] != null)
                {
                    eformId = Request.QueryString["eformId"].ToString();
                }

                int datasetId = 0;

                UserController ct           = new UserController();
                DataSet        userDatasets = ct.GetUserDatasets(userName.Value);
                // DataSet userDatasets = ct.GetUserDatasets();
                PatientController pc    = new PatientController();
                bool isPatientInDataset = false;

                foreach (DataRow dr in userDatasets.Tables[0].Rows)
                {
                    datasetId          = (int)dr[Dataset.DatasetId];
                    isPatientInDataset = pc.IsPatientInDataSet(patientId, datasetId);
                    if (isPatientInDataset)
                    {
                        break;
                    }
                }

                //bool userHasAccessToDataset = ct.VerifyUserAccessToDataset(datasetId);

                if (isPatientInDataset)
                {
                    Session[SessionKey.DatasetId]     = datasetId;
                    Session[SessionKey.GroupViewCode] = ct.SetGroupViewCode(datasetId, userName.Value);
                    // Session[SessionKey.GroupViewCode] = ct.SetGroupViewCode(datasetId);
                    ct.SetPermissions(userPurpose, datasetId, loginId, userName.Value);
                    // ct.SetPermissions(userPurpose, datasetId, loginId);

                    // set session vars for defaulting values when reaching eform
                    if (!string.IsNullOrEmpty(Request.QueryString["apptDate"].ToString()))
                    {
                        // should check that it is a date and culture format
                        Session[SessionKey.CurrentClinicDate] = Request.QueryString["apptDate"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request.QueryString["surgeon"].ToString()))
                    {
                        Session[SessionKey.CurrentListType] = "Clinic";
                        Session[SessionKey.CurrentListCrit] = Request.QueryString["surgeon"].ToString();
                    }


                    string epid        = CustomCryptoHelper.Encrypt(patientId.ToString());
                    string eformStatus = "new";
                    string baseUrl     = PageUtil.GetBasePath(Request);
                    string referralStr = (Request.QueryString["referral"] != null && Request.QueryString["referral"].ToUpper() == "TRUE") ? "&referral=true&status=Approved" : ("&status=" + eformStatus);

                    string redirectTo = baseUrl + "/Core/Eforms/Index.aspx?eform=" + eformName + "&epid=" + epid + "&eformId=" + eformId + referralStr;
                    // on top of eform name, need to append status=new and the patient epid (does not apply to referrals)

                    Response.Redirect(redirectTo);
                }
                else // we could not determine that this user has access to a dataset with this patient in it display message
                {
                    errorMessage.Text = "The system was unable to automatically direct you to the requested page. Please notify the system admin.";
                }
            }
            else
            {
                // default
                string purpose = Request.Form["purpose"].ToString();
                //Response.Redirect("Core/Utilities/Splash.aspx?login=true&purpose=" + purpose);
                Response.Redirect("Core/Utilities/SetAccessLevel.aspx?login=true&purpose=" + purpose);
            }
        }
Exemplo n.º 21
0
        protected void rptClinicItemCreated(Object Sender, RepeaterItemEventArgs e)
        {
            // create a reference to the current tr
            System.Web.UI.HtmlControls.HtmlContainerControl clinicListRow;
            clinicListRow = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("clinicListRow");


            // if the patient ID for this row is empty, clicking the row will cause a javascript alert.
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string localApptPatientId = "";
                string ptLastName         = "";
                string ptFirstName        = "";
                string ptMRN = "";

                DataRowView view = e.Item.DataItem as DataRowView;

                if (view != null)
                {
                    localApptPatientId = GetFieldValue(view, "ApptPatientId");
                    ptLastName         = GetFieldValue(view, "ApptLastName");
                    ptFirstName        = GetFieldValue(view, "ApptFirstName");
                    ptMRN = GetFieldValue(view, "ApptMRN");
                }

                //string localApptPatientId = ((DataRowView) e.Item.DataItem )["ApptPatientId"].ToString();
                //string ptLastName = ((DataRowView) e.Item.DataItem )["ApptLastName"].ToString();
                //string ptFirstName = ((DataRowView) e.Item.DataItem )["ApptFirstName"].ToString();
                //string ptMRN = ((DataRowView) e.Item.DataItem )["ApptMRN"].ToString();

                if (localApptPatientId == "")
                {
                    clinicListRow.Attributes.Add("onClick", "javascript:alert('This patient is not in the database.  No data is currently available for this patient.');");
                }
                else
                {
                    string epid = CustomCryptoHelper.Encrypt(localApptPatientId);
                    //build the url string for the row

                    string currentListRowUrl = "parent.location= patientRedirectPath + '?epid=" + epid;

                    if (ptLastName != "")
                    {
                        currentListRowUrl += "&ptLastName=" + ptLastName;
                    }

                    if (ptFirstName != "")
                    {
                        currentListRowUrl += "&ptFirstName=" + ptFirstName;
                    }

                    if (ptMRN != "")
                    {
                        currentListRowUrl += "&ptMRN=" + ptMRN;
                    }

                    //close off the url string
                    currentListRowUrl += "&verifyPatientId=true';";

                    clinicListRow.Attributes.Add("onClick", currentListRowUrl);
                }
            }
        }
Exemplo n.º 22
0
        protected void rptItemCreated(Object sender, RepeaterItemEventArgs e)
        {
            // create a reference to the current tr
            System.Web.UI.HtmlControls.HtmlContainerControl listRow;
            listRow = (System.Web.UI.HtmlControls.HtmlContainerControl)e.Item.FindControl("listRow");

            Literal inboxMessage;

            inboxMessage = (Literal)e.Item.FindControl("inboxMessage");
            //Please complete and approve <%# ((System.Data.DataRowView)Container.DataItem)["EFormName"]%> for <%# ((System.Data.DataRowView)Container.DataItem)["PtFirstName"]%> <%# ((System.Data.DataRowView)Container.DataItem)["PtLastName"]%> (MRN <%# ((System.Data.DataRowView)Container.DataItem)["PtMrn"]%>; DOB <%# ((System.Data.DataRowView)Container.DataItem)["PtBirthDateText"]%>)

            // if the patient ID for this row is empty, clicking the row will cause a javascript alert.
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string eformId        = ((DataRowView)e.Item.DataItem)[EForm.EFormId].ToString();
                string localPatientId = ((DataRowView)e.Item.DataItem)[EForm.PatientId].ToString();
                string eformName      = ((DataRowView)e.Item.DataItem)[EForm.EFormName].ToString();
                string status         = ((DataRowView)e.Item.DataItem)[EForm.CurrentStatus].ToString();
                string ptName         = ((DataRowView)e.Item.DataItem)[Patient.PtFirstName].ToString() + " " + ((DataRowView)e.Item.DataItem)[Patient.PtLastName].ToString();
                string ptMrn          = ((DataRowView)e.Item.DataItem)[Patient.PtMRN].ToString();

                if (localPatientId != "" && eformName != "")
                {
                    string urlVars = "eform=" + Server.UrlEncode(eformName) + "&status=" + status + "&epid=" + CustomCryptoHelper.Encrypt(localPatientId) + "&eformid=" + eformId + "";

                    listRow.Attributes.Add("onClick", "top.location='../Eforms/Index.aspx?" + urlVars + "';");
                }

                if (status.Equals(EformStatusManager.Status_DataEntryInProgress))
                {
                    inboxMessage.Text = "Please complete, review and approve " + eformName + " for " + ptName + " (MRN " + ptMrn + ") ";
                }
                else if (status.Equals(EformStatusManager.Status_DataEntryComplete))
                {
                    inboxMessage.Text = "Please review and approve " + eformName + " for " + ptName + " (MRN " + ptMrn + ") ";
                }
                else if (status.Equals(EformStatusManager.Status_Narrated))
                {
                    inboxMessage.Text = "Please approve " + eformName + " for " + ptName + " (MRN " + ptMrn + ") ";
                }
                else if (status.Equals(EformStatusManager.Status_Approved))
                {
                    inboxMessage.Text = "This eform is no longer editable, but please click to view the approved " + eformName + " for " + ptName + " (MRN " + ptMrn + ")";
                }
                else
                {
                    inboxMessage.Text = "Please click to view " + eformName + " for " + ptName + " (MRN " + ptMrn + ") ";
                }
            }
        }
Exemplo n.º 23
0
        public virtual void PopulateTableCell(TableCell cell, bool bPatientSpecific)
        {
            foreach (_PatientCalendarItem p in Schedule)
            {
                HyperLink label = new HyperLink();
                if (bPatientSpecific)
                {
                    // determine if passing along deviation infor
                    if (!string.IsNullOrEmpty(p.DeviationTable) && !string.IsNullOrEmpty(p.DeviationKey))
                    {
                        label.Attributes["onclick"] = "var rVal = loadPatientItem('" + CustomCryptoHelper.Encrypt(p.PatientItemId) + "','" + p.DeviationTable + "','" + p.DeviationKey + "'); if(rVal!=null) { return rVal; } else { return false; }";
                    }
                    else
                    {
                        label.Attributes["onclick"] = "var rVal = loadPatientItem('" + CustomCryptoHelper.Encrypt(p.PatientItemId) + "'); if(rVal!=null) { return rVal; } else { return false; }";
                    }
                }
                else
                {
                    label.Attributes["onclick"] = "var rVal = parent.loadPatientVisit('" + p.ProtocolId + "', '" + p.SchemaId + "','" + CustomCryptoHelper.Encrypt(p.PatientId) + "','" + p.TimelineId + "'); if(rVal!=null) { return rVal; } else { return false; }";
                }
                label.NavigateUrl = "#";
                label.Text        = p.Name;
                label.ToolTip     = string.Format("{0}{1}", GetVisitTitle(p), p.ItemDescriptions);

                label.CssClass = this.CssClass;
                GetJS(label, p, bPatientSpecific);
                cell.Controls.Add(label);
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Set url for each batch print link page
        /// </summary>
        protected void SetBatchLinks()
        {
            if (Request.QueryString["batchPrint"] != null)
            {
                // initialize batchLink, urlVarWithMonth, & patientIds for constucting links to seperate the batches
                string batchLink = "?batchPrint=true&proc=" + Request.QueryString["proc"].ToString();
                string urlVarWithMonth = "";
                string patientId, patientIds = "", patientIdsLBL = "";
                string link = "";
                int    currentPatientNumber;

                // tracks the # of forms that are currently being processed for current batch
                double formsThisBatch = 0;

                // get the max forms allowed per batch
                maxFormsPerPrintJob = GetmaxFormsPerPrintJob();

                // calculate total # of batches that need to print
                double totalBatches = Math.Ceiling((totalNumberOfPatients / (double)maxFormsPerPrintJob));

                // initialize the  frist and last form numbers for first batch
                startSurveyNum = 1;
                endSurveyNum   = maxFormsPerPrintJob;

                for (int i = 4; i < lengthQS; i++) // patients start at index 3 in QS
                {
                    // track the current patient
                    currentPatientNumber = i - 3;
                    currentForm          = currentPatientNumber;

                    // increment the # of forms that are being processed for current batch
                    formsThisBatch++;

                    // if the limit for the # of forms per batch has been reached
                    if ((formsThisBatch > maxFormsPerPrintJob))
                    {
                        // initialize a new batch link for the next batch of forms
                        patientIds      = "";
                        batchLink       = "?batchPrint=true&proc=" + Request.QueryString["proc"].ToString();
                        urlVarWithMonth = "";
                        formsThisBatch  = 1;
                    }

                    // add to comma separated list of patient ids to print labels
                    patientId   = Request.QueryString.GetKey(i);
                    patientIds += patientId + ",";

                    // Construct seperate querystring for the Labels (eg. BatchPrintLabelContainer.aspx?pIds=1,2,3")
                    patientIdsLBL += patientId + ",";

                    // add curent patient to current batch link parameters
                    batchLink       += "&" + patientId + "=" + Request[patientId];
                    urlVarWithMonth += "&" + patientId + "=" + Request[patientId];

                    // startSurveyNum signifies first form in current batch.
                    // if '(currentForm MODULUS maxFormsPerPrintJob) == 1', currentForm is the first form in current batch
                    // OR, if maxFormsPerPrintJob == 1, currentForm is the first (and last) form in current batch
                    if ((currentForm % maxFormsPerPrintJob) == 1 || (maxFormsPerPrintJob == 1))
                    {
                        startSurveyNum = currentForm;
                    }

                    // endSurveyNum signifies last form in current batch.
                    // if '(currentForm MODULUS maxFormsPerPrintJob) == 0', currentForm is the last form in current batch
                    if ((currentForm % maxFormsPerPrintJob) == 0)
                    {
                        endSurveyNum = currentBatch * maxFormsPerPrintJob;

                        // add parameters for all forms in current batch for the batch link
                        link += "<a target=\"FormsContent\" onclick=\"setURLHolder('" + urlVarWithMonth + "', '" + startSurveyNum + "', '" + endSurveyNum + "')\" href=\"" + _printFormsPage + batchLink + "\">[" + currentBatch + "]</a>&nbsp;&nbsp;";

                        // increment to next batch
                        currentBatch++;
                    }

                    // if last patient has been reached, but current batch is not full
                    else if (currentPatientNumber == totalNumberOfPatients)
                    {
                        endSurveyNum = totalNumberOfPatients;

                        // add parameters for all forms in current batch for the batch link
                        link += "<a target=\"FormsContent\" onclick=\"setURLHolder('" + urlVarWithMonth + "', '" + startSurveyNum + "', '" + endSurveyNum + "')\" href=\"" + _printFormsPage + batchLink + "\">[" + currentBatch + "]</a>&nbsp;&nbsp;";

                        // increment to next batch
                        currentBatch++;
                    }
                }

                // show the link to print batches if there is more than one
                string updateScript;

                if (totalBatches > 1)
                {
                    updateScript = "ShowFormContent(" + bool.FalseString.ToLower() + ")";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowFormContent", updateScript, true);

                    BatchPrintLinks.Text = totalNumberOfPatients + " forms have been split into " + totalBatches + " batches of (at most) " + maxFormsPerPrintJob + " for printing.  Select batch to print:&nbsp;&nbsp;" + link;
                }
                else
                {
                    updateScript = "ShowFormContent(" + bool.TrueString.ToLower() + ")";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowFormContent", updateScript, true);

                    BatchPrintLinks.Text = "";
                }

                // For the LABELS; the string patientIds is a comma separated values of patient ids
                if (patientIdsLBL.EndsWith(","))
                {
                    patientIdsLBL = patientIdsLBL.Remove(patientIdsLBL.Length - 1); //remove last comma ","
                }

                // construct the querystring for labels (eg. BatchPrintLabelContainer.aspx?pIds=1,2,3";)
                printLabelsPageUrlvVars += "?pIds=" + CustomCryptoHelper.Encrypt(patientIdsLBL); //encrypt first
            }
        }
Exemplo n.º 25
0
        protected void LoadPrintingMaterial()
        {
            DataView dv = new DataView(GetSelectedPatients());

            if (dv.Table.Columns.Contains("Mail"))
            {
                dv.RowFilter = "Mail = 1";
                if (dv.Count > 0)
                {
                    string patientIds = String.Empty;
                    foreach (DataRowView drv in dv)
                    {
                        if (String.IsNullOrEmpty(patientIds))
                        {
                            patientIds = drv[Patient.PatientId].ToString();
                        }
                        else
                        {
                            patientIds = patientIds + "," + drv[Patient.PatientId].ToString();
                        }
                    }

                    if (RbPrintTypeSurveys.Checked)
                    {
                        PrintSurveysLetterDiv.Style["display"] = "";
                        PrintLabelsDiv.Style["display"]        = "none";
                        printFormButtonAnchor.Visible          = false;
                        printFormButtonAnchor.HRef             = "";

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "SetPrintPackageSource('" + CustomCryptoHelper.Encrypt(patientIds) + "') ", true);
                    }
                    else if (RbPrintTypeLabels.Checked)
                    {
                        PrintSurveysLetterDiv.Style["display"] = "none";
                        PrintLabelsDiv.Style["display"]        = "";
                        printFormButtonAnchor.Visible          = true;
                        printFormButtonAnchor.HRef             = "javascript:printAddressLabels();";

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "LoadAddressLabels('" + CustomCryptoHelper.Encrypt(patientIds) + "') ", true);
                    }
                }
            }
        }
Exemplo n.º 26
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 protected string GetEncryptedPatientUrl()
 {
     if (Session[SessionKey.PatientId] != null && !string.IsNullOrEmpty(Session[SessionKey.PatientId].ToString()))
     {
         string url = Page.ResolveUrl("~/Core/DataEntryForms/Index.aspx?findClicked=true&epid=" + CustomCryptoHelper.Encrypt(Session[SessionKey.PatientId].ToString()));
         return(url);
     }
     else
     {
         return(string.Empty);
     }
 }
Exemplo n.º 27
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private string GetEncryptedPatientUrl()
        {
            string url = "../DataEntryForms/index.aspx?findClicked=true&epid=" + CustomCryptoHelper.Encrypt(Session[SessionKey.PatientId].ToString());

            return(url);
        }