示例#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 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);
            }
        }