コード例 #1
0
ファイル: Splash.aspx.cs プロジェクト: aomiit/caisis
        /// <summary>
        /// Send user directly to a module
        /// </summary>
        /// <param name="modTab"></param>
        private void RedirectToModule(string modTab)
        {
            string modUrl = PageUtil.GetBasePath(this.Request) + "/Core" + modTab;

            Response.Redirect(modUrl, true);
        }
コード例 #2
0
ファイル: Login.aspx.cs プロジェクト: aomiit/caisis
        /// <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);
            }
        }