示例#1
0
 public AgroSearch(IBaseEntitySearch <GeoPointType> mainSearch, ISearchQueries queries, Implements <GeoPointType> implements, IHashSearchHelper hashOper)
 {
     this.hashOper       = hashOper;
     this.baseMainSearch = mainSearch;
     this.ServiceKey     = mainSearch.ServiceKey;
     this.UriService     = mainSearch.UriService;
     Index           = mainSearch.Index;
     this.implements = implements;
     _queries        = queries;
 }
        // para activar auto-complete, no es activado aún debido a el tamaño que toma.
        //private readonly List<Suggester> _suggesterEntities = new List<Suggester> {
        //    new Suggester {
        //        Name= "SgProperty",
        //        SourceFields = new List<string>{
        //            "RelatedProperties/Value"
        //        }
        //    }
        //};

        public AgroSearch(string SearchServiceName, string SearchServiceKey)
        {
            _queries = new SearchQueries();
            _search  = new SearchServiceClient(SearchServiceName, new SearchCredentials(SearchServiceKey));
            if (!_search.Indexes.Exists(_entityIndex))
            {
                CreateOrUpdateIndex <EntitySearch>(_entityIndex);
            }
            if (!_search.Indexes.Exists(_commentIndex))
            {
                CreateOrUpdateIndex <CommentSearch>(_commentIndex);
            }
        }
示例#3
0
 public SearchViewModel(IEventAggregator eventAggregator, IApplication application,
                        ISearchViewModelHelper helper, ISearchQueries dbContext)
 {
     _application       = application;
     _helper            = helper;
     _dbContext         = dbContext;
     _eventAggregator   = eventAggregator;
     DateFrom           = DateTime.Today;
     DateTo             = DateTime.Today;
     PageIndex          = 0;
     _itemsPerPage      = 10;
     _criteria          = new List <Predicate <SearchResultItemViewModel> >();
     _searchResultItems = new ObservableCollection <SearchResultItemViewModel>();
     _eventAggregator.GetEvent <SearchEvent>().Subscribe(SearchEventHandler);
     _eventAggregator.GetEvent <InitializeSearchResultItemsEvent>().Subscribe(InitializeSearchResultItems);
 }
        public void SetUp()
        {
            _eventAggregator = Substitute.For <IEventAggregator>();
            _application     = Substitute.For <IApplication>();
            _dbContext       = Substitute.For <ISearchQueries>();
            _helper          = Substitute.For <ISearchViewModelHelper>();
            _initializeSearchResultItemsEvent = Substitute.For <InitializeSearchResultItemsEvent>();
            _searchEvent = new SearchEvent();
            _eventAggregator.GetEvent <SearchEvent>().Returns(_searchEvent);
            _eventAggregator.GetEvent <InitializeSearchResultItemsEvent>().Returns(_initializeSearchResultItemsEvent);
            _uut   = new SearchViewModel(_eventAggregator, _application, _helper, _dbContext);
            _today = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day);
            _uut.SearchResultItems.Clear();

            UserModel jensJensen = new UserModel
            {
                FirstName = "Jens",
                LastName  = "Jensen",
                Address   = "Finlandsgade 1",
                Email     = "*****@*****.**",
                UserType  = UserType.Lessor
            };

            _car1 = new SearchResultItemViewModel(_eventAggregator, _application)
            {
                Model          = "CLA 250",
                Brand          = "Mercedes",
                Location       = "Aarhus",
                RegNr          = "AF75903",
                Seats          = 2,
                Price          = 400,
                StartLeaseTime = _today,
                EndLeaseTime   = _today.AddMonths(1),
                Owner          = jensJensen,
            };
            _car2 = new SearchResultItemViewModel(_eventAggregator, _application)
            {
                Model          = "Model S",
                Brand          = "Tesla",
                Location       = "Odense",
                RegNr          = "AF75903",
                Seats          = 5,
                Price          = 600,
                StartLeaseTime = _today.AddMonths(1),
                EndLeaseTime   = _today.AddMonths(2),
                Owner          = jensJensen
            };
            _car3 = new SearchResultItemViewModel(_eventAggregator, _application)
            {
                Model          = "Berlingo",
                Brand          = "Citroen",
                Location       = "Copenhagen",
                RegNr          = "AF75903",
                Seats          = 5,
                Price          = 200,
                StartLeaseTime = _today.AddMonths(2),
                EndLeaseTime   = _today.AddMonths(3),
                Owner          = jensJensen
            };
            _uut.SearchResultItems.Add((SearchResultItemViewModel)_car1);
            _uut.SearchResultItems.Add((SearchResultItemViewModel)_car2);
            _uut.SearchResultItems.Add((SearchResultItemViewModel)_car3);
        }
