Exemplo n.º 1
0
        public void SetCatalogueEntry(CatalogueEntry e)
        {
            if (RootElement == null)
            {
                RootElement = OpenedDocument.CreateElement("Catalogue");
            }

            if (e.ID > HighestID)
            {
                HighestID = e.ID;
            }

            if (RootElement.ChildNodes.Count > 0)
            {
                XmlNodeList Elements = RootElement.ChildNodes;
                foreach (XmlNode n in Elements)
                {
                    if (GetIDAttribute(n).Equals(e.ID.ToString()))
                    {
                        XmlElement t = (XmlElement)n;
                        t.InnerText = e.Title;
                        t.SetAttribute("Works", e.Works.ToString());
                        t.SetAttribute("PageNo", e.PageNo.ToString());

                        return;
                    }
                }
            }

            RootElement.AppendChild(OpenedDocument.ImportNode(e.ToXml().ChildNodes[0], true));
        }
Exemplo n.º 2
0
        public void DeleteCatalogueEntry(CatalogueEntry e)
        {
            XmlNodeList Elements = RootElement.ChildNodes;

            foreach (XmlNode n in Elements)
            {
                if (GetIDAttribute(n).Equals(e.ID.ToString()))
                {
                    RootElement.RemoveChild(n);
                    return;
                }
            }
        }