Esempio n. 1
0
 /// <summary>
 /// Recursively builds a metadata tree from the contents of an array of metadata.
 /// </summary>
 /// <param name="metalist">The array of metadata to convert to a tree.</param>
 /// <param name="ParentID">The numberic ID of the parent node (0 if building from the root is desired).</param>
 /// <returns>The metadata in tree form in a <see cref="Granicus.MediaManager.SDK.MetaDataDataCollection"/>.</returns>
 private MetaDataDataCollection m_BuildMetaBranch(MetaDataDataCollection metalist, int ParentID)
 {
     MetaDataDataCollection tree = new MetaDataDataCollection();
     foreach (MetaDataData meta in metalist)
     {
         if (meta.ParentID == ParentID)
         {
             meta.Children = m_BuildMetaBranch(metalist, meta.ID);
             tree.Add(meta);
         }
     }
     return tree;
 }
Esempio n. 2
0
        private MetaDataDataCollection ParseDocumentItems(XmlNode documentItemsNode)
        {
            MetaDataDataCollection metaCollection = new MetaDataDataCollection();

            foreach (XmlNode documentItemNode in documentItemsNode.ChildNodes)
            {
                // process basic MetaDataData properties
                MetaDataData meta = new MetaDataData();
                meta.Name = documentItemNode.SelectSingleNode("Name").InnerText;
                meta.ForeignID = Int32.Parse(documentItemNode.SelectSingleNode("ForeignID").InnerText);
                meta.Consent = Int32.Parse(documentItemNode.SelectSingleNode("Consent").InnerText);

                // process payload
                switch (documentItemNode.Name)
                {
                    case "AgendaItem":
                        AgendaItem agendaItem = new AgendaItem();
                        agendaItem.Actions = documentItemNode.SelectSingleNode("Actions").InnerText;
                        agendaItem.Department = documentItemNode.SelectSingleNode("Department").InnerText;
                        meta.Payload = agendaItem;
                        break;
                    case "Note":
                        Note note = new Note();
                        note.NoteText = documentItemNode.SelectSingleNode("NoteText").InnerText;
                        note.EditorsNotes = documentItemNode.SelectSingleNode("EditorsNotes").InnerText;
                        note.Private = bool.Parse(documentItemNode.SelectSingleNode("Private").InnerText);
                        meta.Payload = note;
                        break;
                    case "Document":
                        Document doc = new Document();
                        doc.Description = documentItemNode.SelectSingleNode("Description").InnerText;
                        doc.Location = documentItemNode.SelectSingleNode("Location").InnerText;
                        meta.Payload = doc;
                        break;
                    default:
                        // this isn't payload type we are interested in loading, just skip it
                        continue;
                }
                // recursively process any child nodes
                meta.Children = ParseDocumentItems(documentItemNode.SelectSingleNode("Children"));

                metaCollection.Add(meta);
            }
            return metaCollection;
        }