public void EndEdit()
 {
     if (_changeCoordinator != null) {
         if (_changeCoordinator.EditableItem.IsDirty) {
             LedgerTransactionSavingEventArgs e = new LedgerTransactionSavingEventArgs(this);
             e.Cancel = false;
             OnSaving(e);
             if (e.Cancel == false) {
                 _changeCoordinator.EditableItem.PropertyChanged -= new PropertyChangedEventHandler(WrappedTransaction_PropertyChanged);
                 _changeCoordinator.PushChanges();
                 _changeCoordinator = null;
             } else {
                 CancelEdit();
                 return;
             }
         }
         _changeCoordinator = null;
     }
 }
 private void OnSaving(LedgerTransactionSavingEventArgs e)
 {
     if (this.Saving != null) {
         this.Saving(this, e);
     }
 }
 /// <summary>
 /// Called when a LedgerTransaction is saved.
 /// </summary>
 private void DataSource_LedgerTransactionSaving(object sender, LedgerTransactionSavingEventArgs e)
 {
     if (!this.Account.Workbook.CurrentPeriod.IncludesDate(e.LedgerTransaction.Date)) {
         MessageBoxResult mbr = MessageBox.Show("The date for this transaction lies outside of the current accounting period. If you proceed, the transaction will not be visible on this ledger. \r\n\r\nAre you sure you wish to proceed?",
             "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
         if (mbr == MessageBoxResult.Cancel) {
             e.Cancel = true;
         }
     }
 }