예제 #1
0
        public Response <GetCustomerByConditionResponse> GetCustomerByConditon(GetCustomerByConditionRequest request)
        {
            Response <GetCustomerByConditionResponse> response = new Response <GetCustomerByConditionResponse>()
            {
                Result = new GetCustomerByConditionResponse()
            };

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

            try
            {
                CustomerAccessor accessor = new CustomerAccessor();
                int rowCount;
                response.Result.Customer  = accessor.GetCustomerByConditon(request.Code, request.Name, request.UserId, request.ProjectId, request.StoreType, request.State, request.PageIndex, request.PageSize, out rowCount);
                response.Result.PageIndex = request.PageIndex;
                response.Result.PageCount = rowCount % request.PageSize == 0 ? rowCount / request.PageSize : rowCount / request.PageSize + 1;
                response.IsSuccess        = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }