Exemple #1
0
        private static void SaveFile()
        {
            var document = new XDocument(new XElement("ProDiscounts"));

            foreach (var proDiscount in ProDiscounts)
            {
                document.GetXElement("ProDiscounts").Add(ProDiscount.ToXElement(proDiscount));
            }

            document.Save(Path);
        }
Exemple #2
0
        private static void LoadFile()
        {
            if (File.Exists(Path))
            {
                var document = XDocument.Load(Path);

                ProDiscounts.Clear();
                foreach (var element in document.GetXElements("ProDiscounts", "rec"))
                {
                    ProDiscounts.Add(ProDiscount.FromXElement(element));
                }
            }
        }