Esempio n. 1
0
        /// <summary>
        /// Initializes Session variables when application is set to development Mode.  This event fires when user
        /// session begins.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Session_Start(Object sender, EventArgs e)
        {
            SecurityController sc = new SecurityController();

            if (sc.CheckDevelopmentMode())
            {
                //default development values: must be corresponding record in development database or development mode will cause error on login page
                try
                {
                    UserDa da          = new UserDa();
                    int    userLoginId = da.RecordUserLogin(HttpContext.Current.User.Identity.Name);

                    Session[SessionKey.DatasetId]     = 1;
                    Session[SessionKey.PatientId]     = 1;
                    Session[SessionKey.LoginId]       = 0;// userLoginId;
                    Session[SessionKey.GroupViewCode] = "PATIENT LISTS,PATIENT DATA,FORMS,DATA ANALYSIS,PROTOCOL MANAGER,EFORMS";
                    Session[SessionKey.PtMRN]         = "00000000";
                    Session[SessionKey.PtFirstName]   = "John";
                    Session[SessionKey.PtLastName]    = "Doe";
                    Session[SessionKey.PtDOB]         = "01/01/1950";
                }
                catch (System.Data.SqlClient.SqlException noDevelopmentModeInfoInDatabaseException)
                {
                    string output = "<strong>Your system is in Development Mode and does not have the required User and Patient in the database.<br>" +
                                    "Development mode puts a default user and patient in session so you can update code without logging in after each change.<br>We recommend using developmentMode only if you will be making very frequent updates to the code. It should ALWAYS be turned off when testing." +
                                    "<br><br><font color=red>To turn OFF development mode, set the \"developmentMode\" key equal to FALSE in the web.config file.</font><br><br>" +
                                    "To use developmentMode, add the UserName \"DevModeUser\" to your Users table, and add the following patient to your Patients table:<br>PtMRN = 00000000<br>PtFirstName = John<br>PtLastName = Doe<br>PtDOB = 01/01/1950";
                    Response.Write(output);

                    Response.Write("<br><br><br>Exception Detail: " + noDevelopmentModeInfoInDatabaseException.Message);
                }
                return;
            }
        }