private ContentModuleTracking GetTracking(string clientId, ContentModuleSession session) { var contModTracking = new ContentModuleTracking { UserID = session.SystemUserGuid, ContentModuleId = session.ContentModuleId, ClientId = clientId }; if (session.Attempt.HasValue) { contModTracking.ID = session.Assignment.ID + "-" + session.SystemUserGuid + "-" + session.Attempt.Value; } contModTracking.IsResume = session.IsReview; contModTracking.ContentType = session.ContentModule.ContentModuleTypeId; contModTracking = _contentModuleTrackingRepository.GetContentModuleLessonTracking(contModTracking); contModTracking.IsForAdminPreview = (session.LaunchSite == LaunchSite.Admin); contModTracking.UserID = session.SystemUserGuid; contModTracking.UserFirstLastName = session.Learner.LastName + ", " + session.Learner.FirstName; contModTracking.ContentModuleId = session.ContentModuleId; contModTracking.SessionId = session.SessionId; contModTracking.TotalNoOfPages = session.ContentModule.TotalLessons; contModTracking.ContentType = session.ContentModule.ContentModuleTypeId; return(contModTracking); }
private ContentModuleTracking GetTrackingHRS(ContentModuleSession session) { var contModTracking = new ContentModuleTracking { UserID = session.SystemUserGuid, ContentModuleId = session.ContentModuleId }; //if (session.Attempt.HasValue) //{ contModTracking.ID = session.SystemUserGuid + "CTR" + IDGenerator.GetUniqueKey(16); //} contModTracking.IsResume = session.IsReview; contModTracking.ContentType = session.ContentModule.ContentModuleTypeId; contModTracking = _contentModuleTrackingRepository.GetContentModuleLessonTracking(contModTracking); contModTracking.IsForAdminPreview = false; // (session.LaunchSite == LaunchSite.Admin); contModTracking.UserID = session.SystemUserGuid; contModTracking.UserFirstLastName = session.Learner.LastName + ", " + session.Learner.FirstName; contModTracking.ContentModuleId = session.ContentModuleId; contModTracking.SessionId = session.SessionId; contModTracking.TotalNoOfPages = session.ContentModule.TotalLessons; contModTracking.ContentType = session.ContentModule.ContentModuleTypeId; return(contModTracking); }
private static ContentModuleSession PopulateContentModuleSession(SqlDataReader reader) { if (!reader.HasRows) { return(null); } ContentModuleSession session = new ContentModuleSession(); reader.Read(); reader.SetValueForColumn <Guid>("SessionId", i => session.SessionId = i.ToString()); reader.SetValueForColumn <string>("ContentModuleId", i => session.ContentModuleId = i); reader.SetValueForColumn <string>("SystemUserGuid", i => session.SystemUserGuid = i); reader.SetValueForColumn <int?>("Attempt", i => session.Attempt = i); reader.SetValueForColumn <int?>("GridPageSize", i => session.GridPageSize = i); reader.SetValueForColumn <string>("LaunchSite", i => session.LaunchSite = (i == "A") ? LaunchSite.Admin : LaunchSite.Learner); reader.SetValueForColumn <bool>("IsReview", i => session.IsReview = i); reader.SetValueForColumn <bool>("SsoLogin", i => session.SsoLogin = i); reader.SetValueForColumn <bool>("SameWindow", i => session.SameWindow = i); reader.SetValueForColumn <string>("ReturnUrl", i => session.ReturnUrl = i); reader.SetValueForColumn <DateTime>("Expiration", i => session.Expiration = i); return(session); }
public static void PopulateSessionVariables(Learner learner, ContentModuleSession session, Course assignment) { LMSSession.AddSessionItem(CommonKeys.SESSION_LOGEDUSERNAME, learner.UserName); LMSSession.AddSessionItem(ContentKeys.SESSION_USER_LAST_FIRST_NAME, learner.LastName + ", " + learner.FirstName); //LMSSession.AddSessionItem(Client.CLIENT_SESSION_ID, learner.ClientId); LMSSession.AddSessionItem(ContentKeys.SESSION_LEARNER_ID, session.SystemUserGuid); LMSSession.AddSessionItem(ContentKeys.SESSION_USERNAMEALIAS, learner.UserName); // LMSSession.AddSessionItem(ContentKeys.SESSION_LERNER_LANGUAGE_ID, learner.DefaultLanguageId); //LMSSession.AddSessionItem(ContentKeys.SESSION_RVSETTINGS, learner.RegionViewName); LMSSession.AddSessionItem(ContentKeys.SESSION_RET_TOSERVER_URL, session.ReturnUrl); LMSSession.AddSessionItem(ContentKeys.SESSION_ISREVIEW, session.IsReview); LMSSession.AddSessionItem(ContentKeys.SESSION_IS_FOR_ADMIN_PREVIEW, (session.LaunchSite == LaunchSite.Admin)); LMSSession.AddSessionItem(CommonManager.IS_SSO_LOGIN, session.SsoLogin); LMSSession.AddSessionItem(ContentKeys.SESSION_IS_SAME_WINDOW, session.SameWindow); if (session.GridPageSize.HasValue) { LMSSession.AddSessionItem(CommonManager.SESSION_GRID_PAGE_SIZE, session.GridPageSize.Value); } if (session.Attempt.HasValue) { LMSSession.AddSessionItem(ContentKeys.SESSION_ATTEMPT_ID, assignment.ActivityId + "-" + learner.EmployeeId + "-" + session.Attempt.Value); } LMSSession.AddSessionItem(ContentKeys.SESSION_ACTIVITYID, assignment.ActivityId); LMSSession.AddSessionItem(ContentKeys.SESSION_COURSENAME, assignment.ContentModuleName); LMSSession.AddSessionItem(ContentKeys.SESSION_ACTIVITY_ISAUTH, true); }
private Learner GetLearnerHRS(ContentModuleSession session) { var currentUser = new Learner { ID = session.SystemUserGuid }; return(new LearnerManager().Execute(currentUser, Learner.Method.GetUser_CoursePlayer)); }
//public static bool RestoreAspSession(string clientId, string sessionId) //{ // //if (LMSSession.IsInSession(Client.CLIENT_SESSION_ID)) // //{ // // return true; // //} // var sessionDam = new ContentModuleSessionDAM(); // var session = sessionDam.GetById(clientId, sessionId); // if (session == null) // { // return false; // } // var mgrLearner = new LearnerManager(); // var currentUser = new Learner { ID = session.SystemUserGuid, ClientId = clientId }; // currentUser = mgrLearner.Execute(currentUser, Learner.Method.GetUser_CoursePlayer); // var assignmentManager = new ActivityAssignmentManager(); // var assignment = new ActivityAssignment { ID = session.ContentModuleId, UserID = session.SystemUserGuid, ClientId = clientId }; // assignment = assignmentManager.Execute(assignment, ActivityAssignment.Method.CheckAssignment_CoursePlayer); // PopulateSessionVariables(currentUser, session, assignment); // if (assignment.ActivityType == ActivityContentType.Scorm12) // { // LMSSession.AddSessionItem(ContentKeys.SESSION_TOTAL_NO_PAGES, ManifestReader.GetTotalPages(clientId, assignment.ID)); // } // return true; //} public static string CreateSession(string clientId, ContentModuleSession session) { var sessionDam = new ContentModuleSessionDAM(); session = sessionDam.Save(clientId, session); return(session.SessionId); }
private ActivityAssignment GetAssignment(string clientId, ContentModuleSession session) { var assignment = new ActivityAssignment { ID = session.ContentModuleId, UserID = session.SystemUserGuid, ClientId = clientId }; //return new ActivityAssignmentManager().Execute(assignment, ActivityAssignment.Method.CheckAssignment_CoursePlayer); return(assignment); }
/// <summary> /// Launches activity /// </summary> /// <param name="activityAssignment"></param> private void LaunchActivity(Course activityAssignment, ContentModuleSession session, Learner currentUser) //, ContentModuleSession session { SessionManager.PopulateSessionVariables(currentUser, session, activityAssignment); LMSSession.RemoveSessionItem(ContentKeys.SESSION_ATTEMPT_ID); LMSSession.RemoveSessionItem(ContentKeys.SESSION_TOTAL_NO_PAGES); string sessionId = session.SystemUserGuid + "--" + session.ContentModuleId; string sLaunchPlayer; sLaunchPlayer = "HTMLGetSCORM.htm?sessionId=" + sessionId + "&contentmoduleid=" + session.ContentModuleId + "&learnerid=" + session.SystemUserGuid;// +"&LangId=" + langId; Response.Redirect(sLaunchPlayer); }
public ContentModuleSession GetById(string clientId, string sessionId) { const string storedProcedure = "sproc_ContentModuleSession_sel"; SqlParameter parameter = new SqlParameter("SessionId", SqlDbType.VarChar, 100); parameter.Value = sessionId; ContentModuleSession session = null; Action <SqlDataReader> onReaderCreated = r => session = PopulateContentModuleSession(r); ExecuteReader(storedProcedure, clientId, onReaderCreated, parameter); return(session); }
public ContentModuleSession GetByIdForCourseLaunch(string learnerId, string contentmoduleId) { ContentModuleSessionDAM contentModuleSessionDAM = new ContentModuleSessionDAM(); var session = new ContentModuleSession();//contentModuleSessionDAM.GetById(learnerId, sessionId); //////////////////////Session session.ContentModuleId = contentmoduleId; session.SystemUserGuid = learnerId; //////////////////////Learner session.Learner = GetLearnerHRS(session); //////session.Learner.FirstName = "B"; //////session.Learner.LastName = "S"; //////session.Learner.LearnerId = learnerId; session.Assignment = new ActivityAssignment(); //GetAssignment(clientId, session); ///////////////////////// ContentModule session.ContentModule = GetContentModule(session); //session.ContentModuleTracking = new ContentModuleTracking();//GetTracking(clientId, session); session.ContentModuleTracking = GetTrackingHRS(session); return(session); }
private ContentModule GetContentModule(ContentModuleSession session) { return(_contentModuleRetriever.GetContentModule(session.ContentModuleId)); }
public ContentModuleSession Save(string clientId, ContentModuleSession session) { var contentModuleSessionDAM = new ContentModuleSessionDAM(); return(contentModuleSessionDAM.Save(clientId, session)); }
public ContentModuleSession Save(string clientId, ContentModuleSession session) { const string storedProcedure = "sproc_ContentModuleSession_GetNew"; SqlParameter contentModuleParameter = new SqlParameter("ContentModuleId", SqlDbType.VarChar, 100) { Value = session.ContentModuleId }; SqlParameter userParameter = new SqlParameter("SystemUserGuid", SqlDbType.VarChar, 100) { Value = session.SystemUserGuid }; SqlParameter gridPageParameter = new SqlParameter("GridPageSize", SqlDbType.Int); if (session.GridPageSize.HasValue) { gridPageParameter.Value = session.GridPageSize.Value; } else { gridPageParameter.Value = DBNull.Value; } SqlParameter attemptParameter = new SqlParameter("Attempt", SqlDbType.Int); if (session.Attempt.HasValue) { attemptParameter.Value = session.Attempt.Value; } else { attemptParameter.Value = DBNull.Value; } SqlParameter launchSiteParameter = new SqlParameter("LaunchSite", SqlDbType.Char, 1) { Value = (session.LaunchSite == LaunchSite.Admin) ? "A" : "L" }; SqlParameter reviewParameter = new SqlParameter("IsReview", SqlDbType.Bit) { Value = session.IsReview }; SqlParameter ssoParameter = new SqlParameter("SsoLogin", SqlDbType.Bit) { Value = session.SsoLogin }; SqlParameter windowParameter = new SqlParameter("SameWindow", SqlDbType.Bit) { Value = session.SameWindow }; SqlParameter returnParameter = new SqlParameter("ReturnUrl", SqlDbType.NVarChar, 500) { Value = session.ReturnUrl }; SqlParameter expirationParameter = new SqlParameter("Expiration", SqlDbType.DateTime) { Value = session.Expiration }; session.SessionId = ExecuteScalar <Guid>(storedProcedure, clientId, contentModuleParameter, userParameter, gridPageParameter, attemptParameter, launchSiteParameter, reviewParameter, ssoParameter, windowParameter, returnParameter, expirationParameter).ToString(); return(session); }
//public ICoursePlayerAssignmentManager CoursePlayerAssignmentManager { get; set; } protected void Page_Load(object sender, EventArgs e) { // string aid = Request.Params["AID"]; //if (Request.Params["AID"] == null || Request.Params["client"] == null || // Request.Params["LID"] == null || Request.Params["Preview"] == null) if (Request.Params["AID"] == null || Request.Params["LID"] == null) { Response.Write("Course Preview not available. Please Contact Administrator."); Response.End(); } //Response.Write("<BR>AID : " + Request.Params["AID"]); //Response.Write("<BR>LID : " + Request.Params["LID"]); //Response.End(); //string activityId = CommonManager.DecodeAndDecrypt(Request.Params["AID"]); //string clientId = CommonManager.DecodeAndDecrypt(Request.Params["client"]); string activityId = Request.Params["AID"]; string learnerId = Request.Params["LID"]; string langId = Request.Params["Lang"]; if (string.IsNullOrEmpty(langId)) { langId = "en-US"; } LMSSession.AddSessionItem(CommonManager.SESSION_MYCULTURE, langId); bool isReview = CheckReview(); bool isForAdminPreview = false; bool isSsoLogin = CheckSso(); bool isSameWindow = CheckSameWindow(); string returnUrl = CheckReturnUrl(isForAdminPreview); int? gridPageSize = CheckGridPageSize(); var session = new ContentModuleSession { ContentModuleId = activityId, Expiration = DateTime.UtcNow.AddDays(2), IsReview = isReview, SystemUserGuid = learnerId, LaunchSite = isForAdminPreview ? LaunchSite.Admin : LaunchSite.Learner, SsoLogin = isSsoLogin, SameWindow = isSameWindow, ReturnUrl = returnUrl, GridPageSize = gridPageSize }; Course oCourse = new Course(); oCourse.ActivityId = activityId; oCourse.LearnerId = learnerId; var assignment = ContentModuleBLL.GetUserContentModuleTracking(oCourse); if (Convert.ToString(assignment.RetMessage) != "success") { Response.Write("Error Occured: " + Convert.ToString(assignment.RetMessage)); } // checks if activity already exists. if (assignment.ContentTrackId != null) { Learner oLearner = new Learner(); oLearner.ID = learnerId; LaunchActivity(assignment, session, oLearner); } }