Пример #1
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetSpecialDateRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var sysVipCardTypeBLL  = new SysVipCardTypeBLL(loggingSessionInfo);
            var specialDateBLL     = new SpecialDateBLL(loggingSessionInfo);

            var specialDateEntity = specialDateBLL.QueryByEntity(new SpecialDateEntity()
            {
                VipCardTypeID = para.VipCardTypeID, HolidayID = para.HolidayID
            }, null).FirstOrDefault();

            if (specialDateEntity != null)
            {
                throw new APIException("该卡类型已添加此特殊日期")
                      {
                          ErrorCode = ERROR_CODES.INVALID_BUSINESS
                      }
            }
            ;
            specialDateEntity = new SpecialDateEntity()
            {
                VipCardTypeID       = para.VipCardTypeID,
                HolidayID           = para.HolidayID,
                NoAvailablePoints   = para.NoAvailablePoints,   //不可用积分(0=不可用;1=可用)
                NoAvailableDiscount = para.NoAvailableDiscount, //不可用折扣(0=不可用;1=可用)
                NoRewardPoints      = para.NoRewardPoints,      //不可回馈积分(0=不可用;1=可用)
                CustomerID          = loggingSessionInfo.ClientID
            };
            specialDateBLL.Create(specialDateEntity);
            return(rd);
        }
    }
Пример #2
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <DelSpecialDateRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var specialDateBLL     = new SpecialDateBLL(loggingSessionInfo);

            specialDateBLL.Delete(para.SpecialID, null);
            return(rd);
        }
Пример #3
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <DeleteHolidayRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var HolidayBLL         = new HolidayBLL(loggingSessionInfo);
            var SpecialDataBLL     = new SpecialDateBLL(loggingSessionInfo);

            try
            {
                SpecialDateEntity SpecialDate = SpecialDataBLL.QueryByEntity(new SpecialDateEntity()
                {
                    HolidayID = para.HolidayId
                }, null).FirstOrDefault();
                if (SpecialDate != null)
                {
                    throw new APIException("该假日正在使用中不能更改或删除哦!")
                          {
                              ErrorCode = ERROR_CODES.INVALID_BUSINESS
                          };
                }
                //删除
                HolidayEntity DeleteData = HolidayBLL.GetByID(para.HolidayId);
                if (DeleteData == null)
                {
                    throw new APIException("假日对象为NULL!")
                          {
                              ErrorCode = ERROR_CODES.INVALID_BUSINESS
                          };
                }
                //执行
                HolidayBLL.Delete(DeleteData);
            }
            catch (APIException apiEx)
            {
                throw new APIException(apiEx.ErrorCode, apiEx.Message);
            }


            return(rd);
        }
