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); } }
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); }
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); }