コード例 #1
0
        public async Task <VehicleToWheelBaseSearchViewModel> SearchByWheelBaseId(int wheelBaseId)
        {
            var applyFilters = new VehicleToWheelBaseSearchFilters()
            {
                WheelBaseId = wheelBaseId,
            };
            var result = await _vehicleToWheelBaseSearchService.SearchAsync("", applyFilters.ToAzureSearchFilter(),
                                                                            new SearchOptions
            {
                FacetsToInclude = new List <string>
                {
                    "regionName",
                    "vehicleTypeName",
                    "vehicleTypeGroupName",
                    "makeName",
                    "modelName",
                    "subModelName",
                },
                RecordCount      = 1000,
                ReturnTotalCount = true,
            });

            var wheelBaseSearchViewModel = _vehicleToWheelBaseSearchViewModelMapper.Map(result);

            return(wheelBaseSearchViewModel);
        }
コード例 #2
0
        private async Task <string[]> RefreshSubModelsFacet(VehicleToWheelBaseSearchInputModel vehicleToWheelBaseSearchInputModel)
        {
            var applyFilters = new VehicleToWheelBaseSearchFilters()
            {
                WheelBaseId       = vehicleToWheelBaseSearchInputModel.WheelBaseId,
                StartYear         = Convert.ToInt32(vehicleToWheelBaseSearchInputModel.StartYear),
                EndYear           = Convert.ToInt32(vehicleToWheelBaseSearchInputModel.EndYear),
                Makes             = vehicleToWheelBaseSearchInputModel.Makes,
                Models            = vehicleToWheelBaseSearchInputModel.Models,
                VehicleTypes      = vehicleToWheelBaseSearchInputModel.VehicleTypes,
                VehicleTypeGroups = vehicleToWheelBaseSearchInputModel.VehicleTypeGroups,
                Regions           = vehicleToWheelBaseSearchInputModel.Regions,
            };

            var result = await _vehicleToWheelBaseSearchService.SearchAsync("", applyFilters.ToAzureSearchFilter(),
                                                                            new SearchOptions
            {
                FacetsToInclude = new List <string>
                {
                    "subModelName,count:1000",
                },
                RecordCount = 0
            });

            var vehicleToWheelBaseSearchViewModel = _vehicleToWheelBaseSearchViewModelMapper.Map(result);

            return(vehicleToWheelBaseSearchViewModel.Facets.SubModels);
        }
コード例 #3
0
        public async Task <VehicleToWheelBaseSearchViewModel> Search(VehicleToWheelBaseSearchInputModel vehicleToWheelBaseSearchInputModel)
        {
            var applyFilters = new VehicleToWheelBaseSearchFilters()
            {
                WheelBaseId       = vehicleToWheelBaseSearchInputModel.WheelBaseId,
                StartYear         = Convert.ToInt32(vehicleToWheelBaseSearchInputModel.StartYear),
                EndYear           = Convert.ToInt32(vehicleToWheelBaseSearchInputModel.EndYear),
                Makes             = vehicleToWheelBaseSearchInputModel.Makes,
                Models            = vehicleToWheelBaseSearchInputModel.Models,
                SubModels         = vehicleToWheelBaseSearchInputModel.SubModels,
                VehicleTypes      = vehicleToWheelBaseSearchInputModel.VehicleTypes,
                VehicleTypeGroups = vehicleToWheelBaseSearchInputModel.VehicleTypeGroups,
                Regions           = vehicleToWheelBaseSearchInputModel.Regions,
            };

            var result = await _vehicleToWheelBaseSearchService.SearchAsync("", applyFilters.ToAzureSearchFilter(),
                                                                            new SearchOptions
            {
                FacetsToInclude = new List <string>
                {
                    "regionName,count:1000",
                    "vehicleTypeName,count:1000",
                    "vehicleTypeGroupName,count:1000",
                    "makeName,count:1000",
                    "modelName,count:1000",
                    "subModelName,count:1000",
                },
                RecordCount      = 1000,
                ReturnTotalCount = true,
            });

            var viewModel = _vehicleToWheelBaseSearchViewModelMapper.Map(result);

            return(viewModel);
        }
