当前位置: 首页>>代码示例>>C#>>正文


C# WorkItem.GetReferredSetting方法代码示例

本文整理汇总了C#中WorkItem.GetReferredSetting方法的典型用法代码示例。如果您正苦于以下问题:C# WorkItem.GetReferredSetting方法的具体用法?C# WorkItem.GetReferredSetting怎么用?C# WorkItem.GetReferredSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorkItem的用法示例。


在下文中一共展示了WorkItem.GetReferredSetting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OpenWorkItem

        //仅处理open计算逻辑
        private void OpenWorkItem(List<WorkItem> others, WorkItem current)
        {
            HumanSetting setting = current.GetReferredSetting();

            if (!setting.IsUsingSlot)
            {
                current.ChangeStatus(WorkItemStatus.Open);
                return;
            }

            //已占用的slot数量
            var opened = others.Count(o =>
                o.Status == WorkItemStatus.Open || o.Status == WorkItemStatus.Executed);
            //slot占用完后将其他状态为New任务置为NoSlot
            if (opened + 1 >= setting.SlotCount)
            {
                others.ForEach(o =>
                {
                    if (o.Status != WorkItemStatus.New) return;
                    o.ChangeStatus(WorkItemStatus.NoSlot);
                    _repository.Update(o);
                });
            }
            //没有slot可占用
            if (opened >= setting.SlotCount)
                throw new InvalidOperationException(_no_task);

            current.ChangeStatus(WorkItemStatus.Open);
        }
开发者ID:jatinbhole,项目名称:NTFE-BPM,代码行数:30,代码来源:WorkItemService.cs

示例2: Parse

        private Client.WorkItem Parse(WorkItem workItem)
        {
            var setting = workItem.GetReferredSetting();
            return new Client.WorkItem()
            {
                ID = workItem.ID,
                Actioner = workItem.Actioner.UserName,
                ArrivedTime = workItem.ArrivedTime,
                CreateTime = workItem.CreateTime,
                OriginalActioner = workItem.OriginalActioner.UserName,
                Status = (Client.WorkItemStatus)(int)workItem.Status,
                ActivityName = workItem.ActivityName,

                Actions = setting != null ? setting.Actions : new string[] { },
                //HACK:任务链接的填充目前放在外围调用系统完成,无需在此直接定死
                Url = setting != null ? setting.Url : string.Empty,

                ProcessId = workItem.Process.ID,
                ProcessTitle = workItem.Process.Title,
                ProcessCreateTime = workItem.Process.CreateTime,
                ProcessTypeName = workItem.Process.ProcessType.Name,
            };
        }
开发者ID:jatinbhole,项目名称:NTFE-BPM,代码行数:23,代码来源:TFlowEngine.cs

示例3: InvalidOperationException

        void IWorkItemService.Release(WorkItem workItem)
        {
            if (workItem.Status != WorkItemStatus.Open)
                throw new InvalidOperationException(string.Format("不能释放处于{0}状态的任务", workItem.Status));
            workItem.ChangeStatus(WorkItemStatus.New);
            _repository.Update(workItem);

            //释放任务会释放slot,需要将该节点的NoSlot的任务置为New
            if (workItem.GetReferredSetting().IsUsingSlot)
                _repository.FindWorkItemsByActivityInstance(workItem.Process, workItem.ActivityInstance)
                    .Where(o => o.Status == WorkItemStatus.NoSlot).ToList()
                    .ForEach(o =>
                    {
                        o.ChangeStatus(WorkItemStatus.New);
                        _repository.Update(workItem);
                    });
        }
开发者ID:jatinbhole,项目名称:NTFE-BPM,代码行数:17,代码来源:WorkItemService.cs


注:本文中的WorkItem.GetReferredSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。