示例#5
0
        public SearchDesignModel(IEventAggregator eventAggregator, IApplication application, ISearchViewModelHelper helper, ISearchQueries dbContext)
            : base(eventAggregator, application, helper, dbContext)
        {
            UserModel jensJensen = new UserModel
            {
                FirstName = "Jens",
                LastName  = "Jensen",
                Address   = "Finlandsgade 1",
                Email     = "*****@*****.**",
                UserType  = UserType.Lessor
            };

            SearchResultItems = new ObservableCollection <SearchResultItemViewModel>
            {
                new SearchResultItemViewModel(IoCContainer.Resolve <IEventAggregator>(), IoCContainer.Resolve <IApplication>())
                {
                    Model          = "CLA 250",
                    Brand          = "Mercedes",
                    Location       = "Aarhus",
                    RegNr          = "AF75903",
                    Seats          = 2,
                    Price          = 400,
                    StartLeaseTime = new DateTime(2019, 07, 07),
                    EndLeaseTime   = new DateTime(2019, 08, 07),
                    Owner          = jensJensen,
                },
                new SearchResultItemViewModel(IoCContainer.Resolve <IEventAggregator>(), IoCContainer.Resolve <IApplication>())
                {
                    Model          = "CLA 250",
                    Brand          = "Mercedes",
                    Location       = "Aarhus",
                    RegNr          = "AF75903",
                    Seats          = 2,
                    Price          = 400,
                    StartLeaseTime = new DateTime(2019, 12, 01),
                    EndLeaseTime   = new DateTime(2019, 12, 15),
                    Owner          = jensJensen
                },
                new SearchResultItemViewModel(IoCContainer.Resolve <IEventAggregator>(), IoCContainer.Resolve <IApplication>())
                {
                    Model          = "Model S",
                    Brand          = "Tesla",
                    Location       = "Aarhus",
                    RegNr          = "AF75903",
                    Seats          = 5,
                    Price          = 600,
                    StartLeaseTime = new DateTime(2019, 09, 01),
                    EndLeaseTime   = new DateTime(2019, 09, 15),
                    Owner          = jensJensen
                },
                new SearchResultItemViewModel(IoCContainer.Resolve <IEventAggregator>(), IoCContainer.Resolve <IApplication>())
                {
                    Model          = "Fortwo",
                    Brand          = "Smart",
                    Location       = "Padborg",
                    RegNr          = "AF75903",
                    Seats          = 2,
                    Price          = 150,
                    StartLeaseTime = new DateTime(2019, 10, 01),
                    EndLeaseTime   = new DateTime(2019, 10, 30),
                    Owner          = jensJensen
                },
                new SearchResultItemViewModel(IoCContainer.Resolve <IEventAggregator>(), IoCContainer.Resolve <IApplication>())
                {
                    Model          = "CLA 250",
                    Brand          = "Mercedes",
                    Location       = "Aarhus",
                    RegNr          = "AF75903",
                    Seats          = 2,
                    Price          = 400,
                    StartLeaseTime = new DateTime(2019, 06, 05),
                    EndLeaseTime   = new DateTime(2019, 06, 20),
                    Owner          = jensJensen
                },
                new SearchResultItemViewModel(IoCContainer.Resolve <IEventAggregator>(), IoCContainer.Resolve <IApplication>())
                {
                    Model          = "CLA 250",
                    Brand          = "Mercedes",
                    Location       = "Aarhus",
                    RegNr          = "AF75903",
                    Seats          = 2,
                    Price          = 400,
                    StartLeaseTime = new DateTime(2019, 04, 25),
                    EndLeaseTime   = new DateTime(2019, 5, 17),
                    Owner          = jensJensen
                },
                new SearchResultItemViewModel(IoCContainer.Resolve <IEventAggregator>(), IoCContainer.Resolve <IApplication>())
                {
                    Model          = "Berlingo",
                    Brand          = "Citroen",
                    Location       = "Aarhus",
                    RegNr          = "AF75903",
                    Seats          = 5,
                    Price          = 200,
                    StartLeaseTime = new DateTime(2019, 05, 01),
                    EndLeaseTime   = new DateTime(2019, 05, 30),
                    Owner          = jensJensen
                },
                new SearchResultItemViewModel(IoCContainer.Resolve <IEventAggregator>(), IoCContainer.Resolve <IApplication>())
                {
                    Model          = "A6",
                    Brand          = "Audi",
                    Location       = "Odense",
                    RegNr          = "AF75903",
                    Seats          = 5,
                    Price          = 200,
                    StartLeaseTime = new DateTime(2019, 05, 03),
                    EndLeaseTime   = new DateTime(2019, 05, 17),
                    Owner          = jensJensen
                },
            };
        }
        //инициализация
        public ESInsertDataModule(ISearchQueries<ObjectId> searchQueries, MongoDbConnectionSettings mongoSettings)
        {
            _searchQueries = searchQueries;
            _context = new MongoDbContext(mongoSettings);

        }
示例#7
0
 public SearchController(ISearchQueries searchService)
 {
     this.searchQueries = searchService;
 }