public static void LaunchJob(JobItem item) { if (_instance != null) { _instance.doJob(item, false); } }
public static void RemoveJob(JobItem item) { if (_instance != null && _instance._jobItems.Remove(item)) { _instance.saveJob(); } }
public static bool AddJob(JobItem item) { if (_instance == null) { StartUp(); } var type = Type.GetType(item.AssemblyQualifiedName); if (type.GetInterface("CommonLib.Helper.IJob") != null) { _instance._jobItems.Add(item); _instance.saveJob(); return(true); } return(false); }
public static JobItem LaunchJob(int?jobID) { JobItem item = _instance?._jobItems?.Where(j => j.JobID == jobID).FirstOrDefault(); if (item != null) { try { _instance.doJob(item); item.LastError = null; } catch (Exception ex) { CommonLib.Core.Utility.FileLogger.Logger.Error(ex); item.LastError = ex.ToString(); } _instance.saveJob(); } return(item); }
private void doJob(JobItem item, bool nextSchedule = true) { if (item.Pending == true) { return; } var type = Type.GetType(item.AssemblyQualifiedName); if (type == null) { _jobItems.Remove(item); } else { IJob job = (IJob)type.Assembly.CreateInstance(type.FullName); job.DoJob(); if (nextSchedule) { item.Schedule = job.GetScheduleToNextTurn(item.Schedule); } job.Dispose(); } }