private async Task StopProductWorkflowAsync(Guid productId, int projectId, ProductTransitionType transitionType) { // Remove any future transition entries await ClearPreExecuteEntries(productId); // Remove any tasks await RemoveTasksByProductId(productId); var workflowDefinition = await GetExecutingWorkflowDefintion(productId); await createTransitionRecord(productId, transitionType, workflowDefinition.Type); // Delete the ProcessInstance DeleteWorkflowProcessInstance(productId, projectId); }
private async Task createTransitionRecord(Guid processId, ProductTransitionType transitionType, WorkflowType workflowType) { using (var scope = ServiceProvider.CreateScope()) { var productTransitionsRepository = scope.ServiceProvider.GetRequiredService <IJobRepository <ProductTransition> >(); var transition = new ProductTransition { ProductId = processId, AllowedUserNames = String.Empty, TransitionType = transitionType, WorkflowType = workflowType, DateTransition = DateTime.UtcNow }; transition = await productTransitionsRepository.CreateAsync(transition); } }
public void StopProductWorkflow(Guid productId, int projectId, ProductTransitionType transitionType) { StopProductWorkflowAsync(productId, projectId, transitionType).Wait(); }