示例#1
0
        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()));
        }
示例#2
0
        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();
        }
示例#4
0
        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();
        }
示例#5
0
        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);
        }