private void ShowTournament(object sender, MouseButtonEventArgs e) { if (type == 1) { if (TournamentList.SelectedIndex == -1) { return; } if (tournamentsForSection.ElementAt(TournamentList.SelectedIndex).Drawn) { TournamentInfoGroup win2 = new TournamentInfoGroup(databaseName, tournamentsForSection.ElementAt(TournamentList.SelectedIndex).ID, true); win2.ShowDialog(); } else { using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=.\" + databaseName + ";")) { conn.Open(); SQLiteCommand command = new SQLiteCommand("select team.name, tournament.name from tournament_token join tournament on tournament.id_tournament=tournament_token.id_tournament_to join teamxsection on teamxsection.id_teamxsection=tournament_token.id_teamxsection join team on teamxsection.id_team=team.id_team where tournament_token.id_tournament_to=" + tournamentsForSection.ElementAt(TournamentList.SelectedIndex).ID + ";", conn); SQLiteDataReader reader = command.ExecuteReader(); int counter = 1; string allTeams = ""; while (reader.Read()) { if (counter == 1) { allTeams += reader.GetString(1) + '\n' + '\n'; } allTeams += counter + ": " + reader.GetString(0) + '\n'; counter++; } MessageBox.Show(allTeams, "Registrovaní do turnaje", MessageBoxButton.OK); reader.Close(); } } } else { using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=.\" + databaseName + ";")) { conn.Open(); SQLiteCommand command = new SQLiteCommand("select team.name, tournament.name from tournament_token join tournament on tournament.id_tournament=tournament_token.id_tournament_to join teamxsection on teamxsection.id_teamxsection=tournament_token.id_teamxsection join team on teamxsection.id_team=team.id_team where tournament_token.id_tournament_to=" + openTournaments.ElementAt(TournamentList.SelectedIndex).ID + ";", conn); SQLiteDataReader reader = command.ExecuteReader(); int counter = 1; string allTeams = ""; while (reader.Read()) { if (counter == 1) { allTeams += reader.GetString(1) + '\n' + '\n'; } allTeams += counter + ": " + reader.GetString(0) + '\n'; counter++; } MessageBox.Show(allTeams, "Registrovaní do turnaje", MessageBoxButton.OK); reader.Close(); } } }
private void ShowTournamentDetail(object sender, MouseButtonEventArgs e) { DataGrid d = (DataGrid)sender; if (d.SelectedIndex > -1) { List <Tournament> l = (List <Tournament>)d.ItemsSource; TournamentInfoGroup win2 = new TournamentInfoGroup(databaseName, l.ElementAt(d.SelectedIndex).ID, false); win2.ShowDialog(); } }
private void ShowTournament(object sender, MouseButtonEventArgs e) { if (type == 1) { if (TournamentList.SelectedIndex == -1) { return; } TournamentInfoGroup win2 = new TournamentInfoGroup(databaseName, tournamentsForSection.ElementAt(TournamentList.SelectedIndex).ID, true); win2.ShowDialog(); } else { } }