UserSessionStorage CreateStorage() { if (user.IsGuest) { var storage = new UserSessionStorage(); return(storage); } var data = UsersAccessor.Get(user.UserId); if (data != null) { try { var storage = new UserSessionStorage(); storage.SessionId = data.UserId; storage.Username = data.Username; storage.Mobile = data.Mobile; storage.Email = data.Email; storage.Title = data.Title; storage.Name = data.Name; storage.Password = data.Password; storage.PermissionCode = data.PermissionCode; return(storage); } catch { user.Logout(); } } user.Logout(); return(new UserSessionStorage()); }
/// <summary> /// 执行搜索 /// </summary> public PagerModel <Users> Search() { this.ThrowExceptionIfValidateFailure(); PagerModel <Users> pager = new PagerModel <Users>() { Index = PageIndex, Size = PageSize }; UsersAccessor.Get(pager, Keyword, Status); return(pager); }
/// <summary> /// 获取指定学员的学习进度信息 /// </summary> /// <returns></returns> private Student GetStudent(long studentId) { Student student = null; if (Students != null) { student = Students.FirstOrDefault(p => p.UserId == studentId); } else { //该学员的学习计划 var userPlan = UserStudyPlanAccessor.Get(ID, studentId); //学习信息 var user = UsersAccessor.Get(studentId); ThrowExceptionIfValidateFailure(() => { if (userPlan == null) { AddBrokenRule(StudyPlanEditFailureRule.STUDENT_NOT_EXISTS); } }); return(new Student { UserId = studentId, Email = user.Email, Mobile = user.Mobile, Username = user.Username, Name = user.Name, Title = user.Title, StudyStatus = userPlan.Status, Progress = userPlan.Progress, LastStudyTime = userPlan.UpdateTime }); } return(student); }
/// <summary> /// 实例化<see cref="CourseStudy"/>对象 /// </summary> /// <param name="chapter">课程章节</param> /// <param name="studentId">学员ID</param> public CourseStudy(long studentId, Data.Entity.Chapter chapter) { Chapter = chapter; Student = UsersAccessor.Get(studentId); }
/// <summary> /// 实例化<see cref="CourseStudy"/>对象 /// </summary> /// <param name="studentId">学员ID</param> /// <param name="chapterId">学习的课程章节ID</param> public CourseStudy(long studentId, long chapterId) { Chapter = ChapterAccessor.Get(chapterId); Student = UsersAccessor.Get(studentId); }