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 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; }