/// <summary> /// /// </summary> /// <param name="outerXmlForNote"></param> /// <returns>GUID of new node created</returns> protected internal string AddXmlDirect(string outerXmlForNote) { XmlDocumentFragment newNoteXmlFragment = m_NotepadXDocumentParentXmlNode.OwnerDocument.CreateDocumentFragment(); newNoteXmlFragment.InnerXml = outerXmlForNote; ContentDetail newNote = new ContentDetail(newNoteXmlFragment.FirstChild, m_catNoteConfiguration); string newId = Guid.NewGuid().ToString(); newNote.SetId(newId); newNoteXmlFragment.InnerXml = newNote.Xml; m_NotepadXDocumentParentXmlNode.AppendChild(newNoteXmlFragment); return(newId); }
/// <summary> /// Reset this note's ID to new GUID and change all of child's IDs recursively /// </summary> /// <param name="noteToChange">Parent note whoes ID will be changed</param> public void ResetNoteIDs(string noteId, bool isRecurseChilds, bool isChangeParent) { ContentDetail noteToChange = GetNoteById(noteId); if (isChangeParent == true) { string newId = Guid.NewGuid().ToString(); noteToChange.SetId(newId); //This should be done before so we can find it uniquely } if (isRecurseChilds == true) { ContentDetailCollection childNotes = GetChildNotes(noteToChange.Id); if (childNotes != null) { foreach (DictionaryEntry childNoteDictionaryEntry in childNotes) { ContentDetail childCatNote = ((ContentDetail)childNoteDictionaryEntry.Value); ResetNoteIDs(childCatNote.Id, true, true); //Recurse } } } }