private void buttonJucator_Click(object sender, EventArgs e) { if (textBoxNume.Text.ToString() != null || textBoxPost.Text.ToString() != null || textBoxVarsta.Text.ToString() != null || textBoxNumar.Text.ToString() != null || textBoxEchipa.Text.ToString() != null) { Jucatori jucator = new Jucatori(textBoxNume.Text.ToString(), int.Parse(textBoxVarsta.Text.ToString()), textBoxPost.Text.ToString(), int.Parse(textBoxNumar.Text.ToString()), textBoxEchipa.Text.ToString()); jucatori.AdaugaJucator(jucator); echipa = echipe.GasesteEchipa(textBoxEchipa.Text.ToString()); if (echipa != null) { echipa.add_jucator(jucator); MessageBox.Show("Jucatorul a fost adaugat in echipa"); } else { MessageBox.Show("Jucatorul nu a fost adaugat in echipa"); } } else { MessageBox.Show("Nu ati completat toate campurile"); } }
public static void AdaugaJucator(string nume) { if (!Jucatori.ContainsKey(nume) && nume != "") { Jucatori[nume] = new Jucator(nume); } }
private void button3_Click(object sender, EventArgs e) { jucatorrep = jucatori.FindJucator(textBoxCautareJucator.Text.ToString()); if (echipa != null) { textBoxNume.Text = jucatorrep.get_nume().ToString(); textBoxVarsta.Text = jucatorrep.get_varsta().ToString(); textBoxPost.Text = jucatorrep.get_post().ToString(); textBoxNumar.Text = jucatorrep.get_nr_tricou().ToString(); textBoxEchipa.Text = jucatorrep.get_echipa().ToString(); MessageBox.Show("Jucatorul a fost gasit"); } else { MessageBox.Show("Jucatorul nu a fost gasit"); } }
public static void StergeJucator(string nume) { Jucatori.Remove(nume); }