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; } } }
public void SaveChangesItemClickHandler(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TransactionalChangeHandler.ValidateAndCommit(unitOfWork); }