Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
        public void Merge(BasicEventDTO dto, CultureInfo culture)
        {
            HomeScore    = dto.HomeScore;
            AwayScore    = dto.AwayScore;
            MatchTime    = dto.MatchTime;
            Period       = dto.Period;
            PeriodName   = dto.PeriodName;
            Points       = dto.Points;
            StoppageTime = dto.StoppageTime;
            Team         = dto.Team;
            Type         = dto.Type;
            Value        = dto.Value;
            X            = dto.X;
            Y            = dto.Y;
            Time         = dto.Time;
            if (dto.Assists != null && dto.Assists.Any())
            {
                if (Assists == null || !Assists.Any())
                {
                    Assists = dto.Assists.Select(s => new EventPlayerAssistCI(s, culture));
                }
                else
                {
                    var newAssists = new List <EventPlayerAssistCI>();
                    foreach (var assist in dto.Assists)
                    {
                        var a = Assists.FirstOrDefault(f => Equals(f.Id, assist.Id));
                        if (a != null && a.Id.Equals(assist.Id))
                        {
                            a.Merge(assist, culture);
                            newAssists.Add(a);
                        }
                        else
                        {
                            newAssists.Add(new EventPlayerAssistCI(assist, culture));
                        }
                    }

                    Assists = newAssists;
                }
            }

            if (dto.GoalScorer != null)
            {
                if (GoalScorer == null)
                {
                    GoalScorer = new CacheItem(dto.GoalScorer.Id, dto.GoalScorer.Name, culture);
                }
                else
                {
                    GoalScorer.Merge(dto.GoalScorer, culture);
                }
            }

            if (dto.Player != null)
            {
                if (Player == null)
                {
                    Player = new CacheItem(dto.Player.Id, dto.Player.Name, culture);
                }
                else
                {
                    Player.Merge(dto.Player, culture);
                }
            }

            MatchStatusCode = dto.MatchStatusCode;
            MatchClock      = dto.MatchClock;
        }