public void Run(object parameter = null) { Status = CheckStatus((ISchemaInfo)parameter); if (Status != EComponentStatus.READY) { return; } Status = EComponentStatus.WORKING; try { //Before calling. Maybe could be an error UpdateLastExecution((ISchemaInfo)parameter); Status = DoRun(parameter); Status = EComponentStatus.OK; //After calling. Real last update UpdateLastExecution((ISchemaInfo)parameter); MyLogger.LogText("COMPLETE", string.Format("{0}::Run", ID)); } catch (Exception ex) { MyLogger.LogText("FINALIZED WITH ERROR", string.Format("{0}::Run", ID)); MyLogger.LogException(ex, string.Format("{0}::Run", ID)); Status = EComponentStatus.ERROR; } return; }
protected CronJobBase() { Status = EComponentStatus.READY; LastExecutions = new Dictionary <long, DateTime>(); }