Esempio n. 1
0
            void EvalTransactionState()
            {
                var objectsToSave = TransactionalChangeHandler.ObjectsToSave(unitOfWork);

                saveChangesItem.Enabled        =
                    discardChangesItem.Enabled = objectsToSave;
            }
Esempio n. 2
0
 private void discardChangesItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (TransactionalChangeHandler.ObjectsToSave(unitOfWork))
     {
         if (XtraMessageBox.Show("This operation is going to discard all unsaved changes. Are you sure you want to proceed?", "Question",
                                 MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             //scheduler.BeginUpdate();
             try {
                 // Use my own DiscardChanges
                 DiscardChanges(unitOfWork, null);
             }
             finally {
                 //scheduler.EndUpdate();
             }
         }
     }
 }
Esempio n. 3
0
 public void DocumentClosingHandler(object sender, DocumentCancelEventArgs e)
 {
     if (TransactionalChangeHandler.ObjectsToSave(unitOfWork))
     {
         var answer = XtraMessageBox.Show("There are unsaved changes. Do you want to validate and save before closing the list?", "Question",
                                          MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
         if (answer == DialogResult.Yes)
         {
             if (!TransactionalChangeHandler.ValidateAndCommit(unitOfWork))
             {
                 e.Cancel = true;
             }
         }
         else if (answer == DialogResult.Cancel)
         {
             e.Cancel = true;
         }
     }
 }