Exemplo n.º 1
0
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            AuditWorkflowData auditData = _auditRepository.GetOneByWorkflowId(context.Workflow.Id);

            auditData.ApproveReportComments = ApproveReportComments;
            auditData.AuditStateID          = _auditStateRepository.GetOneByCode("IRZ");

            List <string> sectorPlantReferrents = _sectorPlantRepository.GetSectorPlantReferredEmail(auditData.PlantID, auditData.SectorID);

            EmailAddresses.AddRange(sectorPlantReferrents);
            _auditRepository.ApproveOrRejectReportAudit(auditData);
            //If auditor is internal, send email
            if (!string.IsNullOrEmpty(auditData.AuditorID))
            {
                EmailAddresses.Add(_auditRepository.GetAuditorEmail(auditData.AuditorID));
            }

            //Add responsible of SGC
            List <string> responsibleSGC = _userWorkflowRepository.GetUsersEmailResponsibleSGC();

            EmailAddresses.AddRange(responsibleSGC);

            auditData = _auditRepository.GetOneByWorkflowId(auditData.WorkflowId);
            var emailType = "rejectreport";

            this.EmailSubject = EmailStrings.GetSubjectAudit(auditData.AuditTypeName, emailType);
            this.EmailMessage = EmailStrings.GetMessageAudit(auditData, _emailSettings.Url, emailType);

            return(ExecutionResult.Next());
        }
Exemplo n.º 2
0
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            AuditWorkflowData auditData = _auditRepository.GetOneByWorkflowId(context.Workflow.Id);

            auditData.ApproveReportComments = ApproveReportComments;
            auditData.AuditStateID          = _auditStateRepository.GetOneByCode("IAP");

            List <string> sectorPlantReferrents = _sectorPlantRepository.GetSectorPlantReferredEmail(auditData.PlantID, auditData.SectorID);

            EmailAddresses.AddRange(sectorPlantReferrents);
            _auditRepository.ApproveOrRejectReportAudit(auditData);
            //If auditor is internal, send email
            if (!string.IsNullOrEmpty(auditData.AuditorID))
            {
                EmailAddresses.Add(_auditRepository.GetAuditorEmail(auditData.AuditorID));
            }

            //Add responsible of SGC
            List <string> responsibleSGC = _userWorkflowRepository.GetUsersEmailResponsibleSGC();

            EmailAddresses.AddRange(responsibleSGC);

            auditData = _auditRepository.GetOneByWorkflowId(auditData.WorkflowId);
            var emailType = "close";

            this.EmailSubject = EmailStrings.GetSubjectAudit(auditData.AuditTypeName, emailType);
            this.EmailMessage = EmailStrings.GetMessageAudit(auditData, _emailSettings.Url, emailType);

            var findingsWorkFlow = _findingRepository.GetAllByAuditID(auditData.AuditID);

            foreach (var finding in findingsWorkFlow)
            {
                finding.Flow        = "Finding";
                finding.FlowVersion = 1;
                _workflowCore.StartFlow(finding);
            }

            // _auditStandardAspectRepository.
            return(ExecutionResult.Next());
        }