/// <summary>
        ///     Initializes a new instance of the <see cref="SportEventSummaryDTO" /> class
        /// </summary>
        /// <param name="childStage">A <see cref="sportEventChildrenSport_event" /> containing basic information about the event</param>
        protected SportEventSummaryDTO(sportEventChildrenSport_event childStage)
        {
            Contract.Requires(childStage != null);
            Contract.Requires(!string.IsNullOrEmpty(childStage.id));

            Id        = URN.Parse(childStage.id);
            Scheduled = childStage.scheduledSpecified
                ? (DateTime?)childStage.scheduled
                : null;
            ScheduledEnd = childStage.scheduled_endSpecified
                ? (DateTime?)childStage.scheduled_end
                : null;
            //URN sportId;
            //if (URN.TryParse(childStage.tournament?.sport?.id, out sportId))
            //{
            //    SportId = sportId;
            //}
            Name = childStage.name;
            SportEventType?type;

            if (RestMapperHelper.TryGetSportEventType(childStage.type, out type))
            {
                Type = type;
            }
            if (!string.IsNullOrEmpty(childStage.replaced_by))
            {
                URN replacedBy;
                if (URN.TryParse(childStage.replaced_by, out replacedBy))
                {
                    ReplacedBy = replacedBy;
                }
            }

            StartTimeTbd = childStage.start_time_tbdSpecified ? (bool?)childStage.start_time_tbd : null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEventSummaryDTO"/> class
        /// </summary>
        /// <param name="childStage">A <see cref="sportEventChildrenSport_event"/> containing basic information about the event</param>
        protected SportEventSummaryDTO(sportEventChildrenSport_event childStage)
        {
            Guard.Argument(childStage, nameof(childStage)).NotNull();
            Guard.Argument(childStage.id, nameof(childStage.id)).NotNull().NotEmpty();

            Id        = URN.Parse(childStage.id);
            Scheduled = childStage.scheduledSpecified
                            ? (DateTime?)childStage.scheduled.ToLocalTime()
                            : null;
            ScheduledEnd = childStage.scheduled_endSpecified
                               ? (DateTime?)childStage.scheduled_end.ToLocalTime()
                               : null;
            //URN sportId;
            //if (URN.TryParse(childStage.tournament?.sport?.id, out sportId))
            //{
            //    SportId = sportId;
            //}
            Name = childStage.name;
            if (!string.IsNullOrEmpty(childStage.replaced_by))
            {
                if (URN.TryParse(childStage.replaced_by, out var replacedBy))
                {
                    ReplacedBy = replacedBy;
                }
            }
            StartTimeTbd = childStage.start_time_tbdSpecified ? (bool?)childStage.start_time_tbd : null;

            StatusOnEvent = null;
        }
Esempio n. 3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="StageDTO" /> class
 /// </summary>
 /// <param name="childStage">A <see cref="sportEventChildrenSport_event" /> containing basic information about the event</param>
 protected StageDTO(sportEventChildrenSport_event childStage)
     : base(new sportEvent
 {
     id   = childStage.id,
     name = childStage.name,
     type = childStage.type,
     scheduledSpecified     = childStage.scheduledSpecified,
     scheduled              = childStage.scheduled,
     scheduled_endSpecified = childStage.scheduled_endSpecified,
     scheduled_end          = childStage.scheduled_end
 })
 {
 }
        internal CompetitionDTO(sportEventChildrenSport_event stageSummary)
            : base(stageSummary)
        {
            if (RestMapperHelper.TryGetSportEventType(stageSummary.type, out var type))
            {
                Type = type;
            }

            //LiveOdds = null;

            if (RestMapperHelper.TryGetStageType(stageSummary.stage_type, out var stageType))
            {
                StageType = stageType;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StageDTO"/> class
 /// </summary>
 /// <param name="childStage">A <see cref="sportEventChildrenSport_event"/> containing basic information about the event</param>
 internal StageDTO(sportEventChildrenSport_event childStage)
     : base(childStage)
 {
 }