/// <summary> /// processes the delegate /// </summary> private static void GenericProcessor(string ADelegateName, bool ARunManually = false) { if (!FProcessDelegates.ContainsKey(ADelegateName)) { return; } TProcessDelegate TypedDelegate = FProcessDelegates[ADelegateName]; TDataBase db = null; try { db = DBAccess.Connect("Servers's DB Connection for TimedProcessing"); TypedDelegate(db, ARunManually); if (TLogging.DebugLevel >= 9) { TLogging.Log("Timed Processing: Delegate " + ADelegateName + " has run."); } } finally { if (db != null) { db.CloseDBConnection(); } } }
/// <summary> /// processes the delegate /// </summary> private static void GenericProcessor(object ADelegateName, bool ARunManually) { if (!FProcessDelegates.ContainsKey((string)ADelegateName)) { return; } TDataBase db = EstablishDBConnection(); TPetraIdentity PetraIdentity = new TPetraIdentity( "SYSADMIN", "", "", "", "", DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, 0, -1, -1, false, false); UserInfo.GUserInfo = new TPetraPrincipal(PetraIdentity, null); TProcessDelegate TypedDelegate = FProcessDelegates[(string)ADelegateName]; TypedDelegate(db, ARunManually); CloseDBConnection(db); if (TLogging.DebugLevel >= 9) { TLogging.Log("delegate " + ADelegateName + " has run."); } }
/// <summary> /// add a new processing job /// </summary> public static void AddProcessingJob(string ADelegateName, TProcessDelegate ADelegate) { if (!FProcessDelegates.ContainsKey(ADelegateName)) { FProcessDelegates.Add(ADelegateName, ADelegate); } }
/// <summary> /// processes the delegate /// </summary> private static void GenericProcessor(object ADelegateName, bool ARunManually) { if (!FProcessDelegates.ContainsKey((string)ADelegateName)) { return; } TDataBase db = EstablishDBConnection(); if (db != null) { TProcessDelegate TypedDelegate = FProcessDelegates[(string)ADelegateName]; TypedDelegate(db, ARunManually); CloseDBConnection(db); if (TLogging.DebugLevel >= 9) { TLogging.Log("Timed Processing: Delegate " + ADelegateName + " has run."); } } else { TLogging.Log("Timed Processing: Delegate " + ADelegateName + " could not be run because no database connection is available!"); } }
/// <summary> /// add a new processing job /// </summary> public static void AddProcessingJob(string ADelegateName, TProcessDelegate ADelegate) { if (FProcessDelegates == null) { FProcessDelegates = new SortedList <string, TTimedProcessing.TProcessDelegate>(); } if (!FProcessDelegates.ContainsKey(ADelegateName)) { FProcessDelegates.Add(ADelegateName, ADelegate); } }