public ServiceResponse AddProcess(Process process) { ServiceResponse result = new ServiceResponse(); try { var currentUserID = GetCurrentUser.GetUserID(User.Claims.ToList()); var currentUsername = User.Identity.Name; result = _processService.Add(process, currentUserID, currentUsername); } catch (Exception ex) { result.OnExeption(ex); } return(result); }
// TODO add logging error and output //private readonly StringBuilder _outputData = new StringBuilder(); //private readonly StringBuilder _errorData = new StringBuilder(); protected override void Execute(SessionRecording recording, LaunchProgramActionSettings settings) { _settings = settings; _process = CreateProcess(settings, recording); if (settings.KeepRunning == false) { _process.EnableRaisingEvents = true; _process.Exited += process_Exited; } if (_process.Start()) { if (settings.WaitForStart) { if (_settings.WaitTimeout.HasValue) { _process.WaitForInputIdle((int)_settings.WaitTimeout.Value.TotalMilliseconds); //_process.WaitForInputIdle(); //Thread.Sleep((int)_settings.WaitTimeout.Value.TotalMilliseconds); } else { _process.WaitForInputIdle(); } } if (settings.KeepRunning) { _service.Add(_process.Id, settings.Tag); _process.Dispose(); _process = null; OnCompleted(SessionStepResult.Successful); } } else { // TODO show or log that the process did not start OnCompleted(SessionStepResult.Failed); } }
public IActionResult AddProcess(Process process) { User currentUser = userService.GetCurrentUser(User.Identity.Name); Category category = null; if (categoryService.Add(process.Category) != null) // them mới thành công { categoryService.Save(); // Lưu lại trong database } category = categoryService.GetSingleByCondition(x => x.Name.ToUpper() == process.Category.Name.ToUpper()); process.CategoryId = category.CategoryId; processService.Add(process, currentUser); processService.Save(); phaseService.AddWhenCreateProcess(process.ProcessId, currentUser); phaseService.Save(); return(Ok(process.ProcessId)); }