コード例 #1
0
        internal Fixture(FixtureDTO fixtureDto)
        {
            Guard.Argument(fixtureDto, nameof(fixtureDto)).NotNull();

            StartTime          = fixtureDto.StartTime;
            NextLiveTime       = fixtureDto.NextLiveTime;
            StartTimeConfirmed = fixtureDto.StartTimeConfirmed;
            StartTimeTBD       = fixtureDto.StartTimeTbd;
            ReplacedBy         = fixtureDto.ReplacedBy;
            ExtraInfo          = fixtureDto.ExtraInfo;
            if (fixtureDto.TvChannels != null)
            {
                if (TvChannels == null)
                {
                    TvChannels = fixtureDto.TvChannels.Select(tvChannelDTO => new TvChannel(tvChannelDTO.Name, tvChannelDTO.StartTime, tvChannelDTO.StreamUrl)).ToList();
                }
                else
                {
                    var tvChannels = TvChannels.ToList();
                    foreach (var tvChannelDTO in fixtureDto.TvChannels)
                    {
                        var tvChannel = tvChannels.Find(f => f.Name.Equals(tvChannelDTO.Name, StringComparison.InvariantCultureIgnoreCase));
                        if (tvChannel != null)
                        {
                            tvChannels.Remove(tvChannel);
                        }
                        tvChannels.Add(new TvChannel(tvChannelDTO.Name, tvChannelDTO.StartTime, tvChannelDTO.StreamUrl));
                    }
                    TvChannels = tvChannels;
                }
            }
            if (fixtureDto.Coverage != null)
            {
                CoverageInfo = new CoverageInfo(fixtureDto.Coverage.Level, fixtureDto.Coverage.IsLive, fixtureDto.Coverage.Includes, fixtureDto.Coverage.CoveredFrom);
            }
            if (fixtureDto.ProductInfo != null)
            {
                ProductInfo = new ProductInfo(fixtureDto.ProductInfo);
            }

            if (fixtureDto.ReferenceIds != null)
            {
                References = new Reference(new ReferenceIdCI(fixtureDto.ReferenceIds));
            }

            if (fixtureDto.ScheduledStartTimeChanges != null)
            {
                ScheduledStartTimeChanges = fixtureDto.ScheduledStartTimeChanges.Select(s => new ScheduledStartTimeChange(s));
            }
            if (fixtureDto.ParentStage != null)
            {
                ParentStageId = fixtureDto.ParentStage.Id;
            }
            if (!fixtureDto.AdditionalParents.IsNullOrEmpty())
            {
                AdditionalParentsIds = fixtureDto.AdditionalParents.Select(s => s.Id);
            }
        }
コード例 #2
0
        internal Fixture(FixtureDTO fixtureDto)
        {
            Contract.Requires(fixtureDto != null);

            StartTime          = fixtureDto.StartTime;
            NextLiveTime       = fixtureDto.NextLiveTime;
            StartTimeConfirmed = fixtureDto.StartTimeConfirmed;
            StartTimeTBD       = fixtureDto.StartTimeTBD;
            ReplacedBy         = fixtureDto.ReplacedBy;
            ExtraInfo          = fixtureDto.ExtraInfo;
            if (fixtureDto.TvChannels != null)
            {
                if (TvChannels == null)
                {
                    TvChannels = fixtureDto.TvChannels.Select(tvChannelDTO => new TvChannel(tvChannelDTO.Name, tvChannelDTO.StartTime, tvChannelDTO.StreamUrl)).ToList();
                }
                else
                {
                    var tvChannels = TvChannels.ToList();
                    foreach (var tvChannelDTO in fixtureDto.TvChannels)
                    {
                        var tvChannel = tvChannels.Find(f => f.Name.Equals(tvChannelDTO.Name, StringComparison.InvariantCultureIgnoreCase));
                        if (tvChannel != null)
                        {
                            tvChannels.Remove(tvChannel);
                        }
                        tvChannels.Add(new TvChannel(tvChannelDTO.Name, tvChannelDTO.StartTime, tvChannelDTO.StreamUrl));
                    }
                    TvChannels = tvChannels;
                }
            }
            if (fixtureDto.CoverageInfo != null)
            {
                CoverageInfo = new CoverageInfo(fixtureDto.CoverageInfo.Level, fixtureDto.CoverageInfo.IsLive, fixtureDto.CoverageInfo.Includes, fixtureDto.CoverageInfo.CoveredFrom);
            }
            if (fixtureDto.ProductInfo != null)
            {
                ProductInfo = new ProductInfo(fixtureDto.ProductInfo.IsAutoTraded,
                                              fixtureDto.ProductInfo.IsInHostedStatistics,
                                              fixtureDto.ProductInfo.IsInLiveCenterSoccer,
                                              fixtureDto.ProductInfo.IsInLiveScore,
                                              fixtureDto.ProductInfo.ProductInfoLinks?.Select(t => new ProductInfoLink(t.Reference, t.Name)),
                                              fixtureDto.ProductInfo.StreamingChannels?.Select(t => new StreamingChannel(t.Id, t.Name)));
            }

            if (fixtureDto.ReferenceIds != null)
            {
                References = new Reference(new ReferenceIdCI(fixtureDto.ReferenceIds));
            }

            if (fixtureDto.ScheduledStartTimeChanges != null)
            {
                ScheduledStartTimeChanges = fixtureDto.ScheduledStartTimeChanges.Select(s => new ScheduledStartTimeChange(s));
            }
        }