Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
0
 /// <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);
 }
Esempio n. 5
0
 /// <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);
 }