public NoteViewModel(ProjectModel p, NotationModel n, CurrentUser curUser) { notebind = n; user = curUser; notebind.ID = n.ID; notebind.Project_ID = p.ID; notebind.Note = n.Note; notebind.Date = DateTime.Now; notebind.Author = user.User.ID; notebind.AuthorName = user.User.Name; }
private void addNote(object sender) { NotationModel newnote = new NotationModel(); Note n = new Note(Pr, newnote, user); if (n.ShowDialog() == true) { db.AddNotation(newnote); db.Save(); d.Notations = db.GetAllNotations(Pr.ID); } }
private void delNote(object sender) { if (sel_note != null) { NotationModel newnote = db.GetNotation(sel_note.ID); if (newnote.Author == user.User.ID) { db.DeleteNotation(newnote); db.Save(); d.Notations = db.GetAllNotations(Pr.ID); } else { MessageBox.Show("Вы не можете удалить чужую запись!"); } } }
private void editNote(object sender) { if (sel_note != null) { NotationModel newnote = db.GetNotation(sel_note.ID); if (newnote.Author == user.User.ID) { Note n = new Note(Pr, newnote, user); if (n.ShowDialog() == true) { db.UpdateNotation(newnote); db.Save(); d.Notations = db.GetAllNotations(Pr.ID); } } else { MessageBox.Show("Вы не можете редактировать чужую запись!"); } } }
public Note(ProjectModel p, NotationModel n, CurrentUser user) { InitializeComponent(); nvm = new NoteViewModel(p, n, user); DataContext = nvm; }