コード例 #1
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
                                             )
                                    ));
                }
            }