コード例 #1
0
ファイル: Form1.cs プロジェクト: TomaDan12/PSSC-2017
        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");
            }
        }
コード例 #2
0
 public static void AdaugaJucator(string nume)
 {
     if (!Jucatori.ContainsKey(nume) && nume != "")
     {
         Jucatori[nume] = new Jucator(nume);
     }
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: TomaDan12/PSSC-2017
 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");
     }
 }
コード例 #4
0
 public static void StergeJucator(string nume)
 {
     Jucatori.Remove(nume);
 }