public void CopyNoteByContent(string outerXmlForNote, string destinationNoteId) { if (m_catNoteConfiguration.IsDocumentReadOnly == false) { ContentDetailCollection childNotes = GetChildNotes(destinationNoteId); string idOfNewNode = childNotes.AddXmlDirect(outerXmlForNote); ResetNoteIDs(idOfNewNode, true, false); } else { throw new ReadOnlyDocumentException("Can not move notes because this document is read only"); } m_catNoteConfiguration.SetIsDirty(true); }
/// <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 } } } }
public ContentDetail CreateNoteInRoot(string noteTitle) { ContentDetailCollection rootChilds = GetChildNotes(Configuration.RootNoteId, false); return(rootChilds.Add(noteTitle)); }