internal DrawDTO(draw_fixtures item) : base(new sportEvent { id = item == null ? "wns:draw:1" : item.draw_fixture?.id, name = string.Empty, scheduledSpecified = item?.draw_fixture?.draw_dateSpecified ?? false, scheduled = item?.draw_fixture?.draw_date ?? DateTime.MinValue, tournament = item?.draw_fixture?.lottery == null ? null : new tournament { sport = item.draw_fixture?.lottery.sport } }) { if (item == null || item.draw_fixture == null) { return; } var fixture = item.draw_fixture; if (fixture.lottery != null) { Lottery = new LotteryDTO(fixture.lottery); } Status = RestMapperHelper.MapDrawStatus(fixture.status, fixture.statusSpecified); DisplayId = fixture.display_idSpecified ? fixture.display_id : (int?)null; GeneratedAt = item.generated_atSpecified ? item.generated_at : (DateTime?)null; }
internal DrawDTO(draw_fixture item) : base(new sportEvent { id = item == null ? "wns:draw:1" : item.id, name = string.Empty, scheduledSpecified = item?.draw_dateSpecified ?? false, scheduled = item?.draw_date ?? DateTime.MinValue, tournament = item?.lottery == null ? null : new tournament { sport = item.lottery.sport } }) { Contract.Requires(item != null); Debug.Assert(item != null, nameof(item) + " != null"); if (item.lottery != null) { Lottery = new LotteryDTO(item.lottery); } Status = RestMapperHelper.MapDrawStatus(item.status, item.statusSpecified); DisplayId = item.display_idSpecified ? item.display_id : (int?)null; }
internal DrawInfoDTO(lotteryDraw_info info) { Contract.Requires(info != null); DrawType = RestMapperHelper.MapDrawType(info.draw_type, info.draw_typeSpecified); TimeType = RestMapperHelper.MapTimeType(info.time_type, info.time_typeSpecified); GameType = info.game_type; }
internal DrawInfoDTO(lotteryDraw_info info) { Guard.Argument(info, nameof(info)).NotNull(); DrawType = RestMapperHelper.MapDrawType(info.draw_type, info.draw_typeSpecified); TimeType = RestMapperHelper.MapTimeType(info.time_type, info.time_typeSpecified); GameType = info.game_type; }
internal BonusInfoDTO(lotteryBonus_info info) { Contract.Requires(info != null); BonusBalls = info.bonus_ballsSpecified ? info.bonus_balls : (int?)null; BonusDrumType = RestMapperHelper.MapBonusDrumType(info.bonus_drum, info.bonus_drumSpecified); BonusRange = info.bonus_range; }
internal BonusInfoDTO(lotteryBonus_info info) { Guard.Argument(info, nameof(info)).NotNull(); BonusBalls = info.bonus_ballsSpecified ? info.bonus_balls : (int?)null; BonusDrumType = RestMapperHelper.MapBonusDrumType(info.bonus_drum, info.bonus_drumSpecified); BonusRange = info.bonus_range; }
internal DrawDTO(draw_summary item) : base(new sportEvent { id = item.draw_fixture == null ? "wns:draw:1" : item.draw_fixture.id, name = string.Empty, scheduledSpecified = item.draw_fixture?.draw_dateSpecified ?? false, scheduled = item.draw_fixture?.draw_date ?? DateTime.MinValue, tournament = item.draw_fixture?.lottery == null ? null : new tournament { sport = item.draw_fixture.lottery.sport } }) { Guard.Argument(item, nameof(item)).NotNull(); DisplayId = null; if (item.draw_fixture != null) { if (item.draw_fixture.id != null && item.draw_fixture.lottery != null) { Lottery = new LotteryDTO(item.draw_fixture.lottery); } Status = RestMapperHelper.MapDrawStatus(item.draw_fixture.status, item.draw_fixture.statusSpecified); DisplayId = item.draw_fixture.display_idSpecified ? item.draw_fixture.display_id : (int?)null; } ResultsChronological = false; if (item.draw_result?.draws != null) { ResultsChronological = item.draw_result.draws.chronologicalSpecified && item.draw_result.draws.chronological; if (item.draw_result.draws.draw != null) { var res = item.draw_result.draws.draw.Select(draw => new DrawResultDTO(draw)).ToList(); Results = res; } } GeneratedAt = item.generated_atSpecified ? item.generated_at : (DateTime?)null; }
internal DrawDTO(draw_event item) : base(new sportEvent { id = item == null ? "wns:draw:1" : item.id, name = string.Empty, scheduledSpecified = item?.scheduledSpecified ?? false, scheduled = item?.scheduled ?? DateTime.MinValue }) { if (item == null) { return; } Status = RestMapperHelper.MapDrawStatus(item.status, item.statusSpecified); DisplayId = item.display_idSpecified ? item.display_id : (int?)null; }
/// <summary> /// Maps it's data to <see cref="EntityList{SportEventSummaryDTO}" /> instance /// </summary> /// <returns>The created <see cref="EntityList{SportEventSummaryDTO}" /> instance</returns> public EntityList <SportEventSummaryDTO> Map() { var events = _data.sport_event.Select(e => RestMapperHelper.MapSportEvent(e)).ToList(); return(new EntityList <SportEventSummaryDTO>(events)); }