private void addTeamButton_Click(object sender, RoutedEventArgs e) { AddTeam addTeamWindow = new AddTeam(); addTeamWindow.Owner = this; if (IsOpen == false) { //addTeamWindow.deleteButton.Visibility = Visibility.Collapsed; addTeamWindow.Show(); addTeamWindow.Topmost = true; IsOpen = true; } }
private void editTeamButton_Click(object sender, RoutedEventArgs e) { int id = 0; string name = ""; string establishment = string.Empty; string logo = ""; int teamTournament_ID = 0; if (teamsListBox.SelectedItems.Count == 1) { TeamName = teamsListBox.SelectedItem.ToString(); OpenConnection(); MySqlCommand cmd = new MySqlCommand("Select * from teams where Team_ID = (select Team_ID from teams where Team_Name ='" + TeamName + "')", conn); MySqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { id = rd.GetInt32(0); name = rd.GetString(1); establishment = rd.GetString(2); logo = rd.GetString(3); teamTournament_ID = rd.GetInt32(4); } CloseConnection(); AddTeam addTeamWindow = new AddTeam(GetCountryID(), CountryName, GetTournamentName(), id, name, establishment, logo, true); addTeamWindow.Owner = this; if (IsOpen == false) { addTeamWindow.Show(); IsOpen = true; } } else { MessageBox.Show("Prosze zaznaczyć drużynę"); } }