public void AddAttempt(string name, Exception exception = null) { try { string guid = GetIdOnRobotJobFile(name); if (!_jobs.ContainsKey(guid)) { throw new Exception("The job was not found, but it should be."); } lock (GetSyncObject(guid)) { string file = Path.Combine(CommonService.JobsDirectory, $"{ name }.xml"); RobotJobManager.Save(file, new AddAttemptRobotJob() { ErrorMessage = exception == null ? null : $"{ exception.Message }\n{ exception.StackTrace }" }); } } catch (Exception ex) { throw ex; } }
public string Create(Globals.BackgroundAppType type, DateTime dt, Dictionary <string, object> parameters) { try { string guid = null; string name = GetRobotJobFileName(type, out guid); AddSynObject(guid); lock (GetSyncObject(guid)) { string file = Path.Combine(CommonService.JobsDirectory, $"{ name }.xml"); RobotJobManager.Save(file, name, type, dt, parameters); } return(name); } catch (Exception ex) { throw ex; } }