private static GetProductPartsDataResponse GetProductsParts(GetProductPartsDataRequest request) { // quick eval of the search criteria; if by id only, we'll jump straight to the main sproc // if none, return an empty collection, rather than retrieving the whole space. bool useCategoryIds = !request.Criteria.CategoryIds.IsNullOrEmpty(); bool useKeywords = !string.IsNullOrWhiteSpace(request.Criteria.SearchCondition); bool useBarcodes = !request.Criteria.Barcodes.IsNullOrEmpty(); bool useItemIds = !request.Criteria.ItemIds.IsNullOrEmpty(); bool useRefiners = !request.Criteria.Refinement.IsNullOrEmpty(); var doSearch = useCategoryIds || useItemIds || useKeywords || useBarcodes; if (doSearch) { ProductSearchDataRequest searchDataServiceRequest = new ProductSearchDataRequest(request.Criteria, request.QueryResultSettings); var searchDataServiceResponse = request.RequestContext.Runtime.Execute <ProductSearchDataResponse>(searchDataServiceRequest, request.RequestContext); request.Criteria.Ids = searchDataServiceResponse.ProductIds.ToList(); } if (useRefiners) { // Refinement requires a minimum of DataLevel 2 and can not skip variants request.Criteria.SkipVariantExpansion = false; if (request.Criteria.DataLevel < CommerceEntityDataLevel.Extended) { request.Criteria.DataLevel = CommerceEntityDataLevel.Extended; } } // due to SqlServer implementation being changed regarding SkipVariantExpansion, Sqlite cannot support this flag as false // and needs to run the variation expansion code request.Criteria.SkipVariantExpansion = false; var getProductsProcedure = new GetProductsProcedure(request); return(getProductsProcedure.Execute()); }
private static ProductSearchDataResponse SearchProducts(ProductSearchDataRequest request) { var searchProductsProcedure = new SearchProductsProcedure(request); return(searchProductsProcedure.Execute()); }
/// <summary> /// Initializes a new instance of the <see cref="SearchProductsProcedure"/> class. /// </summary> /// <param name="request">The product search request.</param> public SearchProductsProcedure(ProductSearchDataRequest request) { this.request = request; }