public static WfClientProcess Moveto(WfClientMovetoParameters parameters) { IWfProcess process = WfRuntime.GetProcessByProcessID(parameters.ProcessID); IWfActivity activity = process.CurrentActivity; if (activity == null || activity.Assignees == null)// || !activity.Assignees.Contains(UserHelper.UserId)) { return(null); } WfTransferParams transferParams = WfTransferParams.FromNextDefaultActivity(process); UserTaskCollection userTask = new UserTaskCollection(); WfMoveToExecutor executor = new WfMoveToExecutor(activity, activity, transferParams); //调整待办的url和标题 executor.PrepareMoveToTasks += (dataContext, tasks) => { PrepareUserTasks(tasks, null, null, transferParams.NextActivityDescriptor.Name); }; GenericOpinion serverOpinion = PrepareOpinion(process.CurrentActivity, parameters.CurrentOpinion, DeluxeIdentity.CurrentUser); if (activity.Descriptor.ActivityType == WfActivityType.InitialActivity) { serverOpinion.OpinionType = "提交"; } else if (activity.Descriptor.ActivityType == WfActivityType.CompletedActivity) { serverOpinion.OpinionType = string.Empty; } else if (activity.Descriptor.ActivityType == WfActivityType.NormalActivity) { serverOpinion.OpinionType = "同意"; if (serverOpinion.Content.IsNullOrEmpty()) { serverOpinion.Content = "同意"; } } executor.PrepareApplicationData += dataContext => GenericOpinionAdapter.Instance.Update(serverOpinion); return(GetClientProcess(executor.Execute())); }
public static WfClientProcess DynamicProcessMoveto(WfClientDynamicProcessMovetoParameters parameters) { IWfProcess process = WfRuntime.GetProcessByActivityID(parameters.ActivityID); IWfActivity activity = process.CurrentActivity; if (parameters.MovetoActivityDescriptor != null) { WfActivityDescriptorCreateParams createParams = new WfActivityDescriptorCreateParams(); createParams = new WfActivityDescriptorCreateParams(); createParams.Users = new OguDataCollection <IUser>(); createParams.Name = parameters.MovetoActivityDescriptor.ActivityName; foreach (WfClientUserResourceDescriptorParameters userResource in parameters.MovetoActivityDescriptor.UserResourceList) { createParams.Users.Add(userResource.User); } WfAddActivityExecutor executor = new WfAddActivityExecutor(activity, activity, createParams); executor.Execute(); } //工作流流向下一个节点 WfClientMovetoParameters movetoParameters = new WfClientMovetoParameters() { ProcessID = process.ID, ActivityID = activity.ID, ResourceID = process.ResourceID, Comment = parameters.Comment }; WfClientProcess clientProcess = WfClientProxy.Moveto(movetoParameters); return(clientProcess); }