예제 #1
0
        public JsonResult GetHomeNumber()
        {
            //晋升路径
            int promotionWays = _promotionWayManager.GetUserPromotionWaysCount(CurrentUser.UserId);
            //新上传的知识
            //int newKnowledge =
            //    _resourceManager.GetResourceCountByTime(SampleLoginLog.GetLastLoginTime(CurrentUser.UserId));
            //积分
            int integral = 0;// IntegrationManager.Instence.GetUserRankIntegral(CurrentUser.UserId).TotalIntegral;
            //粉丝数
            int fcount = _shipService.GetFansCount(CurrentUser.UserId);
            //关注
            int acount = _shipService.GetAttentionCount(CurrentUser.UserId);
            //待参与的问卷
            int partSurveyCount = _surveyManager.GetParticipateSurveyCount(CurrentUser.UserId, CurrentUser.TenantId);


            //指派的课程数量
            int designateCourseCount = _learningDesignate.GetDesignateCourseCount(CurrentUser.UserId, -1);
            var totalCount           = 0;
            //待参与的培训数量
            int trainCount = _trainLearningManager.GetMyClassList(out totalCount, CurrentUser.UserId, " tt.EndTime>=getdate()", 1, int.MaxValue).Count();//SystemCache.Instance.ParticipationTrainCount(CurrentUser.TenantId, CurrentUser.UserId,_trainManager.GetMyNotParticipationTrainCount);
            //待参与考试的数量
            int examCount = _examTestManager.GetMyparticipateExamTestCount(CurrentUser.UserId);
            //学时
            int mylearnTime = _learningRecord.GetMyLearnTime(CurrentUser.UserId);
            //学分
            var        learnScore    = _userLevelService.GetUserLearnScore(CurrentUser.UserId);
            List <int> messageCounts = _userMessageManager.GetAllNotReadSysRecMessageCount(CurrentUser.UserId);
            var        messageCount  = messageCounts[0];

            return(Json(new
            {
                acount,
                fcount,
                mylearnTime,
                learnScore,
                partSurveyCount,
                promotionWays,
                designateCourseCount,
                examCount,
                trainCount,
                messageCount,
                integral,
            }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public JsonResult GetUserInfo(string username)
        {
            var um       = new UserManager();
            var aService = new ActivityService();
            var u        = um.GetUserByName(username);

            this.SessionExt()["currentUser"] = u;

            if (u == null)
            {
                return(Json(new { result = 0, msg = "未找到 " + username + " 对应的用户" }, JsonRequestBehavior.AllowGet));
            }
            var activity = aService.GetUserLastActivity(u.UserId);

            //待参与的问卷
            int partSurveyCount = _surveyManager.GetParticipateSurveyCount(u.UserId, u.TenantId);
            //待参与的培训数量
            var notParticipationTrainCount = //_trainManager.GetMyNotParticipationTrainCount(CurrentTenant.TenantId, CurrentUser.UserId);
                                             BusinessCache.SystemCache.Instance.ParticipationTrainCount(u.TenantId, u.UserId, _trainManager.GetMyNotParticipationTrainCount);
            //待参与的考试
            var examCount = _examTestManager.GetMyparticipateExamTestCount(u.UserId);
            //待参与的培训
            var messageCount = _userMessageManager.GetAllNotReadSysRecMessageCount(u.UserId);

            //指派给我的课程
            var designateCourseCount = _learningDesignate.GetDesignateCourseCount(u.UserId, -1);

            return(Json(new
            {
                result = 1,
                userInfo = new
                {
                    u.UserId,
                    u.Realname,
                    u.DeptLevelPath,
                    photoUrl = Url.Content(u.photoUrl),
                    LastActivity = activity == null ? "" : activity.ResourceName.NoHtml(),
                    partSurveyCount,
                    notParticipationTrainCount,
                    examCount,
                    messageCount,
                    designateCourseCount
                }
            }, JsonRequestBehavior.AllowGet));
        }