public void SetExecutionStatus(Guid executionContextId, ReportExecutionStatusType executionStatus) { if (this.CurrentExecutionContextId != executionContextId) { throw new InvalidDataException(string.Format("The execution context Id does not match for schedule '{0}', tenant: {1}", this.ScheduleName ?? string.Empty, this.TenantId)); } if (ReportSchedule.IsExecutionCompleted(executionStatus)) { this.LastExecutionContextId = executionContextId; this.LastExecutionStatus = executionStatus; this.LastExecutionTime = DateTime.UtcNow; this.CurrentExecutionContextId = Guid.Empty; this.CurrentExecutionStatus = ReportExecutionStatusType.None; return; } this.CurrentExecutionStatus = executionStatus; }
private static bool IsExecutionCompleted(ReportExecutionStatusType executionStatus) { return(executionStatus == ReportExecutionStatusType.Completed || executionStatus == ReportExecutionStatusType.Failed || executionStatus == ReportExecutionStatusType.Cancelled); }
public void SetExecutionStatus(Guid tenantId, string scheduleName, Guid executionContextId, ReportExecutionStatusType executionStatus) { ReportSchedule reportSchedule = this.GetReportSchedule(tenantId, scheduleName); reportSchedule.SetExecutionStatus(executionContextId, executionStatus); this.Save(reportSchedule); }