Пример #1
0
        public Response <GetReceiptDetailByConditionResponse> GetImportReceiptByCondition(GetReceiptByConditionRequest request)
        {
            Response <GetReceiptDetailByConditionResponse> response = new Response <GetReceiptDetailByConditionResponse>()
            {
                Result = new GetReceiptDetailByConditionResponse()
            };

            if (request == null || request.SearchCondition == null)
            {
                ArgumentNullException ex = new ArgumentNullException("GetReceiptByConditionRequest request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                ReceiptManagementAccessor accessor = new ReceiptManagementAccessor();
                int RowCount;
                //if (request.PageSize > 0)
                //{
                response.Result           = accessor.GetImportReceiptByCondition(request.SearchCondition, request.PageIndex, request.PageSize, out RowCount);
                response.Result.PageCount = RowCount % request.PageSize == 0 ? RowCount / request.PageSize : RowCount / request.PageSize + 1;
                response.Result.PageIndex = request.PageIndex;
                //}
                //else
                //{
                //    response.Result.PageIndex = 0;
                //    response.Result.PageCount = 0;
                //    response.Result.ReceiptCollection = accessor.GetWarehouseByConditionNoPaging(request.SearchCondition);
                //}
                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.Exception = ex;
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }