コード例 #1
0
        public static void AddAttemptNumberToSession(string clientId, string sessionId, string attemptId)
        {
            if (LMSSession.IsInSession(ContentKeys.SESSION_ATTEMPT_ID))
            {
                return;
            }
            var idParts = attemptId.Split(new[] { '-' });

            if (idParts.Length > 2)
            {
                var sessionDam = new ContentModuleSessionDAM();
                sessionDam.AddAttemptNumber(clientId, sessionId, Convert.ToInt16(idParts[2]));
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.HttpMethod == "GET")
            {
                ////if (LMSSession.IsInSession(Client.CLIENT_SESSION_ID))
                ////    hdnClientId.Value = EncryptionManager.Encrypt(Convert.ToString(LMSSession.GetValue(Client.CLIENT_SESSION_ID)));

                if (LMSSession.IsInSession(ContentKeys.SESSION_ACTIVITYID))
                {
                    hdnContentModuleId.Value = EncryptionManager.Encrypt(Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID)));
                    courseId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID));
                }
                if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
                {
                    hdnUserId.Value = EncryptionManager.Encrypt(Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID)));
                    learnerId       = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
                }
                hdnCStartDate.Value = Convert.ToString(DateTime.UtcNow);
                return;
            }
            var    requestXml = LoadRequestXml();
            XMLLib xLib       = new XMLLib();

            if (requestXml == null)
            {
                Response.Redirect("DisplayError.aspx?error=SessionTimeout");
            }
            //sClientId = CommonManager.DecodeAndDecrypt(xLib.fGetValue(requestXml, "/Root/ClientId"));
            sessionId = xLib.fGetValue(requestXml, "/Root/SessionId");
            courseId  = EncryptionManager.Decrypt(Convert.ToString(hdnContentModuleId.Value));

            if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
            {
                hdnUserId.Value = EncryptionManager.Encrypt(Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID)));
                learnerId       = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
            }



            if (requestXml != null)
            {
                XmlNode oRootNode = null;

                if (xLib.fCreateFirstContext(requestXml, "Root", ref oRootNode))
                {
                    string useCase = xLib.fGetValue(requestXml, "/Root/Case");
                    ProcessRequest(requestXml, useCase);
                }
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string sCourseName = string.Empty;

            if (LMSSession.IsInSession(ContentKeys.SESSION_COURSENAME))
            {
                sCourseName = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_COURSENAME));

                if (sCourseName != "")
                {
                    lblContentModuleName.Text = sCourseName;
                }
            }
        }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID) || Request["firstLoad"] == "true")
     {
         if (Request.QueryString["SessionTimeOut"] != null &&
             Convert.ToString(Request.QueryString["SessionTimeOut"]) != string.Empty)
         {
             string sSessionTimeout = Convert.ToString(Request.QueryString["SessionTimeOut"]);
             bodyMain.Attributes.Add("onload", "fnSetSessionPoller(" + sSessionTimeout + ")");
         }
     }
     else
     {
         Response.Redirect("DisplayError.aspx?error=SessionTimeout");
     }
 }
コード例 #5
0
        /// <summary>
        /// This method return page elements text.
        /// </summary>
        /// <param name="entListPageElements">List<UserPageElementLanguage> entListPageElements</param>
        /// <param name="string">pElementName</param>
        /// <returns>string</returns>
        ///
        //public static string GetPageElementsText(List<UserPageElementLanguage> entListPageElements, string pElementName)
        //{
        //    string strElementText = string.Empty;
        //    UserPageElementLanguage entElementSearch = new UserPageElementLanguage();
        //    entElementSearch.ElementName = pElementName;

        //    UserPageElementLanguage entElementReturn = entListPageElements.Find(delegate(UserPageElementLanguage entElement)
        //    { return entElement.ElementName == entElementSearch.ElementName; });
        //    if (entElementReturn != null)
        //    {
        //        strElementText = entElementReturn.ElementText;
        //    }

        //    return strElementText;
        //}
        #endregion

        ////#region GetPageElements
        /////// <summary>
        /////// This method return user page elements.
        /////// </summary>
        /////// <param name="pClientId"></param>
        /////// <param name="pPageId"></param>
        /////// <param name="pLangId"></param>
        /////// <returns>string</returns>
        ///////
        ////public static List<UserPageElementLanguage> GetPageElements(string pClientId, string pPageId, string pLangId)
        ////{
        ////    List<UserPageElementLanguage> entListPageElements = new List<UserPageElementLanguage>();
        ////    UserPage entPage = new UserPage();
        ////    UserPageManager mgrUserPage = new UserPageManager();
        ////    entPage.ClientId = pClientId;
        ////    entPage.ID = pPageId;
        ////    entPage.ParaLanguageId = pLangId;

        ////    entPage = mgrUserPage.Execute(entPage, UserPage.Method.Get);
        ////    entListPageElements = entPage.PageElementLanguage;

        ////    return entListPageElements;
        ////}
        ////#endregion

        ////#region GetLearnerLanguage
        /////// <summary>
        /////// This method return current Learner language.
        /////// </summary>
        /////// <returns>string</returns>
        ///////
        ////public static string GetLearnerLanguage(Client entClient)
        ////{
        ////    string _strDefaultLanguage = string.Empty;
        ////    string _strLearnerId = string.Empty;
        ////    //Check for Learner Id in session
        ////    if (LMSSession.IsInSession(Learner.USER_SESSION_ID))
        ////    {
        ////        try
        ////        {

        ////            _strLearnerId = (string)LMSSession.GetValue(Learner.USER_SESSION_ID);
        ////            _strDefaultLanguage = CommonManager.GetLearnerDefaultLanguage(_strLearnerId);
        ////        }
        ////        catch
        ////        {
        ////            Learner entInnerlearner = (Learner)LMSSession.GetValue(Learner.USER_SESSION_ID);
        ////            if (entInnerlearner != null)
        ////                _strLearnerId = entInnerlearner.ID;

        ////            _strDefaultLanguage = CommonManager.GetLearnerDefaultLanguage(_strLearnerId);

        ////        }
        ////    }
        ////    else //Get Clients Language
        ////    {
        ////        if (LMSSession.IsInSession(CommonManager.SESSION_MYCULTURE))
        ////        {
        ////            _strDefaultLanguage = Convert.ToString(LMSSession.GetValue(CommonManager.SESSION_MYCULTURE));
        ////        }
        ////        else
        ////        {
        ////            //Check client cookie is present
        ////            string strClientID = entClient.ID;
        ////            if (LMSCookie.CheckCookie(strClientID))
        ////            {
        ////                _strDefaultLanguage = LMSCookie.GetCookieParam(strClientID, CommonManager.COOKIES_LANG);
        ////                LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, _strDefaultLanguage);
        ////            }
        ////            else //Create client cookie and set its value
        ////            {
        ////                LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, entClient.DefaultLanguageId);
        ////                _strDefaultLanguage = entClient.DefaultLanguageId;
        ////            }
        ////        }
        ////    }
        ////    string strLangTextDirection = CommonManager.LANGUAGE_TEXT_DIRECTION_LTR;

        ////    if (!String.IsNullOrEmpty(entClient.Language.TextDirection))
        ////        strLangTextDirection = entClient.Language.TextDirection;
        ////    LMSSession.AddSessionItem(CommonManager.SESSION_LANG_TEXTDIRC, strLangTextDirection);

        ////    entClient = null;
        ////    return _strDefaultLanguage;
        ////}
        ////#endregion

        ////public static string GetLearnerDefaultLanguage(string strLearnerId)
        ////{
        ////    string _strDefaultLanguage = string.Empty;
        ////    //Get Learner Language is in Cookie
        ////    if (LMSCookie.CheckCookie(strLearnerId))
        ////    {
        ////        _strDefaultLanguage = LMSCookie.GetCookieParam(strLearnerId, CommonManager.COOKIES_LANG);
        ////        LMSSession.AddSessionItem(CommonManager.SESSION_LEARNER_CULTURE, _strDefaultLanguage);
        ////        LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, _strDefaultLanguage);
        ////    }
        ////    else
        ////    {
        ////        //Get Learner Language in Session
        ////        if (LMSSession.IsInSession(CommonManager.SESSION_LEARNER_CULTURE))
        ////        {
        ////            _strDefaultLanguage = Convert.ToString(LMSSession.GetValue(CommonManager.SESSION_LEARNER_CULTURE));
        ////            LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, _strDefaultLanguage);
        ////        }
        ////        else
        ////        {
        ////            //Get Learner Language from Database
        ////            Learner entLearner = new Learner();
        ////            entLearner = CommonManager.GetLearnerById(strLearnerId);
        ////            if (entLearner != null && !string.IsNullOrEmpty(entLearner.DefaultLanguageId))
        ////            {
        ////                _strDefaultLanguage = entLearner.DefaultLanguageId;
        ////            }
        ////            else
        ////            {
        ////                Client _entClient = new Client();
        ////                _entClient = CommonManager.GetClient();
        ////                _strDefaultLanguage = _entClient.DefaultLanguageId;
        ////            }
        ////            LMSSession.AddSessionItem(CommonManager.SESSION_LEARNER_CULTURE, _strDefaultLanguage);
        ////            LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, _strDefaultLanguage);
        ////            LMSCookie.CreateUserCookies(strLearnerId);
        ////            LMSCookie.SetCookieParam(strLearnerId, CommonManager.COOKIES_LANG, _strDefaultLanguage);
        ////        }
        ////    }
        ////    return _strDefaultLanguage;
        ////}

        #region GetLearnerById
        /// <summary>
        /// Get Learner
        /// </summary>
        /// <param name="pstrUserId"></param>
        /// <returns>Learner</returns>
        public static Learner GetLearnerById(string pstrUserId)
        {
            Learner entLearner = new Learner();

            if (LMSSession.IsInSession(CommonManager.SESSION_LEARNER))
            {
                entLearner = (Learner)LMSSession.GetValue(CommonManager.SESSION_LEARNER);
            }
            else
            {
                LearnerManager mgrLearner = new LearnerManager();
                entLearner.ID = pstrUserId;

                entLearner = mgrLearner.Execute(entLearner, Learner.Method.Get);
                //Add learner into session
                LMSSession.AddSessionItem(CommonManager.SESSION_LEARNER, entLearner);
            }
            return(entLearner);
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            btnExitServer.Visible = false;
            if (!LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
            {
                if (String.IsNullOrEmpty(Request["clientId"]) || String.IsNullOrEmpty(Request["sessionId"]))
                {
                    Response.Redirect("DisplayError.aspx?error=SessionTimeout");
                }
                string sessionId = Request["sessionId"];
                string clientId  = CommonManager.DecodeAndDecrypt(Request["clientId"]);
                //if (!SessionManager.RestoreAspSession(clientId, sessionId))
                //{
                //    Response.Redirect("DisplayError.aspx?error=SessionTimeout");
                //}
            }
            if (Request.QueryString["ExitType"] != null && Convert.ToString(Request.QueryString["ExitType"]).Trim() != string.Empty)
            {
                if (LMSSession.IsInSession(ContentKeys.SESSION_IS_SAME_WINDOW))
                {
                    string sDefaultLang = "en-US";
                    if (LMSSession.IsInSession(ContentKeys.SESSION_LERNER_LANGUAGE_ID))
                    {
                        sDefaultLang = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LERNER_LANGUAGE_ID));
                    }

                    btnExitServer.Text = "Back To Home"; //MessageAdaptor.GetMessage(Services.Messages.Content.BACK_TO_HOME, sDefaultLang);

                    btnExitServer.Visible = Convert.ToBoolean(LMSSession.GetValue(ContentKeys.SESSION_IS_SAME_WINDOW));
                }
                else
                {
                    btnExitServer.Visible = false;
                }
            }
        }
