Exemple #1
0
        private IReadOnlyDictionary <long, int> ImportRegions(
            IEnumerable <Country> eanCountries,
            IRegionsRepository regionsRepository,
            IReadOnlyDictionary <long, int> eanIdsToIds
            )
        {
            Logger.Log("Build Regions from CountryList");
            var regions = BuildRegions(eanCountries, eanIdsToIds, CreatorId);
            var count   = regions.Length;

            Logger.Log($"Assembled {count} Regions from CountryList.");

            if (count <= 0)
            {
                return(eanIdsToIds);
            }

            LogSave <Region>();
            regionsRepository.BulkSave(regions);
            LogSaved <Region>();

            eanIdsToIds = regionsRepository.EanIdsToIds;

            return(eanIdsToIds);
        }
Exemple #2
0
        private IReadOnlyDictionary <long, int> ImportRegions(ParentRegion[] parentRegions,
                                                              IRegionsRepository repository,
                                                              int batchSize,
                                                              int creatorId,
                                                              out HashSet <string> subClassNames
                                                              )
        {
            ImportParentRegions(parentRegions, repository, batchSize, creatorId);

            LogBuild <Region>();

            var regions = BuildRegions(parentRegions, creatorId, out subClassNames);
            var count   = regions.Length;

            LogAssembled(count);

            if (count <= 0)
            {
                return(repository.EanIdsToIds);
            }

            LogSave <Region>();
            repository.BulkSave(regions, batchSize, p => p.Coordinates, p => p.CenterCoordinates);
            LogSaved <Region>();

            return(repository.EanIdsToIds);
        }
Exemple #3
0
        private void ImportParentRegions(IEnumerable <ParentRegion> parentRegions,
                                         IRegionsRepository repository,
                                         int batchSize,
                                         int creatorId
                                         )
        {
            WriteLog("ParentRegions Build.");
            var regions = BuildParentRegions(
                parentRegions, creatorId);

            var count = regions.Length;

            WriteLog($"ParentRegions Builded:{count} Regions.");

            if (count <= 0)
            {
                return;
            }
            WriteLog("ParentRegions Save.");
            repository.BulkSave(regions, batchSize, p => p.Coordinates, p => p.CenterCoordinates);
            WriteLog("ParenRegions Saved.");
        }
Exemple #4
0
        private IReadOnlyDictionary <long, int> ImportRegions(
            IEnumerable <AirportCoordinates> airportsCoordinates,
            IRegionsRepository repository,
            int creatorId)
        {
            LogBuild <Region>();
            var regions = BuildRegions(airportsCoordinates, creatorId);
            var count   = regions.Length;

            LogBuilded(count);

            if (count <= 0)
            {
                return(repository.EanIdsToIds);
            }

            LogSave <Region>();
            repository.BulkSave(regions, r => r.Coordinates, r => r.EanId);
            LogSaved <Region>();

            return(repository.EanIdsToIds);
        }
Exemple #5
0
        private IReadOnlyDictionary <long, int> ImportRegions(
            IEnumerable <RegionCenter> regionsCenter,
            IRegionsRepository repository,
            int creatorId
            )
        {
            LogBuild <Region>();
            var regions = BuildRegions(regionsCenter, creatorId);
            var count   = regions.Length;

            LogAssembled(count);

            if (count <= 0)
            {
                return(repository.ExpediaIdsToIds);
            }

            LogSave <Region>();
            repository.BulkSave(regions, r => r.Coordinates, r => r.SubtypeId);
            LogSaved <Region>();

            return(repository.ExpediaIdsToIds);
        }