Exemple #1
0
        //[Fact]
        public void RetrieveCasinoGeoPointIfItIsNotSet()
        {
            var documentStore = new DocumentStore() { ConnectionStringName = "Secure", Conventions = { DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites } };
            documentStore.Initialize();
            var documentSession = documentStore.OpenSession();

            var yandexGeolocationService = new YandexGeolocationService();

            var casinos = documentSession.Query<Casino>().ToList();

            foreach (var casino in casinos)
            {
                if (casino.GeoPoint == null || casino.GeoPoint.IsEmpty)
                {
                    var city = documentSession.Load<AdministrativeDivision>(casino.CityId);
                    var geoPoint = new GeoPoint(0, 0);
                    if (city != null)
                        geoPoint = yandexGeolocationService.GetPoint(city.Name, casino.Address);

                    casino.GeoPoint = geoPoint;
                    documentSession.Store(casino);
                }
            }
            documentSession.SaveChanges();
        }
 public CasinoController(IDocumentIdRetriever documentIdRetriever, IExemptionItemTypeLocalizator exemptionItemTypeLocalizator, ExemptionsService exemptionsService, IExemptionItemTypeDropDownListLocalizator exemptionItemTypeDropDownListLocalizator, YandexGeolocationService yandexGeolocationService)
 {
     _documentIdRetriever = documentIdRetriever;
     _exemptionItemTypeLocalizator = exemptionItemTypeLocalizator;
     _exemptionsService = exemptionsService;
     _exemptionItemTypeDropDownListLocalizator = exemptionItemTypeDropDownListLocalizator;
     _yandexGeolocationService = yandexGeolocationService;
 }
 public SalePointController(YandexGeolocationService yandexGeolocationService)
 {
     _yandexGeolocationService = yandexGeolocationService;
 }