Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageCI"/> class
 /// </summary>
 /// <param name="exportable">The exportable cache item</param>
 /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to obtain summary and fixture</param>
 /// <param name="semaphorePool">The semaphore pool</param>
 /// <param name="defaultCulture">The default culture</param>
 /// <param name="fixtureTimestampCache">A <see cref="ObjectCache"/> used to cache the sport events fixture timestamps</param>
 public StageCI(ExportableStageCI exportable,
                IDataRouterManager dataRouterManager,
                ISemaphorePool semaphorePool,
                CultureInfo defaultCulture,
                ObjectCache fixtureTimestampCache)
     : base(exportable, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache)
 {
     _categoryId  = URN.Parse(exportable.CategoryId);
     _parentStage = exportable.ParentStage != null ? new StageCI(exportable.ParentStage, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache) : null;
     _childStages = exportable.ChildStages?.Select(s => new StageCI(s, dataRouterManager, semaphorePool, defaultCulture, fixtureTimestampCache));
     _stageType   = exportable.StageType;
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Merges the specified event summary
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="culture">The culture</param>
        private void ActualMerge(StageDTO eventSummary, CultureInfo culture)
        {
            base.Merge(eventSummary, culture, false);

            if (eventSummary.ParentStage != null)
            {
                // no translatable data - just replace with new value
                _parentStage = new StageCI(eventSummary.ParentStage, DataRouterManager, SemaphorePool, culture,
                                           DefaultCulture, FixtureTimestampCache);
            }
            else
            {
                if (eventSummary.Tournament != null)
                {
                    _parentStage = new StageCI(eventSummary.Tournament.Id, DataRouterManager, SemaphorePool, culture,
                                               FixtureTimestampCache);
                }
            }

            if (eventSummary.Stages != null)
            {
                // no translatable data - just replace with new value
                _childStages = new ReadOnlyCollection <StageCI>(eventSummary
                                                                .Stages.Select(r => new StageCI(r, DataRouterManager, SemaphorePool, culture,
                                                                                                DefaultCulture, FixtureTimestampCache)).ToList());
            }

            if (eventSummary.Type != null)
            {
                _stageType = eventSummary.Type.Value == SportEventType.Parent
                    ? StageType.Parent
                    : StageType.Child;
            }

            if (eventSummary.Tournament?.Category != null)
            {
                _categoryId = eventSummary.Tournament.Category.Id;
            }
        }