コード例 #7
0
        protected void btnExitServer_Click(object sender, EventArgs e)
        {
            //Client entClient = CommonManager.GetClient();
            string sClientId         = "";// Convert.ToString(LMSSession.GetValue(Client.CLIENT_SESSION_ID));
            string sUserName         = Convert.ToString(LMSSession.GetValue(CommonKeys.SESSION_LOGEDUSERNAME));
            string sLearnerId        = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
            bool   blnIsAdminPreview = Convert.ToBoolean(LMSSession.GetValue(ContentKeys.SESSION_IS_FOR_ADMIN_PREVIEW));
            string CourseId          = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID));
            bool   bIsSSOLogin       = false; //This value will be initially passed to player from Application

            if (LMSSession.IsInSession(CommonManager.IS_SSO_LOGIN))
            {
                bIsSSOLogin = Convert.ToBoolean(LMSSession.GetValue(CommonManager.IS_SSO_LOGIN));
            }
            string sessionId = Request["sessionId"];

            if (!String.IsNullOrEmpty(sessionId))
            {
                new ContentModuleSessionDAM().Expire(sClientId, sessionId);
            }

            //LoginKey entLoginKey = new LoginKey();
            //entLoginKey.SystemUserGUID = sLearnerId;
            //entLoginKey.UserNameAlias = sUserName;
            //entLoginKey.IsSSOLogin = bIsSSOLogin;
            ////Issue No # 127
            ////entLoginKey.StartUrl = "http://" + entClient.ClientAccessURL + LMSSession.GetValue(ContentKeys.SESSION_RET_TOSERVER_URL).ToString() ;
            //if (blnIsAdminPreview) //If from Admin Site
            //{
            //    entLoginKey.StartUrl = "/pages/content/managecourses.aspx?Id=8s9";
            //}
            //else
            //{
            //    entLoginKey.StartUrl = "/Pages/mainpage.aspx";
            //}


            //entLoginKey.ClientId = sClientId;
            ////This value will be initially passed to player from Application
            //if (LMSSession.IsInSession(CommonManager.SESSION_GRID_PAGE_SIZE))
            //{
            //    entLoginKey.PageSize = Convert.ToInt32(LMSSession.GetValue(CommonManager.SESSION_GRID_PAGE_SIZE));
            //}
            //else
            //{
            //    entLoginKey.PageSize = CommonManager.GRID_DEFAULT_PAGE_SIZE;
            //}
            //LoginKeyManager mgrLoginKey = new LoginKeyManager();
            //entLoginKey = mgrLoginKey.Execute(entLoginKey, LoginKey.Method.Add);
            string sResponseRedirect = string.Empty;

            //////////-aw 6/29/2011 Return to the default protocol
            ////////string sProtocol;

            ////////sProtocol = entClient.IsHTTPSAllowed
            ////////                ? ConfigurationManager.ConnectionStrings[CommonManager.DEFAULT_PROTOCOL].ConnectionString
            ////////                : "http";

            ////////if (blnIsAdminPreview) //If from Admin Site
            ////////{
            ////////    //-aw 6/29/2011 Return to the default protocol
            ////////    //sResponseRedirect = Request.Url.Scheme + "://" + entClient.ClientAccessURL + "/Admin/SSOLogin.aspx?lid=" + HttpUtility.UrlEncode(entLoginKey.ID);
            ////////    sResponseRedirect = sProtocol + "://" + entClient.ClientAccessURL + "/Admin/SSOLogin.aspx?lid=" + HttpUtility.UrlEncode(entLoginKey.ID) + "&AID=" + HttpUtility.UrlEncode(CourseId); ;
            ////////}
            ////////else //for Learner Site
            ////////{
            ////////    //-aw 6/29/2011 Return to the default protocol
            ////////    //sResponseRedirect = Request.Url.Scheme + "://" + entClient.ClientAccessURL + "/SSOLogin.aspx?lid=" + HttpUtility.UrlEncode(entLoginKey.ID);

            ////////    sResponseRedirect = sProtocol + "://" + entClient.ClientAccessURL + "/SSOLogin.aspx?lid=" + HttpUtility.UrlEncode(entLoginKey.ID) + "&AID=" + HttpUtility.UrlEncode(CourseId); ;
            ////////}
            sResponseRedirect = System.Configuration.ConfigurationManager.AppSettings["sAppUrl"] + System.Configuration.ConfigurationManager.AppSettings["Launchlink"].ToString();
            ScriptManager.RegisterClientScriptBlock(Page, this.Page.GetType(), "", "parent.fnExitFrame();parent.ChangeURL('" + sResponseRedirect + "')", true);
        }