Пример #4
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetHolidayRP> pRequest)
        {
            var rd   = new EmptyResponseData();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            var HolidayBLL     = new HolidayBLL(loggingSessionInfo);
            var SpecialDataBLL = new SpecialDateBLL(loggingSessionInfo);

            try
            {
                if (!string.IsNullOrWhiteSpace(para.HolidayId))
                {
                    SpecialDateEntity SpecialDate = SpecialDataBLL.QueryByEntity(new SpecialDateEntity()
                    {
                        HolidayID = para.HolidayId
                    }, null).FirstOrDefault();
                    if (SpecialDate != null)
                    {
                        throw new APIException("该假日正在使用中不能更改或删除哦!")
                              {
                                  ErrorCode = ERROR_CODES.INVALID_BUSINESS
                              };
                    }
                    //更新
                    HolidayEntity UpdateData = HolidayBLL.GetByID(para.HolidayId);
                    if (UpdateData == null)
                    {
                        throw new APIException("假日对象为NULL!")
                              {
                                  ErrorCode = ERROR_CODES.INVALID_BUSINESS
                              };
                    }
                    UpdateData.HolidayName = para.HolidayName;
                    UpdateData.BeginDate   = para.BeginDate;
                    UpdateData.EndDate     = para.EndDate.AddHours(23).AddMinutes(59);
                    UpdateData.Desciption  = para.Desciption;
                    UpdateData.CustomerID  = loggingSessionInfo.ClientID;
                    //执行
                    HolidayBLL.Update(UpdateData);
                }
                else
                {
                    //新增
                    HolidayEntity AddData = new HolidayEntity();
                    //AddData.HolidayId = System.Guid.NewGuid().ToString();
                    AddData.HolidayName = para.HolidayName;
                    AddData.BeginDate   = para.BeginDate;
                    AddData.EndDate     = para.EndDate.AddHours(23).AddMinutes(59);
                    AddData.Desciption  = para.Desciption;
                    AddData.CustomerID  = loggingSessionInfo.ClientID;
                    //执行
                    HolidayBLL.Create(AddData);
                }
            }
            catch (APIException apiEx)
            {
                throw new APIException(apiEx.ErrorCode, apiEx.Message);
            }


            return(rd);
        }
        protected override GetSysVipCardTypeDetailRD ProcessRequest(DTO.Base.APIRequest <DelSysVipCardTypeRP> pRequest)
        {
            var rd   = new GetSysVipCardTypeDetailRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var sysVipCardTypeBLL  = new SysVipCardTypeBLL(loggingSessionInfo);
            var vipCardRuleBLL     = new VipCardRuleBLL(loggingSessionInfo);
            var specialDateBLL     = new SpecialDateBLL(loggingSessionInfo);

            //获取卡类型信息
            var vipCardTypeInfo = sysVipCardTypeBLL.GetByID(para.VipCardTypeID);

            if (vipCardTypeInfo != null)
            {
                rd.VipCardTypeID     = vipCardTypeInfo.VipCardTypeID;
                rd.VipCardTypeCode   = vipCardTypeInfo.VipCardTypeCode;
                rd.VipCardTypeName   = vipCardTypeInfo.VipCardTypeName;
                rd.PicUrl            = vipCardTypeInfo.PicUrl;
                rd.Category          = vipCardTypeInfo.Category;
                rd.IsPassword        = vipCardTypeInfo.IsPassword;
                rd.VipCardLevel      = vipCardTypeInfo.VipCardLevel;
                rd.Prices            = vipCardTypeInfo.Prices;
                rd.IsExtraMoney      = vipCardTypeInfo.IsExtraMoney;
                rd.ExchangeIntegral  = vipCardTypeInfo.ExchangeIntegral;
                rd.UpgradeAmount     = vipCardTypeInfo.UpgradeAmount;
                rd.UpgradeOnceAmount = vipCardTypeInfo.UpgradeOnceAmount;
                rd.UpgradePoint      = vipCardTypeInfo.UpgradePoint;

                //获取卡规则信息
                var vipCardRuleInfo = vipCardRuleBLL.QueryByEntity(new VipCardRuleEntity()
                {
                    VipCardTypeID = para.VipCardTypeID
                }, null).FirstOrDefault();
                if (vipCardRuleInfo != null)
                {
                    rd.CardDiscount    = vipCardRuleInfo.CardDiscount;
                    rd.PointsMultiple  = vipCardRuleInfo.PointsMultiple;
                    rd.ChargeFull      = vipCardRuleInfo.ChargeFull;
                    rd.ChargeGive      = vipCardRuleInfo.ChargeGive;
                    rd.PaidGivePoints  = vipCardRuleInfo.PaidGivePoints;
                    rd.ReturnAmountPer = vipCardRuleInfo.ReturnAmountPer;
                }
                //获取特殊日期设置信息
                //查询参数
                List <IWhereCondition> complexCondition = new List <IWhereCondition> {
                };
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "sd.VipCardTypeID", Value = para.VipCardTypeID
                });
                var orderBy = new OrderBy[] { new OrderBy()
                                              {
                                                  FieldName = "sd.CreateTime", Direction = OrderByDirections.Asc
                                              } };                                                                               //排序字段
                var specialDateList = specialDateBLL.GetSpecialDateList(complexCondition.ToArray(), orderBy.ToArray());
                rd.SpecialDateList = specialDateList.Select(t => new SpecialDateInfo()
                {
                    SpecialID           = t.SpecialId,
                    HolidayName         = t.HolidayName,
                    BeginDate           = t.BeginDate.Value.ToString("yyyy-MM-dd"),
                    EndDate             = t.EndDate.Value.ToString("yyyy-MM-dd"),
                    NoAvailablePoints   = t.NoAvailablePoints,
                    NoAvailableDiscount = t.NoAvailableDiscount,
                    NoRewardPoints      = t.NoRewardPoints
                }).ToList();
            }
            return(rd);
        }