Exemplo n.º 1
0
        private static void SaveFile()
        {
            var elements = new XElement("Palettes");

            _document = new XDocument(elements);

            foreach (var group in GroupProducts)
            {
                elements.Add(GroupProduct.ToXElement(group));
            }

            _document.Save(Path);
        }
Exemplo n.º 2
0
        public static void Add(GroupProduct group)
        {
            if (!File.Exists(Path))
            {
                SaveFile();
            }

            var document = XDocument.Load(Path);

            document.GetXElement("Palettes").Add(GroupProduct.ToXElement(group));
            File.WriteAllText(Path, document.ToString());

            GroupProducts.Add(group);

            if (SyncData.IsConnect)
            {
                using (var connection = ConnectionFactory.CreateConnection())
                    connection.Execute(InsertQuery, group);
            }
        }