加签执行运行时
Inheritance: WfRuntimeManager
Exemple #1
0
        /// <summary>
        /// 加签操作
        /// </summary>
        /// <param name="runner"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static WfRuntimeManager CreateRuntimeInstanceSignForward(WfAppRunner runner,
                                                                        ref WfExecutedResult result)
        {
            var rmins = new WfRuntimeManagerSignForward();

            rmins.WfExecutedResult = result = new WfExecutedResult();

            if (string.IsNullOrEmpty(runner.AppName) ||
                String.IsNullOrEmpty(runner.AppInstanceID) ||
                runner.ProcessGUID == null ||
                runner.NextActivityPerformers == null)
            {
                result.Status        = WfExecutedStatus.Exception;
                result.ExceptionType = WfExceptionType.SignForward_ErrorArguments;
                result.Message       = "方法参数错误,无法加签流程!";
                return(rmins);
            }

            if (runner.NextActivityPerformers.Count() == 0)
            {
                result.Status        = WfExecutedStatus.Exception;
                result.ExceptionType = WfExceptionType.SignForward_NoneSigners;
                result.Message       = "没有添加要发送加签的人员";
                return(rmins);
            }

            rmins.AppRunner = runner;

            var            aim         = new ActivityInstanceManager();
            TaskViewEntity taskView    = null;
            var            runningNode = aim.GetRunningNode(runner, out taskView);

            //判断是否是当前登录用户的任务
            if (runningNode.AssignedToUserIDs.Contains(runner.UserID.ToString()) == false)
            {
                result.Status        = WfExecutedStatus.Exception;
                result.ExceptionType = WfExceptionType.RunApp_HasNoTask;
                result.Message       = "当前没有登录用户要办理的任务,无法运行流程!";
                return(rmins);
            }

            var processModel     = new ProcessModel(taskView.ProcessGUID, taskView.Version);
            var activityResource = new ActivityResource(runner, runner.NextActivityPerformers, runner.Conditions, runner.DynamicVariables);

            var tm = new TaskManager();

            rmins.TaskView = taskView;
            rmins.RunningActivityInstance = runningNode;
            rmins.ProcessModel            = processModel;
            rmins.ActivityResource        = activityResource;

            return(rmins);
        }
        /// <summary>
        /// 加签操作
        /// </summary>
        /// <param name="runner"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public static WfRuntimeManager CreateRuntimeInstanceSignForward(WfAppRunner runner,
            ref WfExecutedResult result)
        {
            var rmins = new WfRuntimeManagerSignForward();
            rmins.WfExecutedResult = result = new WfExecutedResult();

            if (string.IsNullOrEmpty(runner.AppName)
                || String.IsNullOrEmpty(runner.AppInstanceID)
                || runner.ProcessGUID == null
                || runner.NextActivityPerformers == null)
            {
                result.Status = WfExecutedStatus.Exception;
                result.ExceptionType = WfExceptionType.SignForward_ErrorArguments;
                result.Message = "方法参数错误,无法加签流程!";
                return rmins;
            }

            if (runner.NextActivityPerformers.Count() == 0)
            {
                result.Status = WfExecutedStatus.Exception;
                result.ExceptionType = WfExceptionType.SignForward_NoneSigners;
                result.Message = "没有添加要发送加签的人员";
                return rmins;
            }

            rmins.AppRunner = runner;

            var aim = new ActivityInstanceManager();
            TaskViewEntity taskView = null;
            var runningNode = aim.GetRunningNode(runner, out taskView);

            //判断是否是当前登录用户的任务
            if (runningNode.AssignedToUserIDs.Contains(runner.UserID.ToString()) == false)
            {
                result.Status = WfExecutedStatus.Exception;
                result.ExceptionType = WfExceptionType.RunApp_HasNoTask;
                result.Message = "当前没有登录用户要办理的任务,无法运行流程!";
                return rmins;
            }

            var processModel = new ProcessModel(taskView.ProcessGUID, taskView.Version);
            var activityResource = new ActivityResource(runner, runner.NextActivityPerformers, runner.Conditions, runner.DynamicVariables);

            var tm = new TaskManager();
            rmins.TaskView = taskView;
            rmins.RunningActivityInstance = runningNode;
            rmins.ProcessModel = processModel;
            rmins.ActivityResource = activityResource;

            return rmins;
        }