public void LoadForm(int tournamentId) { _tournament = _db.GetTournament(tournamentId); _players = _db.GetTournamentPlayers(tournamentId); _tables = _db.GetTournamentTables(tournamentId); _form.GeneratePlayersButtons(_players.Count); }
public void DeleteTournament(int tournamentId) { DeleteHands(_db.Hands.ToList().FindAll(x => x.HandTournamentId == tournamentId)); DeleteTables(_db.Tables.ToList().FindAll(x => x.TableTournamentId == tournamentId)); DeletePlayers(_db.Players.ToList().FindAll(x => x.PlayerTournamentId == tournamentId)); DBTournament tournament = _db.Tournaments.ToList().Find(x => x.TournamentId == tournamentId); if (tournament.IsTeams) { DeleteTeams(_db.Teams.ToList().FindAll(x => x.TeamTournamentId == tournamentId)); } _db.Tournaments.Remove(tournament); _db.SaveChanges(); }
public void LoadTournament(int tournamentId) { _tournament = _db.GetTournament(tournamentId); _tables = _db.GetTournamentTables(tournamentId); if (_tournament.IsTeams) { _players = _db.GetTournamentPlayers(_tournament.TournamentId); _teams = _db.GetTournamentTeams(_tournament.TournamentId); _form.ShowButtonTeams(); if (IsWrongPlayersTeams()) { ButtonPlayersClicked(); return; } } GenerateRoundsAndTablesButtons(); }
public void LoadForm(int tournamentId) { _tournament = _db.GetTournament(tournamentId); _players = _db.GetTournamentPlayers(tournamentId); if (_tournament.IsTeams) { _teams = _db.GetTournamentTeams(tournamentId); } _countries = _db.GetCountries(); List <DGVPlayer> dgvPlayers = new List <DGVPlayer>(_players.Count); foreach (DBPlayer player in _players) { dgvPlayers.Add(new DGVPlayer(player, getPlayerTeamName(player.PlayerTeamId), CountryFlags.GetFlagImage(player.PlayerCountryName))); } _form.FillDGV(dgvPlayers, _tournament.IsTeams); CheckWrongPlayersTeams(); }
public void AddTournament(DBTournament tournament) { _db.Tournaments.Add(tournament); _db.SaveChanges(); }
public void LoadForm(int tournamentId) { _tournament = _db.GetTournament(tournamentId); _teams = _db.GetTournamentTeams(tournamentId); _form.FillDGV(_teams); }
private void SaveTournament() { _tournament = new DBTournament(DateTime.Now, _players.Count, _numRounds, _isTeamsChecked, _tournamentName); _db.AddTournament(_tournament); }