public static SSystemDefaultsTable GetSystemDefaults() { SSystemDefaultsTable ReturnValue = null; TDBTransaction ReadTransaction = null; bool DBAccessCallSuccessful = false; DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction( IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, ref ReadTransaction, delegate { TServerBusyHelper.CoordinatedAutoRetryCall("Loading all SystemDefaults", ref DBAccessCallSuccessful, delegate { ReturnValue = SSystemDefaultsAccess.LoadAll(ReadTransaction); DBAccessCallSuccessful = true; }); }); if (!DBAccessCallSuccessful) { throw new EDBAccessLackingCoordinationException("Loading of System Default failed: server was too busy!"); } return(ReturnValue); }
/// <summary> /// Returns the value of the specified System Default. /// For that, the whole System Defaults DB table is read from the server - that's not a problem so long as there's not /// thousands of system defaults, and this method isn't called too often! /// </summary> /// <param name="ASystemDefaultName">The System Default for which the value should be returned.</param> /// <returns>The value of the System Default, or SYSDEFAULT_NOT_FOUND if the /// specified System Default was not found.</returns> public static String GetSystemDefault(String ASystemDefaultName) { SSystemDefaultsTable SystemDefaultsDT = null; SSystemDefaultsRow FoundSystemDefaultsRow; bool ServerCallSuccessful = false; TServerBusyHelper.CoordinatedAutoRetryCall("System Defaults", ref ServerCallSuccessful, delegate { SystemDefaultsDT = TRemote.MSysMan.Maintenance.SystemDefaults.WebConnectors.GetSystemDefaults(); ServerCallSuccessful = true; }); if (!ServerCallSuccessful) { TServerBusyHelperGui.ShowLoadingOfDataGotCancelledDialog(); return(SharedConstants.SYSDEFAULT_NOT_FOUND); } if (SystemDefaultsDT != null) { // Look up the System Default FoundSystemDefaultsRow = (SSystemDefaultsRow)SystemDefaultsDT.Rows.Find(ASystemDefaultName); return(FoundSystemDefaultsRow != null ? FoundSystemDefaultsRow.DefaultValue : SharedConstants.SYSDEFAULT_NOT_FOUND); } else { // 'Back-stop' - should never get here return(SharedConstants.SYSDEFAULT_NOT_FOUND); } }