Exemplo n.º 1
0
        /// <summary>
        /// 递归搜索任务Id
        /// </summary>
        /// <param name="task">任务层级对象</param>
        /// <param name="ids">Id集合</param>
        /// <param name="identitySelector">标识筛选器(执行任务或回滚任务)</param>
        private void SearchTaskId(TaskHierarchy task, List <string> ids, Func <TaskIdentity, string> identitySelector)
        {
            if (task == null)
            {
                return;
            }

            var selector = new Func <TaskIdentity, string>(x => x.DoId);

            if (identitySelector != null)
            {
                selector = identitySelector;
            }

            ids.Add(selector(task.Identity));
            SearchTaskId(task.Next, ids, selector);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增子任务
        /// </summary>
        /// <param name="subTask"></param>
        internal void AddSubTask(TaskHierarchy subTask)
        {
            if (subTask == null)
            {
                throw new ArgumentNullException("subTask");
            }

            //指定子任务的父节点
            subTask.Parent = this;

            if (Subs.Count == 0)
            {
                this.Next = subTask;
            }
            else
            {
                Subs.LastOrDefault().Next = subTask;
            }

            this.Subs.Add(subTask);
        }