public void SetTeam(Team team)
 {
     lblTeamContact.Content = team.GetTeamContact();
     lblTeamName.Content = team.GetTeamName();
 }
 public void InsertTeam(Team team)
 {
     var teamID = teamCounter++;
     team.SetTeamID(teamID);
     teams.Add(teamID, team.Clone());
     var queries = new List<string>();
     queries.Add(SqlQueries.InsertTeam(teamID, team.GetTeamName(), team.GetTeamContact()));
     foreach (var playerID in team.GetPlayerIDs())
     {
         queries.Add(SqlQueries.InsertPlayerTeam(teamID, playerID));
     }
     foreach (var query in queries)
     {
         var command = new SQLiteCommand(query, dbConnection);
         command.ExecuteNonQuery();
     }
 }
 public void UpdateTeam(Team team)
 {
     var teamID = team.GetTeamID();
     teams[teamID] = team;
     var queries = new List<string>();
     queries.Add(SqlQueries.DeleteTeamPlayers(teamID));
     foreach (var playerID in team.GetPlayerIDs())
     {
         queries.Add(SqlQueries.InsertPlayerTeam(teamID, playerID));
     }
     queries.Add(SqlQueries.UpdateTeam(teamID, team.GetTeamName(), team.GetTeamContact()));
     foreach (var query in queries)
     {
         var command = new SQLiteCommand(query, dbConnection);
         command.ExecuteNonQuery();
     }
 }
Esempio n. 4
0
 public void ShowTeam(Team team, Dictionary<int, Player> players)
 {
     SetTeamName(team.GetTeamName());
     SetTeamContact(team.GetTeamContact());
     lvPlayers.Items.Clear();
     lvPlayers.ItemsSource = players;
 }