コード例 #8
0
        private void SaveSuspendData(XmlDocument requestXml)
        {
            string strContentModuleId = string.Empty;
            string strAttempId        = string.Empty;
            string strSystemUserGUID  = string.Empty;
            string strClientId        = string.Empty;

            if (LMSSession.IsInSession(ContentKeys.SESSION_ACTIVITYID))
            {
                strContentModuleId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID));
            }
            if (LMSSession.IsInSession(ContentKeys.SESSION_ATTEMPT_ID))
            {
                strAttempId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ATTEMPT_ID));
            }
            if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
            {
                strSystemUserGUID = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
            }
            if (LMSSession.IsInSession("CLIENT_SESSION_ID"))
            {
                strClientId = Convert.ToString(LMSSession.GetValue("CLIENT_SESSION_ID"));
            }

            if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnClientId.Value))
            {
                strClientId = EncryptionManager.Decrypt(hdnClientId.Value);
            }

            if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnContentModuleId.Value))
            {
                strContentModuleId = EncryptionManager.Decrypt(hdnContentModuleId.Value);
            }

            if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnUserId.Value))
            {
                strSystemUserGUID = EncryptionManager.Decrypt(hdnUserId.Value);
            }


            if (string.IsNullOrEmpty(strContentModuleId) || string.IsNullOrEmpty(strSystemUserGUID) || string.IsNullOrEmpty(strClientId))
            {
                RedirectToMainPage();
            }
            else
            {
                //var activityAssignment = CoursePlayerAssignmentManager.GetAssignmentForLaunch(strClientId, strContentModuleId, strSystemUserGUID, LaunchSite.Learner);
                //if (activityAssignment.ActivityStatus != ActivityCompletionStatus.Completed)
                //{
                //List<UserAssessmentQuestionTracking> lstQTrack = BusinessManager.UserDataXMLUtil.GetSuspendData(requestXml, strContentModuleId, strAttempId, strSystemUserGUID, strClientId);

                //#region SaveTracking
                //if (lstQTrack != null && lstQTrack.Count > 0)
                //{
                //    try
                //    {
                //        UserAssessmentQuestionTrackingManager objAssessmentQTrackMgr = new UserAssessmentQuestionTrackingManager();
                //        List<UserAssessmentQuestionTracking> lstRetAssessmentQTrack = new List<UserAssessmentQuestionTracking>();

                //        lstRetAssessmentQTrack = objAssessmentQTrackMgr.Execute(lstQTrack, UserAssessmentQuestionTracking.ListMethod.BulkAdd);
                //    }
                //    catch
                //    {

                //    }
                //}
                //#endregion
                //}
            }
        }
