예제 #1
0
            private static ProductSearchServiceResponse SearchProductsLocal(ProductSearchServiceRequest request)
            {
                var queryCriteria = request.QueryCriteria;

                if (queryCriteria.Context == null || queryCriteria.Context.ChannelId.HasValue == false)
                {
                    throw new DataValidationException(DataValidationErrors.Microsoft_Dynamics_Commerce_Runtime_RequiredValueNotFound, "The channel identifier on the query criteria context must be specified.");
                }

                GetProductServiceRequest getProductsServiceRequest = new GetProductServiceRequest(
                    queryCriteria,
                    request.RequestContext.GetChannelConfiguration().DefaultLanguageId,
                    false /*FetchProductsAvailableInFuture*/,
                    request.QueryResultSettings,
                    queryCriteria.IsOnline);

                ProductSearchResultContainer result = request.RequestContext.Runtime.Execute <ProductSearchServiceResponse>(
                    getProductsServiceRequest,
                    request.RequestContext).ProductSearchResult;

                // populate the active variant product id if this was a search by item or barcode
                if ((!queryCriteria.ItemIds.IsNullOrEmpty() || !queryCriteria.Barcodes.IsNullOrEmpty()) && !queryCriteria.SkipVariantExpansion)
                {
                    SetActiveVariants(queryCriteria, result);
                }

                if (!queryCriteria.Refinement.IsNullOrEmpty())
                {
                    result.Results = ProductRefinement.RefineProducts(result.Results, queryCriteria.Refinement);
                }

                return(new ProductSearchServiceResponse(result));
            }
예제 #2
0
 private static GetProductRefinersServiceResponse GetProductRefiners(GetProductRefinersRequest request)
 {
     return(ProductRefinement.GetProductRefiners(request));
 }