Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 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("Вы не можете удалить чужую запись!");
         }
     }
 }
Ejemplo n.º 4
0
 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("Вы не можете редактировать чужую запись!");
         }
     }
 }
Ejemplo n.º 5
0
 public Note(ProjectModel p, NotationModel n, CurrentUser user)
 {
     InitializeComponent();
     nvm         = new NoteViewModel(p, n, user);
     DataContext = nvm;
 }