Exemplo n.º 1
0
        public override void Import(string path)
        {
            Parser = _parserFactory.Create <Country>(Provider.GetFirstLine(path));

            LoadData(path);

            var eanCountries = EanCountries.ToArray();

            EanCountries = null;

            var regionsRepository  = FactoryOfRepositories.Regions();
            var regionsEanIdsToIds = regionsRepository.EanIdsToIds;

            regionsEanIdsToIds = ImportRegions(eanCountries, regionsRepository, regionsEanIdsToIds);

            ImportLocalizedRegions(eanCountries, FactoryOfRepositories.Localized <LocalizedRegion>(), regionsEanIdsToIds);

            var typeOfRegionCountryId = FactoryOfRepositories.BaseNames <TypeOfRegion>().GetId("Country");

            ImportRegionsToTypes(eanCountries, FactoryOfRepositories.RegionsToTypes(), regionsEanIdsToIds, typeOfRegionCountryId);

            ImportRegionsToRegions(eanCountries, FactoryOfRepositories.ManyToMany <RegionToRegion>(), regionsEanIdsToIds);

            var countriesRepository = FactoryOfRepositories.AdditionalRegionsInfo <Data.Entity.Country>();

            ImportCountries(eanCountries, countriesRepository, regionsEanIdsToIds);

            ImportProbablyMissingCoutries(ProbablyMissingCoutries, countriesRepository, typeOfRegionCountryId, regionsRepository);
        }
Exemplo n.º 2
0
        public override void Import(string path)
        {
            LoadData(path);

            var airportsCoordinates = EanDataTransferObjects.ToArray();

            EanDataTransferObjects = null;

            var regionsEanIdsToIds =
                ImportRegions(airportsCoordinates, FactoryOfRepositories.Regions(), CreatorId);

            ImportLocalizedRegions(airportsCoordinates, FactoryOfRepositories.Localized <LocalizedRegion>(), regionsEanIdsToIds, DefaultLanguageId, CreatorId);

            ImportAirports(airportsCoordinates, FactoryOfRepositories.AdditionalRegionsInfo <Airport>(), regionsEanIdsToIds, CreatorId);

            ImportRegionsToTypes(airportsCoordinates, FactoryOfRepositories.RegionsToTypes(), regionsEanIdsToIds,
                                 FactoryOfRepositories.BaseNames <TypeOfRegion>().GetId("Airport"),
                                 FactoryOfRepositories.BaseNames <SubClass>().GetId("airport"));

            ImpotRegionsToRegions(airportsCoordinates, FactoryOfRepositories.ManyToMany <RegionToRegion>(),
                                  regionsEanIdsToIds, FactoryOfRepositories.AdditionalRegionsInfo <Country>().CodesToIds,
                                  CreatorId);
        }