/// <summary> /// Transition a Workflow. /// </summary> protected void TransitionWorkflowInstance(Guid reportId, StateTransition transition) { var report = UnitOfWork.Find <Report>(reportId); WorkflowInstanceService.Transition(report.WorkflowInstance, transition, report.Id); UnitOfWork.Commit(); }
/// <summary> /// Transition the state of a Report WorkflowInstance /// </summary> private void TransitionReportWorkflow(Report report, StateTransition transition) { if (report.WorkflowInstance == null) { // TODO: Is this an Error or Info? Log.Info("Cannot {0} Report [{1}] because it has no workflow.", transition, report.Id); return; } // Scope the Unit Of Work so Messages are Published after the commit. using (new Scope <IReportsUnitOfWork>(UnitOfWork)) { // Transition the Workflow _workflowInstanceService.Transition(report.WorkflowInstance, transition, report.Id); // Commit any Changes UnitOfWork.Commit(); } }