Exemple #1
0
 private void HandleBtnView_Click(object sender, RoutedEventArgs e)
 {
     var teamEdit = new TeamEdit(fileHandler);
     teamEdit.SetTeam(team);
     teamEdit.SetPlayers(players);
     teamEdit.ShowTeam();
     teamView.Hide();
     ModalDisplay.ShowModal(teamEdit, teamView);
     if (teamEdit.GetButtonAction().Equals(ButtonAction.DONE))
     {
         team = teamEdit.GetTeam();
         team.SetTeamID(teamID);
         fileHandler.UpdateTeam(team);
         SetTeamDetail(teamID);
     }
     teamView.ShowDialog();
 }
 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();
     }
 }