private void UpdateGameAndGameParticipants(GameModel game) { SqlDataHandler.UpdateGameScoreAndStatus(game); if (CurrentTournament.IsLeague) { SqlDataHandler.UpdateLeagueParticipants(CurrentTournament, game); } else { SqlDataHandler.UpdateGameParticipantAsCupRoundWinner(game); } }
public void EnterResult() { HomeTeam.Score = int.Parse(HomeScore); AwayTeam.Score = int.Parse(AwayScore); tournamentView.SelectedGame.Unplayed = false; SqlDataHandler.UpdateGameScoreAndStatus(tournamentView.SelectedGame); if (tournamentView.CurrentTournament.IsLeague) { SqlDataHandler.UpdateLeagueParticipants(tournamentView.CurrentTournament, tournamentView.SelectedGame); } else { SqlDataHandler.UpdateGameParticipantAsCupRoundWinner(tournamentView.SelectedGame); if (RoundComplete()) { int currentRoundIndex = tournamentView.SelectedRound.RoundNumber - 1; List <TeamModel> nextRoundParticipants = SqlDataHandler.GetRoundWinners(tournamentView.SelectedRound.Id); if (tournamentView.SelectedRound.RoundNumber < tournamentView.RoundList.Count) { RoundModel nextRound = tournamentView.CurrentTournament.Rounds[currentRoundIndex + 1]; RoundLogic.CreateCupRoundGames(nextRoundParticipants, nextRound); } } } if (TournamentComplete()) { tournamentView.CurrentTournament.Finished = true; SqlDataHandler.UpdateTournamentStatus(tournamentView.CurrentTournament); } tournamentView.CanEnterResult = false; tournamentView.GameList.Refresh(); TryClose(); }