コード例 #1
0
        //只获取有效状态的任务,包含代理的
        IEnumerable <WorkItem> IWorkItemService.GetWorkItems(User user)
        {
            WorkItemService.ThrowIfNull(user, "user");

            var list = new List <WorkItem>();

            list.AddRange(_repository.FindAllBy(user, VALID_STATUS));
            //获取代理的任务
            this._agentService.GetActings(user).ToList().ForEach(o =>
            {
                if (!o.IsValid)
                {
                    return;
                }
                list.AddRange(o.Range == ActingRange.All
                    ? _repository.FindAllBy(o.ActAs, VALID_STATUS)
                    : _repository.FindAllBy(o.ActAs, o.ActingItems.Select(p => p.ProcessTypeName).ToArray(), VALID_STATUS));
            });

            return(list.Distinct().OrderByDescending(o => o.ArrivedTime));
        }