public void InsertRecord() { BasketBallPlayer hp = new BasketBallPlayer(PlayerType.BasketBallPlayer, (new BasketBallPlayer()).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("BasketBallPlayer")) { bbp = (BasketBallPlayer)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 = "Field Goals: "; d2l.Content = "Three pointers: "; PlayerIdT.Text = bbp.PlayerId.ToString(); PlayerIdT.IsReadOnly = true; PlayerNameT.Text = bbp.PlayerName; TeamNameT.Text = bbp.TeamName; GamesPlayedT.Text = bbp.GamesPlayed.ToString(); d1t.Text = bbp.FieldGoals.ToString(); d2t.Text = bbp.ThreePointers.ToString(); TotalPointsT.Text = bbp.TotalPoints.ToString(); TotalPointsT.IsReadOnly = true; } } } } }
public void UpdateRecord() { BasketBallPlayer hp = new BasketBallPlayer(PlayerType.BasketBallPlayer, 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(); }