Beispiel #1
0
        public void Load(ITimeZoneRepository timeZoneRepository,
                         IDaylightSavingsAdjustmentRepository daylightSavingsAdjustmentRepository)
        {
            ITransformerDatabaseReader transformerDatabaseReader = _tzDbTransformer.Transform();

            transformerDatabaseReader.OffsetAdjustments.ToList()
            .ForEach(daylightSavingsAdjustmentRepository.Add);

            transformerDatabaseReader.TimeZones.ToList()
            .ForEach(timeZoneRepository.Add);
        }
Beispiel #2
0
 public void Load(ITimeZoneRepository timeZoneRepository, IDaylightSavingsAdjustmentRepository daylightSavingsAdjustmentRepository)
 {
     string[] supportedIanaIds = _tzMapper.GetAvailableTZIDs();
     foreach (DbTimeZone timeZone in timeZoneRepository.GetAll())
     {
         if (supportedIanaIds.Any(ianaId => ianaId == timeZone.IanaId))
         {
             TimeZoneInfo timeZoneInfo = _tzMapper.MapTZID(timeZone.IanaId);
             string       microsoftId  = timeZoneInfo.Id;
             timeZone.UpdateMicrosoftId(microsoftId);
             timeZoneRepository.Update(timeZone);
         }
     }
 }
 /// <summary>
 /// Initializes the Use Cases supported by the TimeZoneDb
 /// </summary>
 /// <param name="daylightSavingsAdjustmentRepository"></param>
 /// <param name="timeZoneDataSources">
 /// Allows overriding the default data sources with <paramref name="timeZoneDataSources"/>.
 /// Note: If your sources are dependent on each other or have preference over each other,
 /// make sure the order in which they appear in <paramref name="timeZoneDataSources"/>
 /// is the order in which you want them to be loaded i.e. source at index 0 will load
 /// prior to source at index 1
 /// </param>
 /// <param name="timeZoneRepository"></param>
 public TimeZoneDbUseCases(ITimeZoneRepository timeZoneRepository = null, IDaylightSavingsAdjustmentRepository daylightSavingsAdjustmentRepository = null, List <ITimeZoneDataSource> timeZoneDataSources = null)
 {
     _timeZoneRepository = timeZoneRepository ?? new InMemoryTimeZoneRepository();
     _daylightSavingsAdjustmentRepository = daylightSavingsAdjustmentRepository ?? new InMemoryDaylightSavingsAdjustmentRepository();
     Load(timeZoneDataSources);
 }
Beispiel #4
0
 public void Load(ITimeZoneRepository timeZoneRepository, IDaylightSavingsAdjustmentRepository daylightSavingsAdjustmentRepository)
 {
     _tzDbLoader.Load(timeZoneRepository, daylightSavingsAdjustmentRepository);
 }