예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageDTO"/> class
 /// </summary>
 /// <param name="stageEvent">A <see cref="stageSummaryEndpoint"/> containing basic information about the event</param>
 internal StageDTO(stageSummaryEndpoint stageEvent)
     : base(stageEvent)
 {
     if (stageEvent.sport_event == null)
     {
         return;
     }
     if (stageEvent.sport_event.races != null && stageEvent.sport_event.races.Any())
     {
         Stages = stageEvent.sport_event.races.Select(s => new StageDTO(s));
     }
     if (stageEvent.sport_event?.tournament != null)
     {
         Tournament = new TournamentDTO(stageEvent.sport_event.tournament);
     }
     if (stageEvent.sport_event.parent != null)
     {
         ParentStage = new StageDTO(stageEvent.sport_event.parent);
     }
     if (ParentStage == null && Type != null && Type == SportEventType.Parent && stageEvent.sport_event.tournament != null)
     {
         ParentStage = new StageDTO(new TournamentDTO(stageEvent.sport_event.tournament));
     }
     if (!stageEvent.sport_event.additional_parents.IsNullOrEmpty())
     {
         AdditionalParents = stageEvent.sport_event.additional_parents.Select(s => new StageDTO(s));
     }
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MatchDTO"/> class
        /// </summary>
        /// <param name="matchSummary">A <see cref="matchSummaryEndpoint"/> instance containing basic information about the sport event</param>
        internal MatchDTO(matchSummaryEndpoint matchSummary)
            : base(matchSummary)
        {
            Guard.Argument(matchSummary, nameof(matchSummary)).NotNull();

            if (matchSummary.sport_event.season != null)
            {
                Guard.Argument(matchSummary.sport_event.season.id, nameof(matchSummary.sport_event.season.id)).NotNull().NotEmpty();
                Guard.Argument(matchSummary.sport_event.season.name, nameof(matchSummary.sport_event.season.name)).NotNull().NotEmpty();
                Season = new SeasonDTO(matchSummary.sport_event.season);
            }
            if (matchSummary.sport_event.tournament_round != null)
            {
                Round = new RoundDTO(matchSummary.sport_event.tournament_round);
            }
            if (matchSummary.sport_event.tournament != null)
            {
                Guard.Argument(matchSummary.sport_event.tournament.id, nameof(matchSummary.sport_event.tournament.id)).NotNull().NotEmpty();
                Guard.Argument(matchSummary.sport_event.tournament.name, nameof(matchSummary.sport_event.tournament.name)).NotNull().NotEmpty();
                Tournament = new TournamentDTO(matchSummary.sport_event.tournament);
            }
            if (matchSummary.coverage_info != null)
            {
                Coverage = new CoverageInfoDTO(matchSummary.coverage_info);
            }
        }
예제 #3
0
 internal StageDTO(TournamentDTO tournament)
     : this(new sportEvent
 {
     id = tournament.Id.ToString(),
     name = tournament.Name,
     //type = tournament.type,
     scheduledSpecified = tournament.Scheduled != null,
     scheduled = tournament.Scheduled.GetValueOrDefault(DateTime.MinValue),
     scheduled_endSpecified = tournament.ScheduledEnd != null,
     scheduled_end = tournament.ScheduledEnd.GetValueOrDefault(DateTime.MinValue),
     //liveodds = tournament.liveodds,
     //season = tournament.season,
     tournament = new tournament {
         id = tournament.Id.ToString(),
         name = tournament.Name,
         scheduledSpecified = tournament.Scheduled != null,
         scheduled = tournament.Scheduled.GetValueOrDefault(DateTime.MinValue),
         scheduled_endSpecified = tournament.ScheduledEnd != null,
         scheduled_end = tournament.ScheduledEnd.GetValueOrDefault(DateTime.MinValue),
         category = new category
         {
             id = tournament.Category.Id.ToString(),
             name = tournament.Category.Name,
             country_code = tournament.Category.CountryCode
         },
         sport = new sport {
             id = tournament.Sport.Id.ToString(),
             name = tournament.Sport.Name
         }
     }
 })
 {
     Tournament = tournament;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="TournamentDTO"/> class
        /// </summary>
        /// <param name="tournament">A <see cref="TournamentDTO"/> containing basic tournament info</param>
        internal TournamentInfoDTO(TournamentDTO tournament)
            : base(new sportEvent
        {
            id   = tournament.Id.ToString(),
            name = tournament.Name,
            scheduledSpecified     = tournament.Scheduled != null,
            scheduled              = tournament.Scheduled.GetValueOrDefault(DateTime.MinValue),
            scheduled_endSpecified = tournament.ScheduledEnd != null,
            scheduled_end          = tournament.ScheduledEnd.GetValueOrDefault(DateTime.MinValue),
            tournament             = new tournament
            {
                id    = tournament.Id.ToString(),
                sport = new sport
                {
                    id   = tournament.Sport.Id.ToString(),
                    name = tournament.Sport.Name
                }
            }
        })
        {
            TournamentCoverage = null;

            Category = tournament.Category;

            Sport = tournament.Sport == null
                ? null
                : tournament.Sport;

            Competitors = null;

            CurrentSeason = tournament.CurrentSeason == null
                ? null
                : new CurrentSeasonInfoDTO(tournament.CurrentSeason);

            Season = null;

            SeasonCoverage = tournament.SeasonCoverage;

            Groups = null;

            Schedule = null;

            CurrentRound = null;

            Year = null;

            TournamentInfo = null;

            //TODO: missing year, tournamentInfo
        }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageDTO"/> class
 /// </summary>
 /// <param name="stageEvent">A <see cref="stageSummaryEndpoint"/> containing basic information about the event</param>
 internal StageDTO(stageSummaryEndpoint stageEvent)
     : base(stageEvent)
 {
     if (stageEvent.sport_event.parent != null)
     {
         ParentStage = new StageDTO(stageEvent.sport_event.parent);
     }
     if (stageEvent.sport_event.races != null && stageEvent.sport_event.races.Any())
     {
         Stages = stageEvent.sport_event.races.Select(s => new StageDTO(s));
     }
     if (stageEvent.sport_event?.tournament != null)
     {
         Tournament = new TournamentDTO(stageEvent.sport_event.tournament);
     }
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageDTO"/> class
 /// </summary>
 /// <param name="sportEvent">A <see cref="sportEvent"/> containing basic information about the event</param>
 internal StageDTO(sportEvent sportEvent)
     : base(sportEvent)
 {
     if (sportEvent.parent != null)
     {
         ParentStage = new StageDTO(sportEvent.parent);
     }
     if (sportEvent.races != null && sportEvent.races.Any())
     {
         Stages = sportEvent.races.Select(s => new StageDTO(s));
     }
     if (sportEvent.tournament != null)
     {
         Tournament = new TournamentDTO(sportEvent.tournament);
     }
 }
예제 #7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="StageDTO" /> class
 /// </summary>
 /// <param name="stageEvent">A <see cref="stageSummaryEndpoint" /> containing basic information about the event</param>
 internal StageDTO(stageSummaryEndpoint stageEvent)
     : base(stageEvent)
 {
     if (stageEvent.sport_event.parent != null)
     {
         ParentStage = new StageDTO(stageEvent.sport_event.parent);
     }
     if (stageEvent.sport_event.races != null && stageEvent.sport_event.races.Any())
     {
         Stages = stageEvent.sport_event.races.Select(s => new StageDTO(s));
     }
     if (stageEvent.sport_event?.tournament != null)
     {
         Contract.Assume(!string.IsNullOrEmpty(stageEvent.sport_event.tournament.id));
         Contract.Assume(!string.IsNullOrEmpty(stageEvent.sport_event.tournament.name));
         Tournament = new TournamentDTO(stageEvent.sport_event.tournament);
     }
 }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MatchDTO"/> class
        /// </summary>
        /// <param name="sportEvent">A <see cref="sportEvent"/> instance containing basic information about the sport event</param>
        internal MatchDTO(sportEvent sportEvent)
            : base(sportEvent)
        {
            Guard.Argument(sportEvent, nameof(sportEvent)).NotNull();

            if (sportEvent.season != null)
            {
                Season = new SeasonDTO(sportEvent.season);
            }
            if (sportEvent.tournament_round != null)
            {
                Round = new RoundDTO(sportEvent.tournament_round);
            }
            if (sportEvent.tournament != null)
            {
                Guard.Argument(sportEvent.tournament.id, nameof(sportEvent.tournament.id)).NotNull().NotEmpty();
                Guard.Argument(sportEvent.tournament.name, nameof(sportEvent.tournament.name)).NotNull().NotEmpty();
                Tournament = new TournamentDTO(sportEvent.tournament);
            }
        }
예제 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MatchDTO"/> class
        /// </summary>
        /// <param name="matchSummary">A <see cref="matchSummaryEndpoint"/> instance containing basic information about the sport event</param>
        internal MatchDTO(matchSummaryEndpoint matchSummary)
            : base(matchSummary)
        {
            Guard.Argument(matchSummary, nameof(matchSummary)).NotNull();

            if (matchSummary.sport_event.season != null)
            {
                Guard.Argument(matchSummary.sport_event.season.id, nameof(matchSummary.sport_event.season.id)).NotNull().NotEmpty();
                Guard.Argument(matchSummary.sport_event.season.name, nameof(matchSummary.sport_event.season.name)).NotNull().NotEmpty();
                Season = new SportEntityDTO(matchSummary.sport_event.season.id, matchSummary.sport_event.season.name);
            }
            if (matchSummary.sport_event.tournament_round != null)
            {
                Round = new RoundDTO(matchSummary.sport_event.tournament_round);
            }
            if (matchSummary.sport_event.tournament != null)
            {
                Guard.Argument(matchSummary.sport_event.tournament.id, nameof(matchSummary.sport_event.tournament.id)).NotNull().NotEmpty();
                Guard.Argument(matchSummary.sport_event.tournament.name, nameof(matchSummary.sport_event.tournament.name)).NotNull().NotEmpty();
                Tournament = new TournamentDTO(matchSummary.sport_event.tournament);
            }
        }
예제 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MatchDTO"/> class
        /// </summary>
        /// <param name="matchSummary">A <see cref="matchSummaryEndpoint"/> instance containing basic information about the sport event</param>
        internal MatchDTO(matchSummaryEndpoint matchSummary)
            : base(matchSummary)
        {
            Contract.Requires(matchSummary != null);

            if (matchSummary.sport_event.season != null)
            {
                Contract.Assume(!string.IsNullOrEmpty(matchSummary.sport_event.season.id));
                Contract.Assume(!string.IsNullOrEmpty(matchSummary.sport_event.season.name));
                Season = new SportEntityDTO(matchSummary.sport_event.season.id, matchSummary.sport_event.season.name);
            }
            if (matchSummary.sport_event.tournament_round != null)
            {
                Round = new RoundDTO(matchSummary.sport_event.tournament_round);
            }
            if (matchSummary.sport_event.tournament != null)
            {
                Contract.Assume(!string.IsNullOrEmpty(matchSummary.sport_event.tournament.id));
                Contract.Assume(!string.IsNullOrEmpty(matchSummary.sport_event.tournament.name));
                Tournament = new TournamentDTO(matchSummary.sport_event.tournament);
            }
        }
예제 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MatchDTO"/> class
        /// </summary>
        /// <param name="sportEvent">A <see cref="sportEvent"/> instance containing basic information about the sport event</param>
        internal MatchDTO(sportEvent sportEvent)
            : base(sportEvent)
        {
            Contract.Requires(sportEvent != null);

            if (sportEvent.season != null)
            {
                Contract.Assume(!string.IsNullOrEmpty(sportEvent.season.id));
                Contract.Assume(!string.IsNullOrEmpty(sportEvent.season.name));
                Season = new SportEntityDTO(sportEvent.season.id, sportEvent.season.name);
            }
            if (sportEvent.tournament_round != null)
            {
                Round = new RoundDTO(sportEvent.tournament_round);
            }
            if (sportEvent.tournament != null)
            {
                Contract.Assume(!string.IsNullOrEmpty(sportEvent.tournament.id));
                Contract.Assume(!string.IsNullOrEmpty(sportEvent.tournament.name));
                Tournament = new TournamentDTO(sportEvent.tournament);
            }
        }
예제 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageDTO"/> class
 /// </summary>
 /// <param name="sportEvent">A <see cref="sportEvent"/> containing basic information about the event</param>
 internal StageDTO(sportEvent sportEvent)
     : base(sportEvent)
 {
     if (sportEvent.races != null && sportEvent.races.Any())
     {
         Stages = sportEvent.races.Select(s => new StageDTO(s));
     }
     if (sportEvent.tournament != null)
     {
         Tournament = new TournamentDTO(sportEvent.tournament);
     }
     if (sportEvent.parent != null)
     {
         ParentStage = new StageDTO(sportEvent.parent);
     }
     if (ParentStage == null && Type != null && Type == SportEventType.Parent && sportEvent.tournament != null)
     {
         ParentStage = new StageDTO(new TournamentDTO(sportEvent.tournament));
     }
     if (sportEvent.additional_parents != null && sportEvent.additional_parents.Any())
     {
         AdditionalParents = sportEvent.additional_parents.Select(s => new StageDTO(s));
     }
 }