コード例 #9
0
        private void ProcessRequest(XmlDocument RequestXMLObj, string useCase)
        {
            switch (useCase)
            {
            case "SaveCurrentSco":
                try
                {
                    string strContentModuleId = string.Empty;
                    string strLearnerId       = string.Empty;
                    ////string strClientId = string.Empty;

                    if (LMSSession.IsInSession(ContentKeys.SESSION_ACTIVITYID))
                    {
                        strContentModuleId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_ACTIVITYID));
                    }

                    if (LMSSession.IsInSession(ContentKeys.SESSION_LEARNER_ID))
                    {
                        strLearnerId = Convert.ToString(LMSSession.GetValue(ContentKeys.SESSION_LEARNER_ID));
                    }

                    ////if (LMSSession.IsInSession(Client.CLIENT_SESSION_ID))
                    ////    strClientId = Convert.ToString(LMSSession.GetValue(Client.CLIENT_SESSION_ID));

                    ////if (string.IsNullOrEmpty(strClientId) && !string.IsNullOrEmpty(hdnClientId.Value))
                    ////{
                    ////    strClientId = EncryptionManager.Decrypt(hdnClientId.Value);
                    ////}

                    if (!string.IsNullOrEmpty(hdnContentModuleId.Value))
                    {
                        strContentModuleId = EncryptionManager.Decrypt(hdnContentModuleId.Value);
                    }

                    if (!String.IsNullOrEmpty(strContentModuleId))
                    {
                        bool flag = false;
                        if (hdnContentModuleIdIsA.Value == String.Empty)
                        {
                            ContentModuleManager _CMManager       = new ContentModuleManager();
                            ContentModule        entContentModule = new ContentModule();
                            entContentModule.ID = strContentModuleId;
                            ////entContentModule.ClientId = strClientId;
                            entContentModule            = _CMManager.Execute(entContentModule, ContentModule.Method.GetByIDCoursePlayer);
                            flag                        = entContentModule.IsAssessment;
                            hdnContentModuleIdIsA.Value = entContentModule.IsAssessment.ToString();
                        }
                        else
                        {
                            flag = Convert.ToBoolean(hdnContentModuleIdIsA.Value);
                        }

                        if (flag)
                        {
                            SaveSuspendData(RequestXMLObj);
                        }
                    }
                    else
                    {
                        RedirectToMainPage();
                    }
                }
                catch (Exception ex)
                {
                }

                SaveCurrentSco(RequestXMLObj);
                ////string xmlFromPost = Request["TARecords"];

                break;
            }
        }