Ejemplo n.º 1
0
        /// <summary>
        /// 我的培训班报名
        /// </summary>
        /// <returns></returns>
        public JsonResult GetMyClassList(string trainname = "", string startTime = "", string endTime = "", string username = "",
                                         int status       = -1, int pageIndex    = 1, int pageSize    = 10)
        {
            try
            {
                var totalCount = 0;

                #region 条件
                var where = " 1=1 ";
                if (!string.IsNullOrEmpty(trainname))
                {
                    where += string.Format(" AND tp.TrainName like '%{0}%'", trainname.ReplaceSql());
                }
                if (!string.IsNullOrEmpty(startTime))
                {
                    where += string.Format(" and tt.StartTime >= '{0}'", DateTime.Parse(startTime));
                }
                if (!string.IsNullOrEmpty(endTime))
                {
                    where += string.Format(" and tt.EndTime<= '{0}'", DateTime.Parse(endTime));
                }
                if (!string.IsNullOrEmpty(username))
                {
                    where += string.Format(" AND syu.Realname like '%{0}%'", username.ReplaceSql());
                }
                if (status != -1)
                {
                    switch (status)
                    {
                    case 0:
                        where += " and tt.StartTime >getdate()";
                        break;

                    case 1:
                        where += " and tt.StartTime<=getdate() and tt.EndTime>=getdate()";
                        break;

                    case 2:
                        where += " and tt.EndTime <getdate()";
                        break;
                    }
                }
                #endregion

                var list = _trainLearningManager.GetMyClassList(out totalCount, CurrentUser.UserId, where, pageIndex, pageSize);

                return(Json(new { dataList = list, recordCount = totalCount }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new { dataList = new List <TrainClassShow>(), recordCount = 0 }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 2
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));
        }