Example #1
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textNote.Text == "")
     {
         MsgBox.Show(this, "Please enter a note, or delete this entry.");
         return;
     }
     try {
         TaskNoteCur.DateTimeNote = DateTime.Parse(textDateTime.Text);
     }
     catch {
         MsgBox.Show(this, "Please fix date.");
         return;
     }
     TaskNoteCur.Note = textNote.Text;
     if (TaskNoteCur.IsNew)
     {
         TaskNotes.Insert(TaskNoteCur);
     }
     else
     {
         TaskNotes.Update(TaskNoteCur);
     }
     DialogResult = DialogResult.OK;
 }
Example #2
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textNote.Text == "")
     {
         MsgBox.Show(this, "Please enter a note, or delete this entry.");
         return;
     }
     try {
         TaskNoteCur.DateTimeNote = DateTime.Parse(textDateTime.Text);
     }
     catch {
         MsgBox.Show(this, "Please fix date.");
         return;
     }
     TaskNoteCur.Note = textNote.Text;
     if (TaskNoteCur.IsNew)
     {
         TaskNotes.Insert(TaskNoteCur);
     }
     else
     {
         TaskNotes.Update(TaskNoteCur);
     }
     DialogResult = DialogResult.OK;
     OnEditComplete();
     Close();            //Needed because the window is called as a non-modal window.
 }
Example #3
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textNote.Text == "")
            {
                MsgBox.Show(this, "Please enter a note, or delete this entry.");
                return;
            }
            if (Tasks.IsTaskDeleted(TaskNoteCur.TaskNum))               //If this is for a new task we do have a valid TaskNum because of pre-insert
            {
                MsgBox.Show(this, "The task for this note was deleted.");
                return;                //Don't allow user to create orphaned notes, or try to edit a tasknote that was probably deleted too.
            }
            //We need the old datetime to check if the user made any changes.  We overrite TaskNoteCur's date time below so need to get it here.
            DateTime dateTimeNoteOld = TaskNoteCur.DateTimeNote;

            try {
                TaskNoteCur.DateTimeNote = DateTime.Parse(textDateTime.Text);
            }
            catch {
                MsgBox.Show(this, "Please fix date.");
                return;
            }
            if (TaskNoteCur.IsNew)
            {
                TaskNoteCur.Note = textNote.Text;
                TaskNotes.Insert(TaskNoteCur);
                Tasks.TaskEditCreateLog(Permissions.TaskNoteEdit, Lan.g(this, "Added task note"), Tasks.GetOne(TaskNoteCur.TaskNum));
                DialogResult = DialogResult.OK;
                OnEditComplete();
            }
            else if (TaskNoteCur.Note != textNote.Text || dateTimeNoteOld != TaskNoteCur.DateTimeNote)
            {
                TaskNoteCur.Note = textNote.Text;
                TaskNotes.Update(TaskNoteCur);
                Tasks.TaskEditCreateLog(Permissions.TaskNoteEdit, Lan.g(this, "Task note changed"), Tasks.GetOne(TaskNoteCur.TaskNum));
                DialogResult = DialogResult.OK;
                OnEditComplete();
            }
            else
            {
                //Intentionally blank, user opened an existing task note and did not change the note but clicked OK.
                //This is effectively equivilent to a Cancel click
                DialogResult = DialogResult.Cancel;
            }
            Close();            //Needed because the window is called as a non-modal window.
        }
Example #4
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textNote.Text == "")
            {
                MsgBox.Show(this, "Please enter a note, or delete this entry.");
                return;
            }
            //We need the old datetime to check if the user made any changes.  We overrite TaskNoteCur's date time below so need to get it here.
            DateTime dateTimeNoteOld = TaskNoteCur.DateTimeNote;

            try {
                TaskNoteCur.DateTimeNote = DateTime.Parse(textDateTime.Text);
            }
            catch {
                MsgBox.Show(this, "Please fix date.");
                return;
            }
            if (TaskNoteCur.IsNew)
            {
                TaskNoteCur.Note = textNote.Text;
                TaskNotes.Insert(TaskNoteCur);
                Tasks.TaskEditCreateLog(Permissions.TaskNoteEdit, Lan.g(this, "Added task note"), Tasks.GetOne(TaskNoteCur.TaskNum));
                //This refreshes "new" status for the task as appropriate.
                DataValid.SetInvalidTask(TaskNoteCur.TaskNum, true);               //popup
                DialogResult = DialogResult.OK;
                OnEditComplete();
            }
            else if (TaskNoteCur.Note != textNote.Text || dateTimeNoteOld != TaskNoteCur.DateTimeNote)
            {
                //This refreshes "new" status for the task as appropriate.
                DataValid.SetInvalidTask(TaskNoteCur.TaskNum, true);               //popup
                TaskNoteCur.Note = textNote.Text;
                TaskNotes.Update(TaskNoteCur);
                Tasks.TaskEditCreateLog(Permissions.TaskNoteEdit, Lan.g(this, "Task note changed"), Tasks.GetOne(TaskNoteCur.TaskNum));
                DialogResult = DialogResult.OK;
                OnEditComplete();
            }
            else
            {
                //Intentionally blank, user opened an existing task note and did not change the note but clicked OK.
                //This is effectively equivilent to a Cancel click
                DialogResult = DialogResult.Cancel;
            }
            Close();            //Needed because the window is called as a non-modal window.
        }