Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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()));
 }
Exemplo n.º 5
0
        public static void UpdateNoteFields(NoteItem old, NoteItem note)
        {
            DB.Table("notes_fields")
                .Where(new Parameter("note_id", old.ID.ToString()))
                .Delete();

            InsertNoteFields(note);
        }
Exemplo n.º 6
0
 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 });
     }
 }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
 public NoteItem(NoteItem other)
 {
     CopyNote(other);
 }