コード例 #1
0
        private void ImportProbablyMissingCountries(IEnumerable <CandidateCountry> probablyMissingCountries,
                                                    IAdditionalRegionsInfoRepository <Data.Geography.Country> countriesRepository, int subtypeCountryId,
                                                    IRegionsRepository regionsRepository)
        {
            foreach (var probablyMissingCountry in probablyMissingCountries)
            {
                if (countriesRepository.Exists(c => c.Code == probablyMissingCountry.Code))
                {
                    continue;
                }

                var region = new Region
                {
                    CreatorId   = CreatorId,
                    Created     = DateTime.Now,
                    Coordinates = Geometry.DefaultFactory.CreatePolygon(new[]
                    {
                        new Coordinate(-122.358, 47.653), new Coordinate(-122.348, 47.649), new Coordinate(-122.358, 47.658), new Coordinate(-122.358, 47.653)
                    }),
                    CenterCoordinates = Point.Empty
                };

                region.Coordinates.SRID       = 4326;
                region.CenterCoordinates.SRID = 4326;

                region.LocalizedRegions.Add(new LocalizedRegion
                {
                    LanguageId = DefaultLanguageId,
                    Name       = probablyMissingCountry.Name,
                    CreatorId  = CreatorId
                });

                region.SubtypeId = subtypeCountryId;

                var country = new Data.Geography.Country
                {
                    Code      = probablyMissingCountry.Code,
                    CreatorId = CreatorId
                };

                region.ExpandingInformationAboutCountry = country;

                regionsRepository.Add(region);
            }
        }
コード例 #2
0
        private void ImportCountries(Country[] eanCountries,
                                     IAdditionalRegionsInfoRepository <Data.Entity.Country> repository,
                                     IReadOnlyDictionary <long, int> regionsEanIdsToIds
                                     )
        {
            LogBuild <Data.Entity.Country>();
            var countries = BuildCountries(eanCountries, regionsEanIdsToIds, CreatorId);
            var count     = countries.Length;

            LogBuilded(count);

            if (count <= 0)
            {
                return;
            }
            LogSave <Data.Entity.Country>();
            repository.BulkSave(countries);
            LogSaved <Data.Entity.Country>();
        }
コード例 #3
0
        private void ImportProbablyMissingCoutries(IEnumerable <CandidateCountry> probablyMissingCoutries,
                                                   IAdditionalRegionsInfoRepository <Data.Entity.Country> countriesRepository, int typeOfRegionCountryId,
                                                   IRegionsRepository regionsRepository)
        {
            foreach (var probablyMissingCoutry in probablyMissingCoutries)
            {
                if (countriesRepository.Exists(c => c.Code == probablyMissingCoutry.Code))
                {
                    continue;
                }

                var region = new Region
                {
                    CreatorId = CreatorId
                };

                region.LocalizedRegions.Add(new LocalizedRegion
                {
                    LanguageId = DefaultLanguageId,
                    Name       = probablyMissingCoutry.Name,
                    CreatorId  = CreatorId
                });

                region.RegionsToTypes.Add(new RegionToType
                {
                    ToId      = typeOfRegionCountryId,
                    CreatorId = CreatorId
                });

                var country = new Data.Entity.Country
                {
                    Code      = probablyMissingCoutry.Code,
                    CreatorId = CreatorId
                };


                region.AdditionalCountryProperties = country;

                regionsRepository.Add(region);
            }
        }
コード例 #4
0
        private void ImportAirports(
            IEnumerable <AirportCoordinates> airportsCoordinates,
            IAdditionalRegionsInfoRepository <Airport> repository,
            IReadOnlyDictionary <long, int> eanIdsToIds,
            int creatorId

            )
        {
            LogBuild <Airport>();
            var airports = BuildAirports(airportsCoordinates, eanIdsToIds, creatorId);
            var count    = airports.Length;

            LogBuilded(count);

            if (count <= 0)
            {
                return;
            }

            LogSave <Airport>();
            repository.BulkSave(airports, count);
            LogSaved <Airport>();
        }