public void ConfirmNewNoteTitle(string newNoteTitle) { NewNoteClicked = false; string cd = Environment.CurrentDirectory; string filePath = cd + $@"\data\{User.Id}" + $@"\{SelectedNotebook.Id}" + $@"\{newNoteTitle}.rtf"; NoteModel note = Notes.ToList <NoteModel>().Find(n => n.Title == newNoteTitle); if (note == null) { try { DBDataAccessInsert.InsertNote(new NoteModel() { NotebookId = SelectedNotebook.Id, Title = newNoteTitle, CreatedTime = DateTime.Now, UpdatedTime = DateTime.Now, FileLocation = filePath }); Notes.Clear(); Notes = new BindableCollection <NoteModel>(DBDataAccessLoad.LoadNotebookNotes(SelectedNotebook.Id)); } catch (SQLiteException) { MessageBox.Show("Invalid Title"); } } else { MessageBox.Show("Note with this title already exists"); } }
public void ConfirmNewNotebookName(string newNotebookName) { NewNotebookClicked = false; NotebookModel notebook = Notebooks.ToList <NotebookModel>().Find(n => n.Name == newNotebookName); if (notebook == null) { try { DBDataAccessInsert.InsertNotebook(new NotebookModel() { UserId = User.Id, Name = newNotebookName }); Notebooks.Clear(); Notebooks = new BindableCollection <NotebookModel>(DBDataAccessLoad.LoadNotebooks(User.Id)); } catch (SQLiteException) { MessageBox.Show("Invalid Name"); } } else { MessageBox.Show("Notebook with this name already exists"); } }
public void Register() { try { DBDataAccessInsert.InsertUser(new UserModel() { Username = RegUsername, Password = RegPassword, Email = RegEmail, Name = RegName, Lastname = RegLastName }); MessageBox.Show("Registration Successful"); SignIn(); } catch (SQLiteException) { MessageBox.Show("Email or Username is already registered"); } }