protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetVipPointMarkRP> pRequest)
        {
            var rd                 = new EmptyResponseData();
            var para               = pRequest.Parameters;
            var pointMarkBLL       = new X_VipPointMarkBLL(CurrentUserInfo);
            var pointMarkDetailBLL = new X_VipPointMarkDetailBLL(CurrentUserInfo);

            X_VipPointMarkEntity pointMarkEntity = null;

            pointMarkEntity = pointMarkBLL.QueryByEntity(new X_VipPointMarkEntity()
            {
                VipID = CurrentUserInfo.UserID
            }, null).FirstOrDefault();
            if (pointMarkEntity != null)
            {
                if (para.Count > 0)
                {
                    pointMarkEntity.TotalCount += para.Count;
                }
                pointMarkEntity.Count += para.Count;
                pointMarkBLL.Update(pointMarkEntity);
            }
            else
            {
                pointMarkEntity            = new X_VipPointMarkEntity();
                pointMarkEntity.VipID      = CurrentUserInfo.UserID;
                pointMarkEntity.CustomerID = CurrentUserInfo.ClientID;
                pointMarkEntity.Count      = para.Count;
                pointMarkEntity.TotalCount = para.Count;
                pointMarkBLL.Create(pointMarkEntity);
            }

            X_VipPointMarkDetailEntity detail = new X_VipPointMarkDetailEntity()
            {
                VipID      = CurrentUserInfo.UserID,
                Count      = para.Count,
                Source     = para.Source,
                CustomerID = CurrentUserInfo.ClientID
            };

            pointMarkDetailBLL.Create(detail);
            return(rd);
        }
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <ExchangeCouponRP> pRequest)
        {
            var rd                 = new EmptyResponseData();
            var para               = pRequest.Parameters;
            var pointMarkBLL       = new X_VipPointMarkBLL(CurrentUserInfo);
            var pointMarkDetailBLL = new X_VipPointMarkDetailBLL(CurrentUserInfo);

            var activityPrizesBLL = new X_ActivityPrizesBLL(CurrentUserInfo);
            var activityJoinBLL   = new X_ActivityJoinBLL(CurrentUserInfo);

            var couponBLL           = new CouponBLL(CurrentUserInfo);
            var vipCouponMappingBLL = new VipCouponMappingBLL(CurrentUserInfo);
            var couponTypeBLL       = new CouponTypeBLL(CurrentUserInfo);


            var activityPrizeInfo = activityPrizesBLL.GetByID(para.PrizesID);

            if (activityPrizeInfo != null)
            {
                //扣减积点
                var pointMarkInfo = pointMarkBLL.QueryByEntity(new X_VipPointMarkEntity()
                {
                    VipID = CurrentUserInfo.UserID
                }, null).FirstOrDefault();
                if (pointMarkInfo != null)
                {
                    pointMarkInfo.Count = pointMarkInfo.Count - activityPrizeInfo.UsePoint;
                    pointMarkBLL.Update(pointMarkInfo);

                    X_VipPointMarkDetailEntity detail = new X_VipPointMarkDetailEntity()
                    {
                        VipID      = CurrentUserInfo.UserID,
                        Count      = -activityPrizeInfo.UsePoint,
                        Source     = 2,//抽奖兑换
                        CustomerID = CurrentUserInfo.ClientID
                    };
                    pointMarkDetailBLL.Create(detail);
                }
                //更改参与信息
                var activityJoinInfo = activityJoinBLL.QueryByEntity(new X_ActivityJoinEntity()
                {
                    VipID = CurrentUserInfo.UserID
                }, new OrderBy[] { new OrderBy {
                                       FieldName = "CreateTime", Direction = OrderByDirections.Desc
                                   } }).FirstOrDefault();
                if (activityJoinInfo != null)
                {
                    activityJoinInfo.IsExchange = 1;
                    activityJoinBLL.Update(activityJoinInfo);
                }
                //兑换优惠券
                string couponID = couponBLL.GetUsableCouponID(activityPrizeInfo.CouponTypeID.ToString());
                VipCouponMappingEntity vipCouponMappingInfo = new VipCouponMappingEntity()
                {
                    VIPID    = CurrentUserInfo.UserID,
                    CouponID = couponID
                };
                vipCouponMappingBLL.Create(vipCouponMappingInfo);
                //修改券产品个数
                var couponTypeInfo = couponTypeBLL.GetByID(activityPrizeInfo.CouponTypeID);
                if (couponTypeInfo != null)
                {
                    couponTypeInfo.IsVoucher = couponTypeInfo.IsVoucher + 1;
                    couponTypeBLL.Update(couponTypeInfo);
                }
            }
            return(rd);
        }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(X_VipPointMarkDetailEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(X_VipPointMarkDetailEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <X_VipPointMarkDetailEntity> PagedQueryByEntity(X_VipPointMarkDetailEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public X_VipPointMarkDetailEntity[] QueryByEntity(X_VipPointMarkDetailEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(X_VipPointMarkDetailEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }