コード例 #1
0
 private async Task ValidateOrCreateRound(AddPlayerFixtureCommand command)
 {
     if (this._round == null && (command.Round.CreateIfMissing && command.Round.GameNumber.HasValue))
     {
         this._round = this._competitionEvent.CreateRound <PlayerCompetitionRound>(command.Round.RoundType, (byte)command.Round.GameNumber);
         await this._competitionRoundRepository.Save(this._round);
     }
     else
     {
         this._validationResult.Errors.Add(new ValidationFailure("round", $"Round '{command.Round.RoundType}' does not exist on the event."));
     }
 }
コード例 #2
0
        private static string GenerateCompetitionRoundDescription(PlayerCompetitionRound competitionRound)
        {
            var description = String.Empty;
            var dto         = competitionRound.AssemblePlayerDto();

            if (competitionRound.CompetitionEvent is League)
            {
                var league = (League)competitionRound.CompetitionEvent;
                if (!string.IsNullOrEmpty(league.Name))
                {
                    description += $"{league.Name} | ";
                }
            }

            description += dto.Description;
            return(description);
        }
コード例 #3
0
 private async Task LoadRound(AddPlayerFixtureCommand command, List <PlayerCompetitionRound> rounds)
 {
     if (this._competitionEvent is Knockout)
     {
         if (command.Round.GameNumber.HasValue)
         {
             this._round = rounds.SingleOrDefault(x => x.CompetitionRoundTypeID == command.Round.RoundType && x.GameNumber == command.Round.GameNumber.Value);
         }
         else
         {
             this._round = rounds.SingleOrDefault(x => x.CompetitionRoundTypeID == command.Round.RoundType);
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }
コード例 #4
0
        public async Task <ApiResponse> GetResults()
        {
            List <Com.BinaryBracket.BowlsResults.Competition.Domain.Entities.Competition> competitions = await this._competitionRepository.GetPastPlayerCompetitions();

            foreach (var competition in competitions)
            {
                if (competition.Stages.Count > 0)
                {
                    var lastStage = competition.Stages.OrderByDescending(x => x.Sequence).First();
                    if (lastStage.CompetitionStageFormatID == CompetitionStageFormats.SingleKnockout)
                    {
                        Knockout knockout = this._sessionProvider.Session
                                            .Query <Knockout>()
                                            .SingleOrDefault(x => x.CompetitionStage.ID == lastStage.ID);
                        if (knockout != null)
                        {
                            PlayerCompetitionRound round = this._sessionProvider.Session.Query <PlayerCompetitionRound>()
                                                           .SingleOrDefault(x => x.CompetitionEvent.ID == knockout.ID && x.CompetitionRoundTypeID == CompetitionRoundTypes.Final);

                            if (round != null)
                            {
                                var fixture = round.Fixtures.SingleOrDefault();
                                if (fixture != null)
                                {
                                    string x = "";
                                }
                            }
                        }
                    }
                }
            }

            List <CompetitionDto> dto = competitions.AssembleDtoList();

            return(ApiResponse.CreateSuccess(dto));
        }