Ejemplo n.º 1
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <EmptyRequestParameter> pRequest)
        {
            var      rd                 = new EmptyResponseData();
            var      para               = pRequest.Parameters;
            var      pointMarkBLL       = new X_VipPointMarkBLL(CurrentUserInfo);
            var      pointMarkDetailBLL = new X_VipPointMarkDetailBLL(CurrentUserInfo);
            DateTime dtNow              = DateTime.Now;                                        //当前时间
            DateTime startWeek          = DateTimeHelper.GetMondayDate(dtNow).Date;            //本周周一
            DateTime endWeek            = DateTimeHelper.GetSundayDate(dtNow).AddDays(1).Date; //本周周日

            var pointMarkDeail = pointMarkDetailBLL.GetPointMarkByWeek(CurrentUserInfo.UserID, startWeek, endWeek);

            if (pointMarkDeail != null)
            {
                if (pointMarkDeail.Count > 0)//答题获得积分才处理
                {
                    pointMarkDetailBLL.Delete(pointMarkDeail);
                    var pointMarkInfo = pointMarkBLL.QueryByEntity(new X_VipPointMarkEntity()
                    {
                        VipID = CurrentUserInfo.UserID
                    }, null).FirstOrDefault();
                    if (pointMarkInfo != null)
                    {
                        pointMarkInfo.Count      = pointMarkInfo.Count - pointMarkDeail.Count;
                        pointMarkInfo.TotalCount = pointMarkInfo.TotalCount - pointMarkDeail.Count;
                        pointMarkBLL.Update(pointMarkInfo);
                    }
                }
            }
            return(rd);
        }
Ejemplo n.º 2
0
        protected override GetVipPointMarkRD ProcessRequest(DTO.Base.APIRequest <EmptyRequestParameter> pRequest)
        {
            var rd                 = new GetVipPointMarkRD();
            var para               = pRequest.Parameters;
            var pointMarkBLL       = new X_VipPointMarkBLL(CurrentUserInfo);
            var pointMarkDetailBLL = new X_VipPointMarkDetailBLL(CurrentUserInfo);
            var pointMarkInfo      = pointMarkBLL.QueryByEntity(new X_VipPointMarkEntity()
            {
                VipID = CurrentUserInfo.UserID
            }, null).FirstOrDefault();
            int count      = 0;                                                       //当前点数
            int totalCount = 0;                                                       //累计点数
            int weekCount  = 0;                                                       //本周获得点数

            DateTime dtNow     = DateTime.Now;                                        //当前时间
            DateTime startWeek = DateTimeHelper.GetMondayDate(dtNow).Date;            //本周周一
            DateTime endWeek   = DateTimeHelper.GetSundayDate(dtNow).AddDays(1).Date; //本周周日


            string pointMarkId = string.Empty;

            if (pointMarkInfo != null)
            {
                pointMarkId = pointMarkInfo.PointMarkID.ToString();
                count       = pointMarkInfo.Count.Value;
                totalCount  = pointMarkInfo.TotalCount.Value;
                var pointMarkDetail = pointMarkDetailBLL.GetPointMarkByWeek(CurrentUserInfo.UserID, startWeek, endWeek);
                if (pointMarkDetail != null)
                {
                    weekCount = pointMarkDetail.Count.Value;
                }
            }
            rd.PointMarkID = pointMarkId;
            rd.Count       = count;
            rd.TotalCount  = totalCount;
            rd.WeekCount   = weekCount;
            return(rd);
        }