コード例 #1
0
        public ActionResult Index()
        {
            PublicUserModel loginUser = this.GetLoginUser();
            UserTaskStat    stat      = userTaskBll.Get_UserTask_Stat(loginUser.UserID);

            ViewBag.UserName = loginUser.Name;
            ViewBag.Portrait = loginUser.Portrait;
            return(View(stat));
        }
コード例 #2
0
        public UserTaskStat Get_UserTask_Stat(int userId)
        {
            DbCommand cmd = GetStoredProcCommand("P_UserTask_Stat");

            AddInParameter(cmd, "@userId", DbType.Int32, userId);
            DataSet      ds           = ExecuteDataSet(cmd);
            UserTaskStat userTaskStat = new UserTaskStat();

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                userTaskStat.CompleteCount = To <int>(ds.Tables[0].Rows[0], "CompleteCount");
                userTaskStat.PointsCount   = To <int>(ds.Tables[0].Rows[0], "PointsCount");
                userTaskStat.UserPoints    = To <int>(ds.Tables[0].Rows[0], "UserPoints");
            }
            return(userTaskStat);
        }
コード例 #3
0
ファイル: UserController.cs プロジェクト: zhuangshaoying/ZJB
        public ApiResponse GetTask(int type = 0)
        {
            int userId = GetCurrentUserId();

            List <UserTaskModel> taskList = new List <UserTaskModel>();

            if (type == 0) //未完成
            {
                taskList = userTaskLog.GetNoCompleteTask(userId);
            }
            else if (type == 1) //已完成
            {
                taskList = userTaskLog.GetCompleteTask(userId);
            }
            UserTaskStat stat   = userTaskLog.Get_UserTask_Stat(userId);
            var          result = new
            {
                stat.PointsCount,
                stat.UserPoints,
                stat.CompleteCount,
                TaskList = taskList.IsNoNull()
                    ? taskList.Where(o => o.AppUrl != null && o.AppUrl != "").Select(p => new
                {
                    p.TaskId,
                    p.TaskName,
                    p.TaskDescription,
                    p.Points,
                    TaskType = p.Type,
                    CurNum   = p.TaskStatus > 0 ? 1 : 0,
                    MaxNum   = 1,
                    p.AppUrl
                })
                    : null
            };


            return(new ApiResponse(Metas.SUCCESS, result));
        }