public override ExecutionResult Run(IStepExecutionContext context) { AuditWorkflowData auditData = _auditRepository.GetOneByWorkflowId(context.Workflow.Id); auditData.Recomendations = Recomendations; auditData.Conclusion = Conclusion; auditData.AuditStateID = _auditStateRepository.GetOneByCode("IPA"); List <string> sectorPlantReferrents = _sectorPlantRepository.GetSectorPlantReferredEmail(auditData.PlantID, auditData.SectorID); EmailAddresses.AddRange(sectorPlantReferrents); _auditRepository.EmmitReport(auditData); //If auditor is internal, send email if (!string.IsNullOrEmpty(auditData.AuditorID)) { EmailAddresses.Add(_auditRepository.GetAuditorEmail(auditData.AuditorID)); } var emailType = "emmitreport"; this.EmailSubject = EmailStrings.GetSubjectAudit(auditData.AuditTypeName, emailType); this.EmailMessage = EmailStrings.GetMessageAudit(auditData, _emailSettings.Url, emailType); //Add responsible of SGC List <string> responsibleSGC = _userWorkflowRepository.GetUsersEmailResponsibleSGC(); EmailAddresses.AddRange(responsibleSGC); return(ExecutionResult.Next()); }
public override ExecutionResult Run(IStepExecutionContext context) { AuditWorkflowData auditData = _auditRepository.GetOneByWorkflowId(context.Workflow.Id); auditData.AuditTeam = AuditTeam; auditData.DocumentsAnalysisDate = DocumentsAnalysisDate; auditData.DocumentAnalysisDuration = DocumentAnalysisDuration; auditData.ReportEmittedDate = ReportEmittedDate; auditData.CloseMeetingDate = CloseMeetingDate; auditData.CloseMeetingDuration = CloseMeetingDuration; auditData.CloseDate = CloseDate; auditData.AuditStateID = _auditStateRepository.GetOneByCode("PPA"); _auditRepository.PlanAudit(auditData, AuditStandardAspects); //List<string> sectorPlantReferrents = _sectorPlantRepository.GetSectorPlantReferredEmail(auditData.PlantID, auditData.SectorID); //EmailAddresses.AddRange(sectorPlantReferrents); ////If auditor is internal, send email //if (!string.IsNullOrEmpty(auditData.AuditorID)) //{ // EmailAddresses.Add(_auditRepository.GetAuditorEmail(auditData.AuditorID)); //} ////Left responsible of SGC EmailAddresses.AddRange(_userWorkflowRepository.GetUsersEmailResponsibleSGC()); //auditData = _auditRepository.GetOneByWorkflowId(auditData.WorkflowId); var emailType = "plan"; this.EmailSubject = EmailStrings.GetSubjectAudit(auditData.AuditTypeName, emailType); this.EmailMessage = EmailStrings.GetMessageAudit(auditData, _emailSettings.Url, emailType); return(ExecutionResult.Next()); }
public override ExecutionResult Run(IStepExecutionContext context) { AuditWorkflowData auditWorkflowData = _auditRepository.GetOneByWorkflowId(context.Workflow.Id); auditWorkflowData.AuditStateID = _auditStateRepository.GetOneByCode("PRZ"); auditWorkflowData.ApprovePlanComments = ApprovePlanComments; _auditRepository.ApproveOrRejectAuditPlan(auditWorkflowData); List <string> sectorPlantReferrents = _sectorPlantRepository.GetSectorPlantReferredEmail(auditWorkflowData.PlantID, auditWorkflowData.SectorID); EmailAddresses.AddRange(_userWorkflowRepository.GetUsersEmailResponsibleSGC()); ////If auditor is internal, send email if (!string.IsNullOrEmpty(auditWorkflowData.AuditorID)) { EmailAddresses.Add(_auditRepository.GetAuditorEmail(auditWorkflowData.AuditorID)); } //Left responsible of SGC auditWorkflowData = _auditRepository.GetOneByWorkflowId(auditWorkflowData.WorkflowId); var emailType = "rejectplan"; this.EmailSubject = EmailStrings.GetSubjectAudit(auditWorkflowData.AuditTypeName, emailType); this.EmailMessage = EmailStrings.GetMessageAudit(auditWorkflowData, _emailSettings.Url, emailType); return(ExecutionResult.Next()); }
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()); }
public override ExecutionResult Run(IStepExecutionContext context) { AuditWorkflowData auditWorkflowData = new AuditWorkflowData(); auditWorkflowData.PlantID = PlantID; auditWorkflowData.SectorID = SectorID; auditWorkflowData.AuditorID = AuditorID; auditWorkflowData.ExternalAuditor = ExternalAuditor; auditWorkflowData.CreationDate = CreationDate; auditWorkflowData.AuditInitDate = AuditInitDate; auditWorkflowData.AuditTypeID = AuditTypeID; auditWorkflowData.AuditStandard = AuditStandard; auditWorkflowData.AuditStateID = _auditStateRepository.GetOneByCode("PRO"); auditWorkflowData.WorkflowId = context.Workflow.Id; _auditRepository.Add(auditWorkflowData); //Responsible of sector-plant List <string> sectorPlantReferrents = _sectorPlantRepository.GetSectorPlantReferredEmail(PlantID, SectorID); EmailAddresses.AddRange(sectorPlantReferrents); //If auditor is internal, send email if (!string.IsNullOrEmpty(AuditorID)) { EmailAddresses.Add(_auditRepository.GetAuditorEmail(AuditorID)); } auditWorkflowData = _auditRepository.GetOneByWorkflowId(auditWorkflowData.WorkflowId); var emailType = "schedule"; this.EmailSubject = EmailStrings.GetSubjectAudit(auditWorkflowData.AuditTypeName, emailType); this.EmailMessage = EmailStrings.GetMessageAudit(auditWorkflowData, _emailSettings.Url, emailType); return(ExecutionResult.Next()); }