Ejemplo n.º 1
0
        private void ImportLocalized <T>(
            IEnumerable <ParentRegion> parentRegions,
            ILocalizedRepository <T> repository,
            int batchSize,
            IReadOnlyDictionary <long, int> eanIdsToIds,
            int languageId,
            int creatorId

            ) where T : LocalizedRegion, new()
        {
            LogBuild <T>();
            var localizedEntities = BuildLocalizedRegions <T>(parentRegions, eanIdsToIds, languageId, creatorId);
            var count             = localizedEntities.Length;

            LogBuilded(count);

            if (count <= 0)
            {
                return;
            }

            LogSave <T>();
            repository.BulkSave(localizedEntities, batchSize);
            LogSaved <T>();
        }
Ejemplo n.º 2
0
        protected void ImportLocalizedAccommodations(
            IEnumerable <IToLocalizedAccommodation> eanDataTransferObjects,
            ILocalizedRepository <LocalizedAccommodation> repository,
            IReadOnlyDictionary <int, int> accommodationsEanIdsToIds,
            int languageId,
            int creatorId
            )
        {
            LogBuild <LocalizedAccommodation>();
            var localizedAccommodations = BuildLocalizedAccommodations(eanDataTransferObjects,
                                                                       accommodationsEanIdsToIds, languageId, creatorId);

            var count = localizedAccommodations.Length;

            LogBuilded(count);

            if (count <= 0)
            {
                return;
            }

            LogSave <LocalizedAccommodation>();
            repository.BulkSave(localizedAccommodations);
            LogSaved <LocalizedAccommodation>();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="textKeyFactory"></param>
 /// <param name="logger"></param>
 /// <param name="nativeCulture">Culture of native strings.</param>
 /// <param name="defaultCulture">Default culture to use if localized string is missing in current culture. If <c>null</c>, <paramref name="nativeCulture"/> is used.</param>
 /// <param name="missingLocalizedStringExtensionPoint">Extension point to treat missing localized string in target culture. If <c>null</c>, an instance of <see cref="DefaultMissingLocalizedStringExtensionPoint"/> is used.</param>
 public DefaultLocalizedStringProvider(ILocalizedRepository repository, ITextKeyFactory textKeyFactory, ILogger logger, CultureInfo nativeCulture, CultureInfo defaultCulture, IMissingLocalizedStringExtensionPoint missingLocalizedStringExtensionPoint)
 {
     _repository = repository;
     _textKeyFactory = textKeyFactory;
     _logger = logger;
     _nativeCulture = nativeCulture;
     _defaultCulture = defaultCulture ?? _nativeCulture;
     _missingLocalizedStringExtensionPoint = missingLocalizedStringExtensionPoint ?? DefaultMissingLocalizedStringExtensionPoint.Instance;
 }
Ejemplo n.º 4
0
        private void ImportLocalizedRegions(Country[] eanCountries, ILocalizedRepository <LocalizedRegion> repository, IReadOnlyDictionary <long, int> regionsEanIdsToIds)
        {
            Logger.Log("Build localizedRegions from CountryList");
            var localizedRegions = BuildLocalizedRegions(eanCountries, regionsEanIdsToIds, DefaultLanguageId, CreatorId);
            var count            = localizedRegions.Length;

            LogBuilded(count);

            if (count <= 0)
            {
                return;
            }
            LogSave <LocalizedRegion>();
            repository.BulkSave(localizedRegions, count);
            LogSaved <LocalizedRegion>();
        }
        private void ImportLocalizedTypesOfAccommodations(IDictionary <int, string> expediaIdsToNames,
                                                          ILocalizedRepository <LocalizedRealEstateType> repository,
                                                          IReadOnlyDictionary <int, int> typesOfAccommodationsExpediaIdsToIds,
                                                          int languageId,
                                                          int creatorId)
        {
            LogBuild <LocalizedRealEstateType>();
            var localizedTypesOfAccommodations = BuildLocalizedTypesOfAccommodations(expediaIdsToNames,
                                                                                     typesOfAccommodationsExpediaIdsToIds, languageId, creatorId);
            var count = localizedTypesOfAccommodations.Length;

            if (count <= 0)
            {
                return;
            }

            LogSave <LocalizedRealEstateType>();
            repository.BulkSave(localizedTypesOfAccommodations, count);
            LogSaved <LocalizedRealEstateType>();
        }
Ejemplo n.º 6
0
        protected void ImportLocalizedRegions(
            IEnumerable <IHaveRegionIdRegionName> eanDataTransferObjects,
            ILocalizedRepository <LocalizedRegion> repository,
            IReadOnlyDictionary <long, int> ExpediaIdsToIds,
            int languageId,
            int creatorId

            )
        {
            LogBuild <LocalizedRegion>();
            var localizedRegions = BuildLocalizedRegions(eanDataTransferObjects, ExpediaIdsToIds, languageId, creatorId);
            var count            = localizedRegions.Length;

            LogAssembled(count);

            if (count <= 0)
            {
                return;
            }
            LogSave <LocalizedRegion>();
            repository.BulkSave(localizedRegions, count);
            LogSaved <LocalizedRegion>();
        }
Ejemplo n.º 7
0
        private void ImportLocalizedRegions(
            IEnumerable <AirportCoordinates> airportsCoordinates,
            ILocalizedRepository <LocalizedRegion> repository,
            IReadOnlyDictionary <long, int> eanIdsToIds,
            int languageId,
            int creatorId
            )
        {
            LogBuild <LocalizedRegion>();
            var localizedRegions = BuildLocalizedRegions(airportsCoordinates, eanIdsToIds,
                                                         languageId, creatorId);
            var count = localizedRegions.Length;

            LogBuilded(count);

            if (count <= 0)
            {
                return;
            }

            LogSave <LocalizedRegion>();
            repository.BulkSave(localizedRegions, count);
            LogSaved <LocalizedRegion>();
        }
Ejemplo n.º 8
0
 public DefaultLocalizedStringProvider(ILocalizedRepository repository, ITextKeyFactory textKeyFactory,
                                       ILogger logger, CultureInfo nativeCulture)
     : this(repository, textKeyFactory, logger, nativeCulture, null, null)
 {
 }