Esempio n. 1
0
        protected override GetHolidayListRD ProcessRequest(DTO.Base.APIRequest <GetHolidayListRP> pRequest)
        {
            var rd   = new GetHolidayListRD();
            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var VipCardBLL         = new HolidayBLL(loggingSessionInfo);
            //排序参数
            List <OrderBy> lstOrder = new List <OrderBy> {
            };

            lstOrder.Add(new OrderBy()
            {
                FieldName = "CreateTime", Direction = OrderByDirections.Desc
            });
            //调用会员卡管理列表查询
            var tempList = VipCardBLL.PagedQuery(null, lstOrder.ToArray(), para.PageSize, para.PageIndex);

            rd.TotalPageCount = tempList.PageCount;
            rd.TotalCount     = tempList.RowCount;
            rd.HolidayList    = tempList.Entities.Select(t => new HolidayInfo()
            {
                HolidayId   = t.HolidayId.ToString(),
                HolidayName = t.HolidayName,
                BeginDate   = t.BeginDate.Value == null ? "" : t.BeginDate.Value.ToString("yyyy-MM-dd"),
                EndDate     = t.EndDate.Value == null ? "" : t.EndDate.Value.ToString("yyyy-MM-dd"),
                Desciption  = t.Desciption == null ? "" : t.Desciption,
                CreateTime  = t.CreateTime.Value.ToString("yyyy-MM-dd")
            }).ToList();
            return(rd);
        }
Esempio n. 2
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);

            try
            {
                //删除
                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);
        }
Esempio n. 3
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);

            try
            {
                if (!string.IsNullOrWhiteSpace(para.HolidayId))
                {
                    //更新
                    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;
                    UpdateData.Desciption  = para.Desciption;
                    //执行
                    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;
                    AddData.Desciption  = para.Desciption;
                    AddData.CustomerID  = loggingSessionInfo.ClientID;
                    //执行
                    HolidayBLL.Create(AddData);
                }
            }
            catch (APIException apiEx)
            {
                throw new APIException(apiEx.ErrorCode, apiEx.Message);
            }


            return(rd);
        }