コード例 #4
0
        public async Task <List <VehicleToWheelBaseViewModel> > GetAssociations(VehicleToWheelBaseSearchInputModel vehicleToWheelBaseSearchInputModel)
        {
            List <VehicleToWheelBaseViewModel> vehicleToWheelBases = new List <VehicleToWheelBaseViewModel>();

            var applyFilters = new VehicleToWheelBaseSearchFilters()
            {
                WheelBaseId       = vehicleToWheelBaseSearchInputModel.WheelBaseId,
                StartYear         = Convert.ToInt32(vehicleToWheelBaseSearchInputModel.StartYear),
                EndYear           = Convert.ToInt32(vehicleToWheelBaseSearchInputModel.EndYear),
                Makes             = vehicleToWheelBaseSearchInputModel.Makes,
                Models            = vehicleToWheelBaseSearchInputModel.Models,
                SubModels         = vehicleToWheelBaseSearchInputModel.SubModels,
                VehicleTypes      = vehicleToWheelBaseSearchInputModel.VehicleTypes,
                VehicleTypeGroups = vehicleToWheelBaseSearchInputModel.VehicleTypeGroups,
                Regions           = vehicleToWheelBaseSearchInputModel.Regions,
            };

            bool isEndReached = false;
            int  pageNumber   = 1;

            do
            {
                var result = await _vehicleToWheelBaseSearchService.SearchAsync("", applyFilters.ToAzureSearchFilter(),
                                                                                new SearchOptions()
                {
                    RecordCount = 1000, PageNumber = pageNumber
                });

                if (result != null && result.Documents != null && result.Documents.Any())
                {
                    vehicleToWheelBases.AddRange(_vehicleToWheelBaseViewModelMapper.Map(result));

                    pageNumber++;
                }
                else
                {
                    isEndReached = true;
                }
            } while (!isEndReached);

            return(vehicleToWheelBases);
        }
コード例 #5
0
        private async Task <string[]> RefreshRegionFacet(VehicleToWheelBaseSearchInputModel vehicleToWheelBaseSearchInputModel)
        {
            var applyFilters = new VehicleToWheelBaseSearchFilters()
            {
                WheelBaseId = vehicleToWheelBaseSearchInputModel.WheelBaseId,
            };

            var result = await _vehicleToWheelBaseSearchService.SearchAsync("", applyFilters.ToAzureSearchFilter(),
                                                                            new SearchOptions
            {
                FacetsToInclude = new List <string>
                {
                    "regionName,count:1000",
                },
                RecordCount = 0
            });

            var vehicleToWheelBaseSearchViewModel = _vehicleToWheelBaseSearchViewModelMapper.Map(result);

            return(vehicleToWheelBaseSearchViewModel.Facets.Regions);
        }
コード例 #6
0
        public async Task <List <VehicleToWheelBaseViewModel> > Search(List <string> vehicleIdArray)
        {
            List <VehicleToWheelBaseViewModel> vehicleToWheelBases = null;

            if (vehicleIdArray != null && vehicleIdArray.Count > 0)
            {
                var applyFilters = new VehicleToWheelBaseSearchFilters()
                {
                    VehicleIds = vehicleIdArray.Select(item => Convert.ToInt32(item)).ToArray()
                };

                var result = await _vehicleToWheelBaseSearchService.SearchAsync("", applyFilters.ToAzureSearchFilter(),
                                                                                new SearchOptions
                {
                    RecordCount = 1000
                });

                vehicleToWheelBases = _vehicleToWheelBaseViewModelMapper.Map(result);
            }

            return(vehicleToWheelBases);
        }