/// <summary> /// The user has selected to delete a journal item. /// If CONFIRM_JOURNAL_DELETION is set to true, the Journal Dialog will be opened to confirm the deletion. /// If not, the journal will be deleted. /// When the dialog is closed, CONFIRM_JOURNAL_DELETION value (from the dialog) is checked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeleteJournalButton_Click(object sender, RoutedEventArgs e) { JournalEntry je = (JournalEntry)JournalEntryList.SelectedItem; // Check to see if journal entry deletion should be confirmed. if (_model.GetAppPreferenceValue(PreferenceName.CONFIRM_JOURNAL_DELETION) == "1") { var journalDialog = new JournalDialog(_model.SelectedWorkItem, je, DataEntryMode.DELETE); journalDialog.Owner = this; journalDialog.ShowDialog(); if (journalDialog.WasDialogSubmitted) { if ((journalDialog.DontConfirmFutureDeletes.HasValue) && (journalDialog.DontConfirmFutureDeletes.Value)) { _model.FireUpdateAppPreference(PreferenceName.CONFIRM_JOURNAL_DELETION, "0"); } _model.FireDeleteJournalEntry(_model.SelectedWorkItem, je); } } else { _model.FireDeleteJournalEntry(_model.SelectedWorkItem, je); } }
/// <summary> /// Open the Journal Dialog in readiness to add a record. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddJournalButton_Click(object sender, RoutedEventArgs e) { var jeDialog = new JournalDialog(_model.SelectedWorkItem, new JournalEntry(), DataEntryMode.ADD); jeDialog.Owner = this; jeDialog.ShowDialog(); if (jeDialog.WasDialogSubmitted) { JournalEntry je = jeDialog.JournalEntry; _model.FireAddJournalEntry(_model.SelectedWorkItem, je); } }
/// <summary> /// Open the Journal Dialog in readiness to edit a record. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditJournalButton_Click(object sender, RoutedEventArgs e) { JournalEntry oldJE = (JournalEntry)JournalEntryList.SelectedItem; var journalDialog = new JournalDialog(_model.SelectedWorkItem, oldJE, DataEntryMode.EDIT); journalDialog.Owner = this; journalDialog.ShowDialog(); if (journalDialog.WasDialogSubmitted) { JournalEntry newJournalEntry = journalDialog.JournalEntry; newJournalEntry.ModificationDateTime = DateTime.Now; _model.FireEditJournalEntry(_model.SelectedWorkItem, oldJE, newJournalEntry); } }