public async Task <bool> Execute(FindingWorkflowData finding, IFormFile[] findingEvidences, List <string> filesToDelete) { if (findingEvidences != null) { await InsertFiles(findingEvidences, finding); } if (filesToDelete != null) { await DeleteFiles(filesToDelete, finding); } try { var findingWorkflow = _findingRepository.UpdateIsInProcessWorkflow(finding.FindingID, true); finding.EmitterUserID = _httpContextAccessor.HttpContext.User.FindFirst("id").Value; await _workflowCore.ExecuteEvent("Approve", finding.WorkflowId, finding); await _hub.Clients.All.SendAsync("transferfindingsdata", findingWorkflow); return(true); } catch (Exception ex) { throw ex; } }
public async Task <bool> Execute(FindingWorkflowData finding, IFormFile[] findingEvidences, List <string> filesToDelete) { if (!_userLoggedHelper.CheckForPermissionsToUpdateReassignOrClose(finding.ResponsibleUserID)) { throw new DontHavePermissionsException("The user doesn´t have permissions to perform this action"); } if (findingEvidences != null) { await InsertFiles(findingEvidences, finding); } if (filesToDelete != null) { await DeleteFiles(filesToDelete, finding); } try { var findingWorkflow = _findingRepository.UpdateIsInProcessWorkflow(finding.FindingID, true); await _workflowCore.ExecuteEvent("Close", finding.WorkflowId, finding); await _hub.Clients.All.SendAsync("transferfindingsdata", findingWorkflow); return(true); } catch (Exception ex) { throw ex; } }
public async Task Execute(Domain.CorrectiveAction.CorrectiveAction correctiveAction, IFormFile[] Evidences) { try { if (Evidences != null) { await InsertFiles(Evidences, correctiveAction); } var workflowId = _correctiveActionRepository.GetWorkflowId(correctiveAction.CorrectiveActionID); var correctiveActionWorkflow = new CorrectiveActionWorkflowData(); correctiveActionWorkflow.WorkflowId = workflowId; correctiveActionWorkflow.isEffective = correctiveAction.isEffective; correctiveActionWorkflow.EvidencesUrl = correctiveAction.NewEvidencesUrls; correctiveActionWorkflow.EvaluationCommentary = correctiveAction.EvaluationCommentary; await _workflowCore.ExecuteEvent("ReviewedCorrectiveAction", workflowId, correctiveActionWorkflow); } catch (Exception ex) { throw new Exception(); } }
public bool Execute(FindingWorkflowData finding) { var findingWorkflow = _findingRepository.UpdateIsInProcessWorkflow(finding.FindingID, true); _workflowCore.ExecuteEvent("Close", finding.WorkflowId, finding); //_hub.Clients.All.SendAsync("transferfindingsdata", findingWorkflow); return(true); }
public async Task Execute(int correctiveActionId) { var correctiveAction = _correctiveActionRepository.GetOne(correctiveActionId); var correctiveActionTasks = _taskRepository.GetAllForCorrectiveActionWithOutStates(correctiveActionId); var taskStateCompletedId = _taskStateRepository.GetIdByCode("COM"); var quantityWithoutFinish = correctiveActionTasks.Where(t => t.TaskStateID != taskStateCompletedId).ToList().Count; if (quantityWithoutFinish == 0) { await _workflowCore.ExecuteEvent("FinishedTasks", correctiveAction.WorkflowId, new CorrectiveActionWorkflowData()); } }
public async Task <bool> Execute(AuditWorkflowData audit) { try { audit.EventData = "ToPlan"; await _workflowCore.ExecuteEvent("ToPlan", audit.WorkflowId, audit); return(true); } catch (Exception ex) { throw ex; } }
public async Task <bool> Execute(FindingWorkflowData finding) { //_findingRepository.Update(finding); try { var findingWorkflow = _findingRepository.UpdateIsInProcessWorkflow(finding.FindingID, true); await _workflowCore.ExecuteEvent("Close", finding.WorkflowId, finding); await _hub.Clients.All.SendAsync("transferfindingsdata", findingWorkflow); return(true); } catch (Exception ex) { throw ex; } }
public async Task <bool> Execute(FindingWorkflowData findingWorkflowData) { Domain.Finding.Finding finding = _findingRepository.Get(findingWorkflowData.FindingID); if (findingWorkflowData.ReassignedUserID == finding.ResponsibleUserID) { throw new ReassignedUserCantBeActualResponsibleUserException(finding, findingWorkflowData.ReassignedUserID); } if (_httpContextAccessor.HttpContext.User.HasClaim(CustomClaimTypes.Permission, CrossCutting.Authorization.Claims.Quality.Findings.ReassginDirectly)) { findingWorkflowData.EventData = "ReassignedWithoutApproval"; } var findingWorkflow = _findingRepository.UpdateIsInProcessWorkflow(findingWorkflowData.FindingID, true); await _workflowCore.ExecuteEvent("Close", findingWorkflowData.WorkflowId, findingWorkflowData); //await _hub.Clients.All.SendAsync("transferfindingsdata", findingWorkflow); return(true); }
public async Task Execute(CorrectiveActionWorkflowData correctiveAction) { correctiveAction.EmitterUserID = _httpContextAccessor.HttpContext.User.FindFirst("id").Value; await _workflowCore.ExecuteEvent("FinishedAnalysis", correctiveAction.WorkflowId, correctiveAction); }
public async Task <bool> Execute(AuditWorkflowData audit) { await _workflowCore.ExecuteEvent("Approve", audit.WorkflowId, audit); return(true); }