private string GetRobotJobFileName(Globals.BackgroundAppType type, out string guid) { Guid id = Guid.NewGuid(); guid = id.ToString("N"); return($"{ type.ToString().ToLower() }_{ guid }"); }
public static void Save(string path, string guid, Globals.BackgroundAppType type, DateTime executionDate, Dictionary <string, object> parameters) { var job = new Job() { Id = guid, Type = type, Status = RobotJobStatus.ACTIVE, CreationDate = DateTime.Now, ExecutionDate = executionDate }; job.SetParameters(parameters); XmlSerializer SerializerObj = new XmlSerializer(typeof(Job)); using (TextWriter writer = new StreamWriter(path)) { SerializerObj.Serialize(writer, job); writer.Close(); } }
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; } }