Ejemplo n.º 1
0
        private int Task(long userid, out long taskid)
        {
            int state;

            taskid = 0;

            lgk.BLL.tb_BonusPoly poly = new lgk.BLL.tb_BonusPoly();
            var task = poly.GetTask(userid);


            if (task == null)
            {
                state = 0;
            }
            else if (task.TaskCompletedFlag == 0)
            {
                taskid = task.ID;
                state  = 1;
            }
            else
            {
                state = 2;
            }

            return(state);
        }
Ejemplo n.º 2
0
        //任务记录
        public object ListTask(long userid)
        {
            DateTime now  = DateTime.Now;
            int      task = getParamInt("RunTask");

            lgk.BLL.tb_BonusPoly polyBll = new lgk.BLL.tb_BonusPoly();
            var list = polyBll.GetModelList("userid=" + userid + " and ShareDate < GETDATE()").Select(s => new
            {
                ExpTime   = s.ShareDate,
                State     = s.TaskCompletedFlag == 1 ? 1 : s.ShareDate < now || s.Flag == 1 ? -1 : 0,
                StateText = s.TaskCompletedFlag == 1 ? "已完成" : s.ShareDate < now || s.Flag == 1 ? "已过期" : "未跑步",
                Task      = task,
                Bonus     = s.Bonus,
                TimeLong  = "",
                DoneNum   = 0,
                FreeBonus = s.TaskCompletedFlag == 1 ? s.TaskBonus : 0
            }).OrderByDescending(b => b.ExpTime).ToList();

            var list2 = polyBll.GetModelList("userid=" + userid + " and ShareDate > GETDATE()").Select(s => new
            {
                ExpTime   = s.ShareDate,
                State     = s.TaskCompletedFlag == 1 ? 1 : s.ShareDate < now || s.Flag == 1  ? -1 : 0,
                StateText = s.TaskCompletedFlag == 1 ? "已完成" : s.ShareDate < now || s.Flag == 1 ? "已过期" : "未跑步",
                Task      = task,
                Bonus     = s.Bonus,
                TimeLong  = "",
                DoneNum   = 0,
                FreeBonus = s.TaskCompletedFlag == 1 ? s.TaskBonus : 0
            }).OrderBy(b => b.ExpTime).ToList();

            if (list2.Count > 0)
            {
                list.AddRange(list2.Take(1));
            }

            return(list.OrderByDescending(s => s.ExpTime));
        }