Ejemplo n.º 1
0
        private void listMatches_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BasketballMatch secilen = new BasketballMatch();

            secilen          = (BasketballMatch)listMatches.SelectedItem;
            grd1.DataContext = secilen;
        }
Ejemplo n.º 2
0
 public void allMatches()
 {
     basketballMatches   = new ObservableCollection <BasketballMatch>();
     command             = new SqlCommand();
     command.Connection  = connection;
     command.CommandText = "SELECT BasketballMatch.matchID, matchDate, matchTime, hTeamName, aTeamName, matchScore FROM  AwayTeamInfo INNER JOIN " +
                           "MatchStatistics ON dbo.AwayTeamInfo.aTeamID = MatchStatistics.aTeamID INNER JOIN " +
                           "BasketballMatch ON dbo.MatchStatistics.matchID = BasketballMatch.matchID INNER JOIN " +
                           "HomeTeamInfo ON dbo.MatchStatistics.hTeamID = HomeTeamInfo.hTeamID";
     connection.Open();
     reader = command.ExecuteReader();
     while (reader.Read())
     {
         basketballMatch         = new BasketballMatch();
         basketballMatch.MatchID = (int)reader["matchID"];
         DateTime date = (DateTime)reader["matchDate"];
         basketballMatch.MatchDate    = date.ToShortDateString();
         basketballMatch.MatchTime    = (TimeSpan)reader["matchTime"];
         basketballMatch.AwayTeamName = (string)reader["aTeamName"];
         basketballMatch.HomeTeamName = (string)reader["hTeamName"];
         basketballMatch.MatchScore   = (string)reader["matchScore"];
         basketballMatches.Add(basketballMatch);
     }
     connection.Close();
     listMatches.ItemsSource = basketballMatches;
 }