public static WfClientProcess Cancel(WfClientCancelParameters parameters) { IWfProcess process = WfRuntime.GetProcessByProcessID(parameters.ProcessID); IWfActivity activity = process.CurrentActivity; if (activity == null || activity.Assignees == null)// || !activity.Assignees.Contains(UserHelper.UserId)) { return(null); } WfCancelProcessExecutor executor = new WfCancelProcessExecutor(activity, process); GenericOpinion serverOpinion = PrepareOpinion(process.CurrentActivity, parameters.CurrentOpinion, DeluxeIdentity.CurrentUser); serverOpinion.OpinionType = "拒绝"; if (serverOpinion.Content.IsNullOrEmpty()) { serverOpinion.Content = "拒绝"; } executor.PrepareApplicationData += dataContext => GenericOpinionAdapter.Instance.Update(serverOpinion); return(GetClientProcess(executor.Execute())); }
public static IWfProcess CancelByExecutor(this IWfProcess process) { WfCancelProcessExecutor executor = new WfCancelProcessExecutor(process.CurrentActivity, process); executor.Execute(); return(process); }
protected void cancelProcess_ExecuteStep(object data) { IWfProcess process = WfRuntime.GetProcessByProcessID((string)data); CheckPermission(process); WfCancelProcessExecutor executor = new WfCancelProcessExecutor(null, process); executor.Execute(); }
public void CancelProcess(string processID, bool cancelAllBranchProcesses) { processID.CheckStringIsNullOrEmpty("processID"); IWfProcess process = WfRuntime.GetProcessByProcessID(processID); IWfActivity currentActivity = process.CurrentActivity; //仅作废当前流程 WfCancelProcessExecutor executor = new WfCancelProcessExecutor(process.CurrentActivity, process, cancelAllBranchProcesses); executor.Execute(); }
public void RestoreProcessExecutorTest() { IWfProcess process = WfProcessTestCommon.StartupSimpleProcess(); MoveToExecutor(process); process = WfRuntime.GetProcessByProcessID(process.ID); WfExecutorBase executor = new WfCancelProcessExecutor(process.CurrentActivity, process); executor.Execute(); Assert.AreEqual(WfProcessStatus.Aborted, process.Status); process = WfRuntime.GetProcessByProcessID(process.ID); executor = new WfRestoreProcessExecutor(process.CurrentActivity, process); executor.Execute(); process = WfRuntime.GetProcessByProcessID(process.ID); Assert.AreEqual(WfProcessStatus.Running, process.Status); }