コード例 #1
0
        /// <summary>
        /// Merges the specified dto
        /// </summary>
        /// <param name="dto">The dto</param>
        /// <param name="culture">The culture</param>
        private void ActualMerge(TournamentInfoDTO dto, CultureInfo culture)
        {
            base.Merge(dto, culture, false);

            if (dto.Category != null)
            {
                _categoryId = dto.Category.Id;
            }
            if (dto.TournamentCoverage != null)
            {
                _tournamentCoverage = new TournamentCoverageCI(dto.TournamentCoverage);
            }
            if (dto.Competitors != null)
            {
                if (_competitors == null)
                {
                    _competitors = new List <CompetitorCI>(dto.Competitors.Select(t => new CompetitorCI(t, culture, DataRouterManager)));
                }
                else
                {
                    MergeCompetitors(dto.Competitors, culture);
                }
                FillCompetitorsReferences(dto.Competitors);
            }
            if (dto.CurrentSeason != null)
            {
                if (_currentSeasonInfo == null)
                {
                    _currentSeasonInfo = new CurrentSeasonInfoCI(dto.CurrentSeason, culture, DataRouterManager);
                }
                else
                {
                    _currentSeasonInfo.Merge(dto.CurrentSeason, culture);
                }
            }
            if (dto.Groups != null)
            {
                if (_groups == null)
                {
                    _groups = new List <GroupCI>(dto.Groups.Select(s => new GroupCI(s, culture, DataRouterManager)));
                }
                else
                {
                    MergeGroups(dto.Groups, culture);
                }
                var comps = new List <CompetitorDTO>();
                foreach (var groupDTO in dto.Groups)
                {
                    comps.AddRange(groupDTO.Competitors);
                }
                FillCompetitorsReferences(comps);
            }
            if (dto.Schedule != null)
            {
                _scheduleUrns = new ReadOnlyCollection <URN>(dto.Schedule.Select(s => s.Id).ToList());
            }
            if (dto.CurrentRound != null)
            {
                if (_round == null)
                {
                    _round = new RoundCI(dto.CurrentRound, culture);
                }
                else
                {
                    _round.Merge(dto.CurrentRound, culture);
                }
            }
            if (!string.IsNullOrEmpty(dto.Year))
            {
                _year = dto.Year;
            }
            if (dto.TournamentInfo != null)
            {
                if (_tournamentInfoBasic == null)
                {
                    _tournamentInfoBasic = new TournamentInfoBasicCI(dto.TournamentInfo, culture, DataRouterManager);
                }
                else
                {
                    _tournamentInfoBasic.Merge(dto.TournamentInfo, culture);
                }
            }
            if (dto.SeasonCoverage != null)
            {
                _seasonCoverage = new SeasonCoverageCI(dto.SeasonCoverage);
            }

            if (dto.ExhibitionGames != null)
            {
                _exhibitionGames = dto.ExhibitionGames;
            }
        }