public void Index(ProcessElastic processElastic) { var response = Client.Index(processElastic); ResponseValidator(response); Client.Flush(IndexName); }
public string Update(string id, ProcessElastic processElastic) { var response = Client.Update(new DocumentPath <ProcessElastic>(id), ur => ur.Doc(processElastic)); ResponseValidator(response); return(response.Id); }
public static Process ToProcessModel(this ProcessElastic process) { var model = new Process { Id = process.Id, Start = process.Start, End = process.End, Percent = process.Percent, Description = process.Description, Status = (ProcessStatusEnum)process.Status, ErrorMessages = process.ErrorMessages, ResultMessage = process.ResultMessage, Type = (ProcessTypeEnum)process.Type }; return(model); }
public void Start(ProcessElastic process, Action <CancellationTokenSource> action) { var tokenSource = new CancellationTokenSource(); var task = new Task( () => action(tokenSource), tokenSource.Token, TaskCreationOptions.LongRunning); task.Start(); GlobalStore.Processes.Add( process.Id, new Models.GlobalStoreProcess() { Process = process, CancellationToken = tokenSource, Task = task }); }
public ProcessElastic Create(ProcessTypeEnum type, string affectedObjectId, object initObject, string description) { var processId = Guid.NewGuid().ToString(); var process = new ProcessElastic { Id = processId, Status = (int)ProcessStatusEnum.InProgress, Type = (int)type, Start = DateTime.UtcNow, Percent = 0.0, ErrorMessages = new System.Collections.Generic.List <string>(), InitObject = initObject, AffectedObjectId = affectedObjectId, Description = description }; processQuery.Index(process); return(process); }