Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TournamentInfoBasicCI"/> class
        /// </summary>
        /// <param name="exportable">The exportable</param>
        public TournamentInfoBasicCI(ExportableTournamentInfoBasicCI exportable)
            : base(exportable)
        {
            Category = exportable.Category != null?URN.Parse(exportable.Category) : null;

            CurrentSeason = exportable.CurrentSeason != null
                ? new CurrentSeasonInfoCI(exportable.CurrentSeason)
                : null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TournamentInfoBasicCI"/> class
        /// </summary>
        /// <param name="exportable">The exportable</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager"/> used to fetch missing data</param>
        public TournamentInfoBasicCI(ExportableTournamentInfoBasicCI exportable, IDataRouterManager dataRouterManager)
            : base(exportable)
        {
            _dataRouterManager = dataRouterManager;

            Category = exportable.Category != null?URN.Parse(exportable.Category) : null;

            CurrentSeason = exportable.CurrentSeason != null
                ? new CurrentSeasonInfoCI(exportable.CurrentSeason, dataRouterManager)
                : null;
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TournamentInfoBasicCI"/> class
        /// </summary>
        /// <param name="dto">The dto</param>
        /// <param name="culture">The culture</param>
        public TournamentInfoBasicCI(TournamentInfoDTO dto, CultureInfo culture)
            : base(dto.Id, dto.Name, culture)
        {
            Guard.Argument(dto, nameof(dto)).NotNull();

            if (dto.Category != null)
            {
                Category = dto.Category.Id;
            }
            if (dto.CurrentSeason != null)
            {
                CurrentSeason = new CurrentSeasonInfoCI(dto.CurrentSeason, culture);
            }
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="TournamentInfoBasicCI" /> class
        /// </summary>
        /// <param name="dto">The dto</param>
        /// <param name="culture">The culture</param>
        /// <param name="dataRouterManager">The <see cref="IDataRouterManager" /> used to fetch missing data</param>
        public TournamentInfoBasicCI(TournamentInfoDTO dto, CultureInfo culture, IDataRouterManager dataRouterManager)
            : base(dto.Id, dto.Name, culture)
        {
            Contract.Requires(dto != null);

            _dataRouterManager = dataRouterManager;
            if (dto.Category != null)
            {
                Category = dto.Category.Id;
            }
            if (dto.CurrentSeason != null)
            {
                CurrentSeason = new CurrentSeasonInfoCI(dto.CurrentSeason, culture, _dataRouterManager);
            }
        }
        /// <summary>
        /// Merges the specified dto
        /// </summary>
        /// <param name="dto">The dto</param>
        /// <param name="culture">The culture</param>
        public void Merge(TournamentInfoDTO dto, CultureInfo culture)
        {
            base.Merge(new CacheItem(dto.Id, dto.Name, culture), culture);

            if (dto.Category != null)
            {
                if (!Category.Equals(dto.Category.Id))
                {
                    // WRONG
                }
            }
            if (dto.CurrentSeason != null)
            {
                if (CurrentSeason == null)
                {
                    CurrentSeason = new CurrentSeasonInfoCI(dto.CurrentSeason, culture, _dataRouterManager);
                }
                else
                {
                    CurrentSeason.Merge(dto.CurrentSeason, culture);
                }
            }
        }