Пример #1
0
        /// <summary>
        /// Merges the specified event summary
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="culture">The culture</param>
        private void ActualMerge(MatchDTO eventSummary, CultureInfo culture)
        {
            base.Merge(eventSummary, culture, false);

            if (eventSummary.Season != null)
            {
                if (_season == null)
                {
                    _season = new CacheItem(eventSummary.Season.Id, eventSummary.Season.Name, culture);
                }
                else
                {
                    _season.Merge(eventSummary.Season, culture);
                }
            }
            if (eventSummary.Round != null)
            {
                if (_tournamentRound == null)
                {
                    _tournamentRound = new RoundCI(eventSummary.Round, culture);
                }
                else
                {
                    _tournamentRound.Merge(eventSummary.Round, culture);
                }
            }
            if (eventSummary.Tournament != null)
            {
                _tournamentId = eventSummary.Tournament.Id;
            }
        }
Пример #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(MatchDTO eventSummary, CultureInfo culture)
        {
            base.Merge(eventSummary, culture, false);

            if (eventSummary.Season != null)
            {
                if (_season == null)
                {
                    _season = new SeasonCI(eventSummary.Season, culture);
                }
                else
                {
                    _season.Merge(eventSummary.Season, culture);
                }
            }
            if (eventSummary.Round != null)
            {
                if (_tournamentRound == null)
                {
                    _tournamentRound = new RoundCI(eventSummary.Round, culture);
                }
                else
                {
                    _tournamentRound.Merge(eventSummary.Round, culture);
                }
            }
            if (eventSummary.Tournament != null)
            {
                _tournamentId = eventSummary.Tournament.Id;
            }
            if (eventSummary.Coverage != null)
            {
                _coverageInfo = new CoverageInfoCI(eventSummary.Coverage);
            }
        }
Пример #3
0
        public void RoundMergeTest()
        {
            var matchRoundTypeEn = new matchRound
            {
                name = "round name in english",
                cup_round_match_number          = 1,
                cup_round_match_numberSpecified = true,
                cup_round_matches          = 2,
                cup_round_matchesSpecified = true,
                number          = 10,
                numberSpecified = true,
                type            = "match type 1",
            };

            var matchRoundTypeDe = new matchRound
            {
                name = "round name in deutsch",
                cup_round_match_number          = 1,
                cup_round_match_numberSpecified = true,
                cup_round_matches          = 2,
                cup_round_matchesSpecified = true,
                number          = 10,
                numberSpecified = true,
                type            = "match type 1",
            };

            var roundDTO1 = new RoundDTO(matchRoundTypeEn);
            var roundDTO2 = new RoundDTO(matchRoundTypeDe);
            var roundCI   = new RoundCI(roundDTO1, _cultureFirst);

            roundCI.Merge(roundDTO2, _cultureSecond);

            Assert.IsNotNull(roundCI);
            Assert.AreEqual(matchRoundTypeEn.name, roundCI.GetName(_cultureFirst));
            Assert.AreEqual(matchRoundTypeDe.name, roundCI.GetName(_cultureSecond));
            Assert.AreEqual(matchRoundTypeEn.cup_round_match_number, roundCI.CupRoundMatchNumber);
            Assert.AreEqual(matchRoundTypeEn.cup_round_matches, roundCI.CupRoundMatches);
            Assert.AreEqual(matchRoundTypeEn.number, roundCI.Number);
            Assert.AreEqual(matchRoundTypeEn.type, roundCI.Type);
        }
        /// <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;
            }
        }