예제 #1
0
        async void OnItemClick(object sender, ItemClickArgs e)
        {
            var op = _lv.SelectedRow.To <Option>();

            _fv.Data = await AtCm.First <Option>("选项-选项", new { Category = op.Category, Name = op.Name });

            SelectTab("选项");
        }
예제 #2
0
        async Task OnSaving()
        {
            Throw.If(string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Category), "选项名称和所属分类不可为空!");
            if (Cells["Name"].IsChanged || Cells["Category"].IsChanged)
            {
                var op = await AtCm.First <Option>("选项-选项", new { Category = Category, Name = Name });

                Throw.If(op != null, "选项重复!");
            }
        }
예제 #3
0
        public async Task <bool> Show(long p_id)
        {
            if (p_id > 0)
            {
                _fv.Data = await AtCm.First <Role>("角色-编辑", new { id = p_id });
            }
            else
            {
                CreateRole();
            }
            await ShowAsync();

            return(_needRefresh);
        }
예제 #4
0
파일: SysMenu.xaml.cs 프로젝트: Daoting/dt
        async void OnItemClick(object sender, ItemClickArgs e)
        {
            var id = e.Row.ID;

            if (id > 0)
            {
                _fv.Data = await AtCm.First <Menu>("菜单-id菜单项", new { id = id });
            }
            else
            {
                _fv.Data = _tv.FixedRoot;
            }
            NaviTo("菜单项,菜单授权");
        }
예제 #5
0
        /// <summary>
        /// 获得当前活动的回退活动
        /// </summary>
        /// <returns></returns>
        public async Task <WfiAtv> GetRollbackAtv()
        {
            Dict dt = new Dict();

            dt["prciid"]   = PrciID;
            dt["SrcAtvID"] = AtvdID;

            var atv = await AtCm.First <WfiAtv>("流程-回退活动实例", dt);

            if (atv != null && atv.Status != WfiAtvStatus.步)
            {
                // 存在同步的活动,不允许进行回退。(优先级大于设置的可以回退)
                return(atv);
            }
            return(null);
        }
예제 #6
0
        public static async Task <WfdPrc> Get(long p_id)
        {
            var dt = new Dict {
                { "prcid", p_id }
            };
            var prc = await AtCm.First <WfdPrc>("流程-编辑流程模板", dt);

            prc.Atvs = await AtCm.Query <WfdAtv>("流程-编辑活动模板", dt);

            prc.Trss = await AtCm.Query <WfdTrs>("流程-编辑迁移模板", dt);

            prc.AtvRoles = await AtCm.Query <WfdAtvrole>("流程-编辑活动授权", dt);

            prc.AttachEvent();
            return(prc);
        }
예제 #7
0
        async void OnItemClick(object sender, ItemClickArgs e)
        {
            Rpt rpt = _fv.Data.To <Rpt>();

            if (rpt != null && rpt.IsChanged)
            {
                if (!await Kit.Confirm("数据已修改,确认要放弃修改吗?"))
                {
                    return;
                }

                rpt.RejectChanges();
            }

            _fv.Data = await AtCm.First <Rpt>("报表-ID", new { id = e.Data.To <Rpt>().ID });

            SelectTab("编辑");
        }
예제 #8
0
        public async Task <bool> Show(long p_userID, bool p_enableAdd = true)
        {
            if (p_userID > 0)
            {
                _fv.Data = await AtCm.First <User>("用户-编辑", new { id = p_userID });
            }
            else
            {
                CreateUser();
            }

            if (!p_enableAdd)
            {
                _miAdd.Visibility = Visibility.Collapsed;
            }
            await ShowAsync();

            return(_needRefresh);
        }
예제 #9
0
파일: WfSendCmd.cs 프로젝트: Daoting/dt
        async Task Send()
        {
            // 先保存
            if (!await _info.CmdSave.Save())
            {
                return;
            }

            // 判断当前活动是否结束(需要多人同时完成该活动的情况)
            if (!await _info.AtvInst.IsFinished())
            {
                // 活动未结束(不是最后一人),只结束当前工作项
                await SaveWorkItem(false);

                return;
            }

            // 获得所有后续活动,包括同步
            var nextAtvs = await AtCm.Query <WfdAtv>("流程-后续活动", new { atvid = _info.AtvDef.ID });

            if (nextAtvs.Count == 0)
            {
                // 无后续活动,结束当前工作项和活动
                await SaveWorkItem(true);

                return;
            }

            bool manualSend = false;
            var  nextRecvs  = new AtvRecvs();

            foreach (var atv in nextAtvs)
            {
                switch (atv.Type)
                {
                case WfdAtvType.Normal:
                    // 普通活动
                    var recv = await LoadRecvs(atv);

                    if (recv.Recvs != null && recv.Recvs.Count > 0)
                    {
                        AtvRecv ar = new AtvRecv {
                            Def = atv, IsRole = recv.IsRole, Recvs = recv.Recvs
                        };
                        nextRecvs.Atvs.Add(ar);

                        if (recv.IsManualSend)
                        {
                            manualSend = true;
                        }
                    }
                    break;

                case WfdAtvType.Sync:
                    // 同步活动 且 可激活后续活动时
                    if (await IsActive(atv))
                    {
                        // 同步活动只支持一个后续活动!
                        var syncNext = await AtCm.First <WfdAtv>("流程-后续活动", new { atvid = atv.ID });

                        if (syncNext != null)
                        {
                            recv = await LoadRecvs(syncNext);

                            if (recv.Recvs != null && recv.Recvs.Count > 0)
                            {
                                nextRecvs.SyncAtv = new AtvSyncRecv
                                {
                                    SyncDef = atv,
                                    Def     = syncNext,
                                    IsRole  = recv.IsRole,
                                    Recvs   = recv.Recvs
                                };

                                if (recv.IsManualSend)
                                {
                                    manualSend = true;
                                }
                            }
                        }
                    }
                    break;

                case WfdAtvType.Finish:
                    // 结束活动
                    nextRecvs.FinishedAtv = new AtvFinishedRecv {
                        Def = atv
                    };
                    break;
                }
            }

            // 当后续迁移活动为独占式选择且后续活动多于一个时手动选择
            if (!manualSend &&
                _info.AtvDef.TransKind == WfdAtvTransKind.独占式选择 &&
                nextRecvs.AtvCount > 1)
            {
                manualSend = true;
            }
            _info.NextRecvs = nextRecvs;

            // 触发外部自定义执行者范围事件
            await _info.OnSending();

            // 外部可以修改接收者列表
            if (_info.NextRecvs != null && _info.NextRecvs.AtvCount > 0)
            {
                if (manualSend)
                {
                    // 手动选择后发送
                    if (await new WfSendDlg().Show(_info))
                    {
                        DoSend(true);
                    }
                }
                else
                {
                    DoSend(false);
                }
            }
            else
            {
                Kit.Warn("无后续活动接收者,请检查流程授权是否合理!");
            }
        }