public void InsertRecord() { HockeyPlayer hp = new HockeyPlayer(PlayerType.HockeyPlayer, (new HockeyPlayer()).generateID(), PlayerNameT.Text, TeamNameT.Text, int.Parse(GamesPlayedT.Text), int.Parse(d1t.Text), int.Parse(d2t.Text)); Program.lstPlayers.Add(hp); Populate_List(); }
private void List_Click(object sender, EventArgs e) { List_index = List.SelectedIndex; for (int i = 0; i < Program.lstPlayers.Count; i++) { if (List_index != -1) { player = Program.lstPlayers[i]; if (player.PlayerType.ToString().Equals("HockeyPlayer")) { hcp = (HockeyPlayer)player; if (player.PlayerName.Equals(List.SelectedItem.ToString())) { tempIndex = i; PlayerIdL.Visibility = Visibility.Visible; PlayerIdT.Visibility = Visibility.Visible; TotalPointsL.Visibility = Visibility.Visible; TotalPointsT.Visibility = Visibility.Visible; d1l.Content = "Assists: "; d2l.Content = "Goals: "; PlayerIdT.Text = hcp.PlayerId.ToString(); PlayerIdT.IsReadOnly = true; PlayerNameT.Text = hcp.PlayerName; TeamNameT.Text = hcp.TeamName; GamesPlayedT.Text = hcp.GamesPlayed.ToString(); d1t.Text = hcp.Assists.ToString(); d2t.Text = hcp.Goals.ToString(); TotalPointsT.Text = hcp.TotalPoints.ToString(); TotalPointsT.IsReadOnly = true; } } } } }
public void UpdateRecord() { HockeyPlayer hp = new HockeyPlayer(PlayerType.HockeyPlayer, int.Parse(PlayerIdT.Text), PlayerNameT.Text, TeamNameT.Text, int.Parse(GamesPlayedT.Text), int.Parse(d1t.Text), int.Parse(d2t.Text)); Program.lstPlayers[tempIndex] = hp; Populate_List(); }