Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }