Example #1
0
        public void lecureXMLCuisto()
        {
            XmlDocument doc = new XmlDocument();
            doc.Load("restaurant.xml");
           
            //Cuisiniers
            XmlNodeList itemNodes = doc.SelectNodes("//Restaurant/Cuisiniers/Cuisinier");
            List<int> _noCuisto = new List<int>();
            foreach (XmlNode itemNode in itemNodes)
            {
                XmlNode noCuisto = itemNode.SelectSingleNode("noCuisto");
                if ((noCuisto != null))
                {
                    int nc = int.Parse(noCuisto.InnerText);
                    _noCuisto.Add(nc);
                }
            }
            XmlNodeList occupationsNodes = doc.SelectNodes("//Restaurant/Cuisiniers/Cuisinier/occupations");
            List<DateTime> _dateDebutOccupee = new List<DateTime>();
            List<DateTime> _dateFinOccupee = new List<DateTime>();
            foreach (XmlNode occNode in occupationsNodes)
            {
                XmlNode dateDebutOccupee = occNode.SelectSingleNode("dateDebutOccupee");
                XmlNode dateFinOccupee = occNode.SelectSingleNode("dateFinOccupee");

                if (dateDebutOccupee != null)
                {
                    DateTime datedebut = Convert.ToDateTime(dateDebutOccupee.InnerText);
                    _dateDebutOccupee.Add(datedebut);
                    DateTime datefin = Convert.ToDateTime(dateFinOccupee.InnerText);
                    _dateFinOccupee.Add(datefin);
                }
            }

            //CREATION DES CUISINIERS
            for (int i = 0; i < _noCuisto.Count(); i++)
            {
                Cuisinier cuisto = new Cuisinier(_noCuisto[i]);
                if (i<_dateDebutOccupee.Count)
                {
                     DateTime hdebut = new DateTime();
                    hdebut = _dateDebutOccupee[i];
                    DateTime hfin = new DateTime();
                    hfin = _dateFinOccupee[i];
                    Occupation occ = new Occupation(hdebut, hfin);
                    cuisto.PlanningCuisto.Add(occ);
                }
                this.brigade.Add(cuisto);
            }
        }
Example #2
0
        public void lecureXMLCuisto()
        {
            XmlDocument doc = new XmlDocument();
            doc.Load("restaurant.xml");

            //Cuisiniers
            XmlNodeList itemNodes = doc.SelectNodes("//Restaurant/Cuisiniers/Cuisinier");
            List<int> _noCuisto = new List<int>();
            foreach (XmlNode itemNode in itemNodes)
            {
                XmlNode noCuisto = itemNode.SelectSingleNode("noCuisto");
                if ((noCuisto != null))
                {
                    int nc = int.Parse(noCuisto.InnerText);
                    _noCuisto.Add(nc);
                }
            }
            XmlNodeList occupationsNodes = doc.SelectNodes("//Restaurant/Cuisiniers/Cuisinier/occupations");
            List<DateTime> _dateDebutOccupee = new List<DateTime>();
            List<DateTime> _dateFinOccupee = new List<DateTime>();
            foreach (XmlNode occNode in occupationsNodes)
            {
                XmlNode dateDebutOccupee = occNode.SelectSingleNode("dateDebutOccupee");
                XmlNode dateFinOccupee = occNode.SelectSingleNode("dateFinOccupee");

                if (dateDebutOccupee != null)
                {
                    DateTime datedebut = Convert.ToDateTime(dateDebutOccupee.InnerText);
                    _dateDebutOccupee.Add(datedebut);
                    DateTime datefin = Convert.ToDateTime(dateFinOccupee.InnerText);
                    _dateFinOccupee.Add(datefin);
                }
            }

            //CREATION DES CUISINIERS
            for (int i = 0; i < _noCuisto.Count(); i++)
            {
                Cuisinier cuisto = new Cuisinier(_noCuisto[i]);
                if (i<_dateDebutOccupee.Count)
                {
                     DateTime hdebut = new DateTime();
                    hdebut = _dateDebutOccupee[i];
                    DateTime hfin = new DateTime();
                    hfin = _dateFinOccupee[i];
                    Occupation occ = new Occupation(hdebut, hfin);
                    cuisto.PlanningCuisto.Add(occ);
                }
                this.brigade.Add(cuisto);
            }
        }