public static GLSetupTDS LoadAAnalysisAttributes(Int32 ALedgerNumber, Boolean AActiveOnly = false) { GLSetupTDS CacheDS = new GLSetupTDS(); bool NewTransaction; TDBTransaction Transaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted, out NewTransaction); AAnalysisTypeAccess.LoadAll(CacheDS, Transaction); if (!AActiveOnly) { AFreeformAnalysisAccess.LoadViaALedger(CacheDS, ALedgerNumber, Transaction); AAnalysisAttributeAccess.LoadViaALedger(CacheDS, ALedgerNumber, Transaction); } else { AFreeformAnalysisTable FFTable = new AFreeformAnalysisTable(); AFreeformAnalysisRow TemplateFFRow = FFTable.NewRowTyped(false); TemplateFFRow.LedgerNumber = ALedgerNumber; TemplateFFRow.Active = true; AFreeformAnalysisAccess.LoadUsingTemplate(CacheDS, TemplateFFRow, Transaction); AAnalysisAttributeTable AATable = new AAnalysisAttributeTable(); AAnalysisAttributeRow TemplateAARow = AATable.NewRowTyped(false); TemplateAARow.LedgerNumber = ALedgerNumber; TemplateAARow.Active = true; AAnalysisAttributeAccess.LoadUsingTemplate(CacheDS, TemplateAARow, Transaction); } if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } return CacheDS; }
public static bool AccountAnalysisAttributeRequiresValues(Int32 ALedgerNumber, string AAnalysisTypeCode, bool AActiveOnly) { #region Validate Arguments if (ALedgerNumber <= 0) { throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString( "Function:{0} - The Ledger number must be greater than 0!"), Utilities.GetMethodName(true)), ALedgerNumber); } else if (AAnalysisTypeCode.Length == 0) { throw new ArgumentException(String.Format(Catalog.GetString("Function:{0} - The Analysis Type code is empty!"), Utilities.GetMethodName(true))); } #endregion Validate Arguments bool AccountAnalysisAttributeValueRequired = false; TDBTransaction Transaction = null; try { DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { AFreeformAnalysisTable FFATable = new AFreeformAnalysisTable(); AFreeformAnalysisRow TemplateFFARow = FFATable.NewRowTyped(false); TemplateFFARow.LedgerNumber = ALedgerNumber; TemplateFFARow.AnalysisTypeCode = AAnalysisTypeCode; if (AActiveOnly) { TemplateFFARow.Active = AActiveOnly; } AFreeformAnalysisTable FreeformAnalysisTable = AFreeformAnalysisAccess.LoadUsingTemplate(TemplateFFARow, Transaction); AccountAnalysisAttributeValueRequired = (FreeformAnalysisTable.Count > 0); }); } catch (Exception ex) { TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}", Utilities.GetMethodSignature(), Environment.NewLine, ex.Message)); throw ex; } return AccountAnalysisAttributeValueRequired; }
public static GLSetupTDS LoadAAnalysisAttributes(Int32 ALedgerNumber, Boolean AActiveOnly = false) { #region Validate Arguments if (ALedgerNumber <= 0) { throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString( "Function:{0} - The Ledger number must be greater than 0!"), Utilities.GetMethodName(true)), ALedgerNumber); } #endregion Validate Arguments GLSetupTDS MainDS = new GLSetupTDS(); TDBTransaction Transaction = null; try { DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref Transaction, delegate { AAnalysisTypeAccess.LoadViaALedger(MainDS, ALedgerNumber, Transaction); if (!AActiveOnly) { AFreeformAnalysisAccess.LoadViaALedger(MainDS, ALedgerNumber, Transaction); AAnalysisAttributeAccess.LoadViaALedger(MainDS, ALedgerNumber, Transaction); } else { AFreeformAnalysisTable FFTable = new AFreeformAnalysisTable(); AFreeformAnalysisRow TemplateFFRow = FFTable.NewRowTyped(false); TemplateFFRow.LedgerNumber = ALedgerNumber; TemplateFFRow.Active = true; AFreeformAnalysisAccess.LoadUsingTemplate(MainDS, TemplateFFRow, Transaction); AAnalysisAttributeTable AATable = new AAnalysisAttributeTable(); AAnalysisAttributeRow TemplateAARow = AATable.NewRowTyped(false); TemplateAARow.LedgerNumber = ALedgerNumber; TemplateAARow.Active = true; AAnalysisAttributeAccess.LoadUsingTemplate(MainDS, TemplateAARow, Transaction); } }); MainDS.AcceptChanges(); } catch (Exception ex) { TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}", Utilities.GetMethodSignature(), Environment.NewLine, ex.Message)); throw ex; } return MainDS; }
public static bool AccountAnalysisAttributeRequiresValues(Int32 ALedgerNumber, string AAnalysisTypeCode, bool AActiveOnly) { TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.ReadCommitted); bool AccountAnalysisAttributeValueRequired = false; try { AFreeformAnalysisTable FFATable = new AFreeformAnalysisTable(); AFreeformAnalysisRow TemplateFFARow = FFATable.NewRowTyped(false); TemplateFFARow.LedgerNumber = ALedgerNumber; TemplateFFARow.AnalysisTypeCode = AAnalysisTypeCode; if (AActiveOnly) { TemplateFFARow.Active = AActiveOnly; } AFreeformAnalysisTable FreeformAnalysisTable = AFreeformAnalysisAccess.LoadUsingTemplate(TemplateFFARow, Transaction); AccountAnalysisAttributeValueRequired = (FreeformAnalysisTable.Count > 0); } catch (Exception ex) { TLogging.Log("Unexpected error in AccountAnalysisAttributeRequiresValues: " + ex.Message); } finally { DBAccess.GDBAccessObj.RollbackTransaction(); } return AccountAnalysisAttributeValueRequired; }