public static void AddNote(NoteItem note) { DB.Table("notes").Insert(Config.NOTES_TABLE_COLUMNS, new String[] { Cryptography.XOR(note.Name.Trim()), note.CategoryID.ToString(), "0" }); note.SetID((int)DB.LastID()); InsertNoteFields(note); }
public NoteWindow(List<CategoryItem> categories, String category) { Note = new NoteItem(); Startup("Add note", categories); CategoriesDropDown.SelectedItem = category; OkButton.IsEnabled = false; OkButton.Click += new RoutedEventHandler(AddNote); }
public NoteWindow(List<CategoryItem> categories, NoteItem note) { Old = note; Note = new NoteItem(Old); Startup("Edit note", categories); NoteTextBox.Text = Old.Name; CategoriesDropDown.SelectedItem = Old.Category; OkButton.Click += new RoutedEventHandler(EditNote); }
public static void UpdateNoteHeader(NoteItem old, NoteItem note) { DB.Table("notes") .Where(new Parameter("name", Cryptography.XOR(old.Name))) .AndWhere(new Parameter("category_id", old.CategoryID.ToString())) .Update(new Parameter("name", Cryptography.XOR(note.Name.Trim())), new Parameter("category_id", note.CategoryID.ToString())); }
public static void UpdateNoteFields(NoteItem old, NoteItem note) { DB.Table("notes_fields") .Where(new Parameter("note_id", old.ID.ToString())) .Delete(); InsertNoteFields(note); }
public static void InsertNoteFields(NoteItem note) { foreach (NoteField field in note.Fields) { DB.Table("notes_fields") .Insert(Config.NOTES_FIELDS_TABLE_COLUMNS, new String[] { note.ID.ToString(), Cryptography.XOR(field.Key.Trim()), Cryptography.XOR(field.Value.Trim()), field.Password }); } }
public static void DeleteNote(NoteItem note) { DB.Table("notes") .Where(new Parameter("name", Cryptography.XOR(note.Name))) .AndWhere(new Parameter("category_id", note.CategoryID.ToString())) .Delete(); DB.Table("notes_fields") .Where(new Parameter("note_id", note.ID.ToString())) .Delete(); }
public void CopyNote(NoteItem other) { ID = other.ID; Name = other.Name; CategoryID = other.CategoryID; Category = other.Category; IsFavorite = other.IsFavorite; Fields = new List<NoteField>(other.Fields); }
public NoteItem(NoteItem other) { CopyNote(other); }