Exemplo n.º 1
0
        public bool Execute(Domain.Finding.Finding finding)
        {
            var oldFinding = _findingRepository.GetWithoutIncludes(finding.Id);

            if (oldFinding == null)
            {
                throw new EntityNotFoundException(finding.Id, "No se encontro un hallazgo con ese nombre");
            }

            oldFinding.Description   = finding.Description;
            oldFinding.FindingTypeID = finding.FindingTypeID;

            return(_findingRepository.Update(oldFinding));
        }
Exemplo n.º 2
0
        public bool Execute(Domain.Finding.Finding finding, string createdByUserId)
        {
            if (!finding.IsStateExpired)
            {
                throw new FindingStateMustBeExpiredException(finding);
            }
            if (!finding.ValidateExpirationDate())
            {
                throw new InvalidExpirationDateException(finding);
            }

            finding.FindingStateID = _findingStateHistoryRepository.GetPreviousState(finding.Id, finding.FindingStateID);
            _findingStateHistoryRepository.Add(finding.Id, finding.FindingStateID, createdByUserId);
            return(_findingRepository.UpdateExpirationDate(finding));
        }
        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 FindingStateMustBeExpiredException(Domain.Finding.Finding finding) : base("El estado del hallazgo debe ser vencido")
 {
     Finding = finding;
 }
Exemplo n.º 5
0
 public CantDeleteFindingException(Domain.Finding.Finding finding) : base("El hallazgo no puede eliminarse")
 {
     Finding = finding;
 }
Exemplo n.º 6
0
 public ReassignedUserCantBeActualResponsibleUserException(Domain.Finding.Finding finding, string reassignedUserID) : base("El usuario responsable seleccionado debe ser distinto al actual")
 {
     Finding          = finding;
     ReassignedUserID = reassignedUserID;
 }
Exemplo n.º 7
0
 public InvalidExpirationDateException(Domain.Finding.Finding finding) : base("La fecha de vencimiento debe ser mayor a la fecha actual")
 {
     Finding = finding;
 }
Exemplo n.º 8
0
 public bool Execute(Domain.Finding.Finding finding)
 {
     finding.EmitterUserID = _httpContextAccessor.HttpContext.User.FindFirst("id").Value;
     return(_auditStandardAspectRepository.AddFinding(finding));
 }