public virtual void AddRange(NotesList addedRange) { if (addedRange.notes.Count > 0) { foreach (var kvp in addedRange.notes) { if (notes.ContainsKey(kvp.Key)) SolveIdConflictWhenAddNewNote(kvp.Value); else notes.Add(kvp.Key, kvp.Value); } SaveNotes(); } }
public void RemoveNotesFromUser(string userName, NotesList removeNotes) { var oldNotes = GetUserNotes(userName); oldNotes.RemoveRange(removeNotes); }
public void ModifyNotesToUser(string userName, NotesList modifiedNotes) { var oldNotes = GetUserNotes(userName); oldNotes.ModifyRange(modifiedNotes); }
public void AddNotesToUser(string userName, NotesList AddedNotes) { var oldNotes = GetUserNotes(userName); oldNotes.AddRange(AddedNotes); }
public void OnRemoveNotes(NotesList notes) { var res = RemoveRange(notes); if (res && NotesDeleted!= null) NotesDeleted(notes.GetNotes()); }
public void OnModifyNotes(NotesList notes) { var res = ModifyRange(notes); if (res && NotesModified != null) NotesModified(notes.GetNotes()); }
public void OnAddNotes(NotesList notes) { AddRange(notes); if (NotesAdded != null) NotesAdded(notes.GetNotes()); }
public virtual bool RemoveRange(NotesList removedRange) { bool res = false; if (removedRange.notes.Count > 0) { var confirmed = new List<uint>(); foreach (var n in removedRange.notes) { if (notes.Remove(n.Key)) confirmed.Add(n.Key); } res = confirmed.Count > 0; foreach (var c in confirmed) notes.Remove(c); if (res) SaveNotes(); } return res; }
public virtual bool ModifyRange(NotesList modifiedRange) { bool res = false; if (modifiedRange.notes.Count > 0) { var confirmed = new List<uint>(); foreach (var n in modifiedRange.notes) { if (notes.ContainsKey(n.Key)) { notes[n.Key] = n.Value; confirmed.Add(n.Key); } } res = confirmed.Count > 0; if (res) SaveNotes(); } return res; }
public static bool SyncNotes(NotesList notes, NotesSyncType syncType) { return SendMessage(new CToSNotesRequest() { notes = notes, syncType = syncType }); }