Beispiel #1
0
        public void Change(IOrderSearch search)
        {
            _search = search;
            var container = ServiceLocator.Current.GetInstance <IUnityContainer>();

            container.RegisterInstance <SearchContext>(this);
        }
Beispiel #2
0
 public OrderProcessing(ILogger <OrderProcessing> logger, IServiceScopeFactory scopeFactory,
                        IOptions <OrderProcessingConfig> configOpts, IOptions <SFCCEnvironment> envOpts,
                        IOrderSearch searchClient)
 {
     _searchClient  = searchClient;
     _environment   = envOpts.Value;
     _initialConfig = configOpts.Value;
     _logger        = logger;
     _scopeFactory  = scopeFactory;
 }
Beispiel #3
0
 public TestOCAPIClients(SFCCEnvironmentFixture fixture)
 {
     _sitesClient             = fixture.ServiceProvider.GetService <ISites>();
     _jobsClient              = fixture.ServiceProvider.GetService <IJobs>();
     _globalPreferencesClient = fixture.ServiceProvider.GetService <IGlobalPreferences>();
     _orderSearchClient       = fixture.ServiceProvider.GetService <IOrderSearch>();
     _ordersClient            = fixture.ServiceProvider.GetService <IOrders>();
     _jobSearchClient         = fixture.ServiceProvider.GetService <IJobExecutionSearch>();
     _codeVersionsClient      = fixture.ServiceProvider.GetService <ICodeVersions>();
 }
Beispiel #4
0
        public SearchContext(IOrderSearch search)
        {
            _search         = search;
            SearchCriterion = new OrderSearchService();
            var eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>();
            var container       = ServiceLocator.Current.GetInstance <IUnityContainer>();

            container.RegisterInstance <SearchContext>(this);
            // eventAggregator.GetEvent<SearchModeArgsEvent>().Subscribe(DoSearch);
        }
Beispiel #5
0
        public static async Task <Order> SearchOrderByOrderNo(this IOrderSearch service, string orderNo)
        {
            var result = await service.SearchOrders(new SearchRequest()
            {
                Query = new TermQuery()
                {
                    QueryBody = new TermQueryBody()
                    {
                        Fields = new List <string>()
                        {
                            "order_no"
                        },
                        Operator = Operator.Is,
                        Values   = new List <string>()
                        {
                            orderNo
                        }
                    }
                },
                Count = 1
            });

            return(result.Count > 0 ? result.Hits[0].Data : null);
        }
Beispiel #6
0
        public static async Task <SearchResult <OrderSearchHit> > SearchOrdersBetween(this IOrderSearch service, DateTime start,
                                                                                      DateTime end)
        {
            var request = new SearchRequest
            {
                Query = new FilteredQuery()
                {
                    Body =
                    {
                        Query  = new MatchAllQuery(),
                        Filter = new RangeFilter()
                        {
                            RangeFilterBody = new RangeFilterBody()
                            {
                                Field       = "creation_date",
                                // OCAPI BUG: Ocapi is really picky about the format for the jobs resource (normal "o" iso8601
                                // conversion works fine for order search but causes a 400 for job search), so we explicitly
                                // convert to UTC and use the Z constant
                                From = start.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"),
                                To   = end.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
                            }
                        }
                    }
                },
                Select = "(**)",
                Sorts  = new List <Sort>()
                {
                    new Sort()
                    {
                        Field = "creation_date", SortOrder = SortOrder.Asc
                    }
                }
            };
            var result = await service.SearchOrders(request);

            return(new SearchResult <OrderSearchHit>(request, result, service.SearchOrders));
        }