public IResult <IQueryable <ISalesQuoteSummaryReturn> > GetSalesQuotes(FilterSalesQuotesParameters parameters = null) { try { return(_salesServiceProvider.GetSalesQuotes(parameters)); } catch (Exception ex) { ex = ex.GetBaseException(); _exceptionLogger.LogException(ex); return(new FailureResult <IQueryable <ISalesQuoteSummaryReturn> >(null, ex.Message)); } }
public IResult <IQueryable <ISalesQuoteSummaryReturn> > GetSalesQuotes(FilterSalesQuotesParameters parameters) { var parsedFiltersResult = parameters.ParseToPredicateBuilderFilters(); if (!parsedFiltersResult.Success) { return(parsedFiltersResult.ConvertTo <IQueryable <ISalesQuoteSummaryReturn> >()); } var predicateResult = SalesQuotePredicateBuilder.BuildPredicate(parsedFiltersResult.ResultingObject); if (!predicateResult.Success) { return(predicateResult.ConvertTo <IQueryable <ISalesQuoteSummaryReturn> >()); } var query = _inventoryShipmentOrderUnitOfWork.SalesQuoteRepository.SourceQuery .Where(predicateResult.ResultingObject) .Select(SalesQuoteProjectors.SelectSummary()); return(new SuccessResult <IQueryable <ISalesQuoteSummaryReturn> >(query)); }
internal static IResult <SalesQuotePredicateBuilder.PredicateBuilderFilters> ParseToPredicateBuilderFilters(this FilterSalesQuotesParameters parameters) { if (parameters == null) { return(new SuccessResult <SalesQuotePredicateBuilder.PredicateBuilderFilters>()); } var result = new SalesQuotePredicateBuilder.PredicateBuilderFilters(); if (!string.IsNullOrWhiteSpace(parameters.CustomerKey)) { var customerKeyResult = KeyParserHelper.ParseResult <ICustomerKey>(parameters.CustomerKey); if (!customerKeyResult.Success) { return(customerKeyResult.ConvertTo <SalesQuotePredicateBuilder.PredicateBuilderFilters>()); } result.CustomerKey = customerKeyResult.ResultingObject.ToCustomerKey(); } if (!string.IsNullOrWhiteSpace(parameters.BrokerKey)) { var companyKeyResult = KeyParserHelper.ParseResult <ICompanyKey>(parameters.BrokerKey); if (!companyKeyResult.Success) { return(companyKeyResult.ConvertTo <SalesQuotePredicateBuilder.PredicateBuilderFilters>()); } result.BrokerKey = companyKeyResult.ResultingObject.ToCompanyKey(); } return(new SuccessResult <SalesQuotePredicateBuilder.PredicateBuilderFilters>(result)); }