private void LoadSocer(Soccer item) { groupBox2.Visible = true; groupBox3.Visible = false; txtBxStarPlayers.Text = item.StarPlayers; txtBxCoachName.Text = item.CoachesName; txtBxShoes.Text = item.TypeOfShose; txtBxBudget.Text = item.budget().ToString(); numericUpDownPractice.Value = item.PracticeTime; }
public static Team[] BuildData() { teamList = new Team[20]; for (int i = 0; i < 10; i++) { teamList[i] = new Soccer($"Name:{i}", i, i, $"Field Location:{i}", $"Type of shoes:{i}", $"Coaches name: {i}", $"Star players: {i}", i); } for (int i = 10; i < 20; i++) { teamList[i] = new Tenis($"Name:{i}", i, i, $"Field Location:{i}", $"String Racket guy: {i}", $"Coaches name: {i}", $"Star players: {i}", i); } return(teamList); }
private void Form1_Load(object sender, EventArgs e) { teamList = DataBase.BuildData(); foreach (var item in teamList) { if (item is Soccer) { Soccer gameItem = (Soccer)item; lstBxOutPut.Items.Add(item); } // end if else { lstBxOutPut.Items.Add(item); } // end else } // end foreach EnDisFields(false); }
private void lstBxOutPut_SelectedIndexChanged(object sender, EventArgs e) { currentRow = lstBxOutPut.SelectedIndex; Team item = (Team)lstBxOutPut.SelectedItem; if (item is Soccer) { Soccer soccerTeam = (Soccer)item; LoadTeamData(soccerTeam); LoadSocer(soccerTeam); } else { Tenis tenisTeam = (Tenis)item; LoadTeamData(tenisTeam); LoadTenis(tenisTeam); } }