Ejemplo n.º 1
0
 private void saveTask()
 {
     if (note != null)
     {
         updateTask();
     }
     else
     {
         Document document = new Document();
         document.setOwner(user.getUsername());
         document.setDocument(txtNote.Text);
         DocumentDTOImplementation.getInstance().save(document);
         Note noteTemp = new Note();
         noteTemp.setAuthor(user.getFullName());
         noteTemp.setDocumentId(document.getId());
         noteTemp.setLastModified(DateTime.Now);
         noteTemp.setTitle(txtTitle.Text);
         NoteDTOImplementation.getInstance().save(noteTemp);
         TaskNote task = new TaskNote();
         task.status   = (Status)Enum.Parse(typeof(Status), statusComboBox.SelectedItem.ToString());
         task.priority = (Priority)Enum.Parse(typeof(Priority), priorityComboBox.SelectedItem.ToString());
         task.noteId   = noteTemp.getId();
         task.dueDate  = dueDatePicker.Value;
         TaskDTOImplementation.getInstance().save(task);
         if (notebook != null)
         {
             notebook.addNote(noteTemp.getId());
             NotebookDTOImplementation.getInstance().update(notebook, DatabaseConstants.COLUMN_NOTESID);
         }
     }
     MessageBox.Show("Task and Note were added succesfully", "Task Added Successfully");
 }
Ejemplo n.º 2
0
        private void updateTask()
        {
            Document document = DocumentDTOImplementation.getInstance().getById(note.getDocumentId());

            document.setDocument(txtNote.Text);
            DocumentDTOImplementation.getInstance().update(document, DatabaseConstants.COLUMN_DOCUMENT);
            Note noteTemp = new Note();

            noteTemp.setDocumentId(document.getId());
            noteTemp.setLastModified(DateTime.Now);
            noteTemp.setTitle(txtTitle.Text);
            NoteDTOImplementation.getInstance().update(noteTemp, DatabaseConstants.COLUMN_LASTMODIFIED, DatabaseConstants.COLUMN_TITLE);
            TaskNote task = new TaskNote {
                status   = (Status)Enum.Parse(typeof(Status), statusComboBox.SelectedItem.ToString()),
                priority = (Priority)Enum.Parse(typeof(Priority), priorityComboBox.SelectedItem.ToString()),
                dueDate  = dueDatePicker.Value
            };

            TaskDTOImplementation.getInstance().update(task, DatabaseConstants.COLUMN_STATUS, DatabaseConstants.COLUMN_PRIORITY, DatabaseConstants.COLUMN_DUEDATE);
        }