Example #1
0
        public void FillNameDayList()
        {
            var xml = new XmlDocument();

            xml.Load(@"nevnapok.xml");                              // one nevnap is an item and has 3 nodes
            foreach (XmlElement item in xml.DocumentElement)        // honap- nap- nev with inner text as their value
            {
                var nd         = new NameDay();
                var honapChild = (XmlElement)item.ChildNodes[0];
                nd.Honap = int.Parse(honapChild.InnerText);
                var napChild = (XmlElement)item.ChildNodes[1];
                nd.Nap = int.Parse(napChild.InnerText);
                var nevChild = (XmlElement)item.ChildNodes[2];
                nd.Nev = nevChild.InnerText;

                NameDays.Add(nd);
            }
        }
Example #2
0
        public static List <Occasion> getAllOccasions()
        {
            var listOfOccasions = new List <Occasion>();

            var maciek          = new Person("Maciek", "Kowalski");
            var macieksBirthday = new Birthday(maciek, DateTime.Parse("06-06-2019"));

            var macieksNamesday = new NameDay(maciek, DateTime.Parse("08-08-2019"));

            var zosia          = new Person("Zosia", "Walen");
            var zosiasBirthday = new Birthday(zosia, DateTime.Parse("07-07-2019"));

            listOfOccasions.Add(macieksBirthday);
            listOfOccasions.Add(macieksNamesday);
            listOfOccasions.Add(zosiasBirthday);

            return(listOfOccasions);
        }