public static void MarkReceiptsPrinted(int ALedgerNumber, DataTable AGiftTbl) { TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.Serializable); AGiftTable Tbl = new AGiftTable(); foreach (DataRow Row in AGiftTbl.Rows) { Tbl.Merge(AGiftAccess.LoadByPrimaryKey( ALedgerNumber, Convert.ToInt32(Row["BatchNumber"]), Convert.ToInt32(Row["TransactionNumber"]), Transaction)); } foreach (AGiftRow Row in Tbl.Rows) { Row.ReceiptPrinted = true; } try { AGiftAccess.SubmitChanges(Tbl, Transaction); DBAccess.GDBAccessObj.CommitTransaction(); } catch (Exception Exc) { TLogging.Log("An Exception occured while marking Receipts as printed:" + Environment.NewLine + Exc.ToString()); DBAccess.GDBAccessObj.RollbackTransaction(); throw; } }
public static void MarkReceiptsPrinted(int ALedgerNumber, DataTable AGiftTbl) { AGiftTable Tbl = new AGiftTable(); TDBTransaction Transaction = null; bool SubmissionOK = false; DBAccess.GDBAccessObj.BeginAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { try { foreach (DataRow Row in AGiftTbl.Rows) { Tbl.Merge(AGiftAccess.LoadByPrimaryKey( ALedgerNumber, Convert.ToInt32(Row["BatchNumber"]), Convert.ToInt32(Row["TransactionNumber"]), Transaction)); } foreach (AGiftRow Row in Tbl.Rows) { Row.ReceiptPrinted = true; } AGiftAccess.SubmitChanges(Tbl, Transaction); SubmissionOK = true; } catch (Exception e) { TLogging.Log("Error in MarkReceiptsPrinted: " + e.Message); throw e; } }); }