/// <summary> /// Closes the current transaction and connection. If not committed, the transaction is rolled back. /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (m_Disposed) { return; } if (disposing) { m_Transaction.Dispose(); m_Connection.Dispose(); AdditionalDispose(); m_Disposed = true; } }
/// <summary> /// Obtinem o conexiune deschisa cu o tranzactie /// </summary> /// <param name="transac"></param> /// <param name="DoCommit"></param> public static void CloseTransactionOnConnection(System.Data.SqlClient.SqlTransaction transac, bool DoCommit) { System.Data.SqlClient.SqlConnection cn = transac.Connection; if (cn != null) { if (DoCommit) { transac.Commit(); } else { transac.Rollback(); } transac.Dispose(); cn.Close(); cn.Dispose(); } }