Exemple #1
0
        private static void DemoCreate(Gara g, Società s, Atleta a1, Atleta a2, Atleta a3)
        {
            g.AddSpecialitàGara(Disciplina.STA);
            Console.Write("Creata disciplina STA\n");
            Console.Write("\n");

            g.AddSpecialitàGara(Disciplina.CAM);
            Console.Write("Creata disciplina CAM\n");
            Console.Write("\n");

            g.AddSocietà(s);
            Console.Write("Creata società1\n");
            g.printSocietà();
            Console.Write("\n");

            g.AddAtleta(a1);
            Console.Write("Creata a1\n");
            g.printAtleti();
            Console.Write("\n");

            g.AddAtleta(a2);
            Console.Write("Creata a2\n");
            g.printAtleti();
            Console.Write("\n");

            g.AddAtleta(a3);
            Console.Write("Creata a3\n");
            g.printAtleti();
            Console.Write("\n");
        }
Exemple #2
0
        private static void DemoAddAtleti(Gara g, Atleta a1, Atleta a2, Atleta a3, Atleta a4, Atleta a5, Atleta a6, Atleta a7, Atleta a8, Atleta a9, Atleta a10)
        {
            g.AddAtleta(a1);

            g.AddAtleta(a2);

            g.AddAtleta(a3);

            g.AddAtleta(a4);

            g.AddAtleta(a5);

            g.AddAtleta(a6);

            g.AddAtleta(a7);

            g.AddAtleta(a8);

            g.AddAtleta(a9);

            g.AddAtleta(a10);
        }
Exemple #3
0
        private void _addAtletaButton_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(_nomeTextBox.Text) || !String.IsNullOrEmpty(_cognomeTextBox.Text) || !String.IsNullOrEmpty(((Società)_societàComboBox.SelectedItem).ToString()) || !String.IsNullOrEmpty(_codiceFiscaleTextBox.Text))
            {
                Atleta  a;
                Società s = Gara.GetInstance().GetSocietàForNomeSede(((Società)_societàComboBox.SelectedItem).ToString()); //porcata!!!!

                if (_maschioRadioButton.Enabled)
                {
                    a = new Atleta(_nomeTextBox.Text, _cognomeTextBox.Text, _codiceFiscaleTextBox.Text, Sesso.MASCHIO, _dataNascitaTimePicker.Value, _istruttoreCheckBox.Checked, s, _scadenzaCertificatoTimePicker.Value, Guid.Empty);
                }
                else
                {
                    a = new Atleta(_nomeTextBox.Text, _cognomeTextBox.Text, _codiceFiscaleTextBox.Text, Sesso.FEMMINA, _dataNascitaTimePicker.Value, _istruttoreCheckBox.Checked, s, _scadenzaCertificatoTimePicker.Value, Guid.Empty);
                }

                if (a.IsEtàInferiore14())
                {
                    MessageBox.Show("L'atleta che si stà tentando di inserire ha meno di 14 anni, quindi l'operazione non può essere completata.", "Atleta con età inferiore a 14 anni", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else if (a.IsEtàInferiore18())
                {
                    MessageBox.Show("L'atleta che si stà tentando di inserire ha meno di 18 anni, richiedere autorizzazione di un tutore prima di completare l'inserimento.", "Atleta con età inferiore a 18 anni", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else
                {
                    Gara g = Gara.GetInstance();
                    g.AddAtleta(a);
                }
            }
            else
            {
                MessageBox.Show("Si stà tentando di Aggiungere un utente con dati incompleti, l'operazione non puo essere portata a termine.", "Utente incompleto", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            _nomeTextBox.Clear();
            _cognomeTextBox.Clear();
            _codiceFiscaleTextBox.Clear();
            _societàComboBox.SelectedIndex       = 0;
            _dataNascitaTimePicker.Value         = DateTime.Now;
            _scadenzaCertificatoTimePicker.Value = DateTime.Now;
            _maschioRadioButton.Select();
            _istruttoreCheckBox.Checked = false;
        }
Exemple #4
0
            public void LoadSocietàAtleti()
            {
                Gara g = Gara.GetInstance();

                XmlElement societàElement = (XmlElement)_xmlDocument.SelectSingleNode("SocietàAtleti/SocietàList");

                foreach (XmlNode societàNode in societàElement.ChildNodes)
                {
                    XmlAttributeCollection ac = societàNode.Attributes;
                    g.AddSocietà(new Società(societàNode.Attributes["p3:nomeSocietà"].Value, societàNode.Attributes["p3:sedeSocietà"].Value, new Guid(societàNode.Attributes["p3:idSocietà"].Value)));
                }

                XmlElement atletiElement = (XmlElement)_xmlDocument.SelectSingleNode("SocietàAtleti/AtletiList");

                foreach (XmlNode atletaNode in atletiElement.ChildNodes)
                {
                    Sesso sesso = Sesso.MASCHIO;
                    if (atletaNode.Attributes["p3:sesso"].Value.Equals("FEMMINA"))
                    {
                        sesso = Sesso.FEMMINA;
                    }

                    g.AddAtleta(new Atleta(
                                    atletaNode.Attributes["p3:nomeAtleta"].Value,
                                    atletaNode.Attributes["p3:cognomeAtleta"].Value,
                                    atletaNode.Attributes["p3:cfAtleta"].Value,
                                    sesso,
                                    Convert.ToDateTime(atletaNode.Attributes["p3:dataDiNascita"].Value),
                                    Convert.ToBoolean(atletaNode.Attributes["p3:istruttore"].Value),
                                    g.GetSocietàForID(new Guid(atletaNode.Attributes["p3:societàDiAppartenenza"].Value)),
                                    Convert.ToDateTime(atletaNode.Attributes["p3:scadenzaCertificato"].Value),
                                    new Guid(atletaNode.Attributes["p3:idAtleta"].Value
                                             )
                                    ));
                }
            }