/// <summary> /// Suspends the specified context. /// </summary> /// <param name="context">The context.</param> protected virtual void Suspend(BusinessContext context) { //string strPrimaryKeyId = "28ad9324-85a5-4dd2-96a2-ace25bd14be4"; //BusinessManager.Execute<CompleteAssignmentRequest, Response>(new CompleteAssignmentRequest(PrimaryKeyId.Parse(strPrimaryKeyId))); // Load WorkflowInstanceEntity WorkflowInstanceEntity wf = (WorkflowInstanceEntity)BusinessManager.Load(WorkflowInstanceEntity.ClassName, context.GetTargetPrimaryKeyId().Value); // Check Wf State if (wf.State != (int)BusinessProcessState.Active) { throw new InvalidOperationException(); } WorkflowInstance instance = GlobalWorkflowRuntime.WorkflowRuntime.GetWorkflow((Guid)wf.PrimaryKeyId.Value); instance.Suspend(string.Empty); GlobalWorkflowRuntime.RunWorkflow(instance); //wf.State = (int)BusinessProcessState.Suspended; //BusinessManager.Update(wf); // Susupend All Active Assignments }