Hi,I have code to update some tables (not visible on screen) upon Form.AfterSave() event fired using transaction as shown below.
1. Is it the "right way"?
2. I want show broken rules if failed. How should I show them? Any advice?
public SaveUndoResult SaveToTransfer()
{
SaveUndoResult loReturn = SaveUndoResult.Success;
try
{
//PushDataToTransfer();
BusinessLayer.TransactionBegin("", IsolationLevel.ReadCommitted);
if (loReturn == SaveUndoResult.Success)
{
loReturn = _TransfersBO.Save(true);
}
if (loReturn == SaveUndoResult.Success)
{
_TransferDetailsBO.Save(true);
}
if (loReturn == SaveUndoResult.Success)
{
_PInvoiceTransferBO.Save(true);
}
}
catch (DataLayerSavingException ex)
{
throw ex;
}
catch (Exception ex)
{
throw new BusinessLayerException("An error occurred while saving the data to the server.", ex);
}
finally
{
if (loReturn == SaveUndoResult.Success)
{
BusinessLayer.TransactionCommit("");
}
else
{
BusinessLayer.TransactionRollback("");
}
}
return loReturn;}