Example #1
0
        public static async Task <WfiItem> Create(
            long p_atviID,
            DateTime p_date,
            bool p_isRole,
            long p_receiver,
            string p_note,
            bool p_isBack)
        {
            WfiItem item = new WfiItem(
                ID: await AtCm.NewID(),
                AtviID: p_atviID,
                AssignKind: (p_isBack ? WfiItemAssignKind.回退 : WfiItemAssignKind.普通指派),
                Status: WfiItemStatus.活动,
                IsAccept: false,
                Sender: Kit.UserName,
                Stime: p_date,
                Ctime: p_date,
                Mtime: p_date,
                Note: p_note,
                Dispidx: await AtCm.NewSeq("sq_wfi_item"));

            if (p_isRole)
            {
                item.RoleID = p_receiver;
            }
            else
            {
                item.UserID = p_receiver;
            }
            return(item);
        }
Example #2
0
 async void OnAtvClick(object sender, ItemClickArgs e)
 {
     if (e.IsChanged)
     {
         _lvItem.Data = await AtCm.Query("流程-活动实例的工作项", new { atviID = e.Row.ID });
     }
 }
Example #3
0
 async void OnItemClick(object sender, ItemClickArgs e)
 {
     if (e.IsChanged)
     {
         _lvAtv.Data = await AtCm.Query("流程-流程实例的活动实例", new { prciID = e.Row.ID });
     }
 }
Example #4
0
 public Task <Table> GetChildrenByType(string p_typeFilter)
 {
     if (FolderID == -1)
     {
         return(AtCm.Query("个人文件-扩展名过滤根目录", new { userid = Kit.UserID, extname = p_typeFilter }));
     }
     return(AtCm.Query("个人文件-扩展名过滤子级", new { parentid = FolderID, extname = p_typeFilter }));
 }
Example #5
0
 public Task <Table> GetChildren()
 {
     if (FolderID == -1)
     {
         return(AtCm.Query("个人文件-根目录", new { userid = Kit.UserID }));
     }
     return(AtCm.Query("个人文件-所有子级", new { parentid = FolderID }));
 }
Example #6
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("选项");
        }
Example #7
0
 async void Exchange(Menu src, Menu tgt)
 {
     if (await AtCm.ExchangeDispidx(src, tgt))
     {
         LoadTreeData();
         AtCm.PromptForUpdateModel("菜单调序成功");
     }
 }
Example #8
0
        public async Task <bool> Save()
        {
            // 先保存表单数据
            if (!await _info.FormWin.Save())
            {
                return(false);
            }

            // 标题
            string name = _info.FormWin.GetPrcName();

            if (name != _info.PrcInst.Name)
            {
                _info.PrcInst.Name  = name;
                _info.FormWin.Title = name;
            }

            bool suc = true;

            if (_info.PrcInst.IsAdded)
            {
                DateTime time = Kit.Now;
                _info.PrcInst.Ctime   = time;
                _info.PrcInst.Mtime   = time;
                _info.PrcInst.Dispidx = await AtCm.NewSeq("sq_wfi_prc");

                _info.AtvInst.Ctime = time;
                _info.AtvInst.Mtime = time;

                _info.WorkItem.AcceptTime = time;
                _info.WorkItem.Dispidx    = await AtCm.NewSeq("sq_wfi_item");

                _info.WorkItem.Ctime = time;
                _info.WorkItem.Mtime = time;
                _info.WorkItem.Stime = time;
            }

            List <object> ls = new List <object>();

            if (_info.PrcInst.IsAdded || _info.PrcInst.IsChanged)
            {
                ls.Add(_info.PrcInst);
            }
            if (_info.AtvInst.IsAdded || _info.AtvInst.IsChanged)
            {
                ls.Add(_info.AtvInst);
            }
            if (_info.WorkItem.IsAdded || _info.WorkItem.IsChanged)
            {
                ls.Add(_info.WorkItem);
            }

            if (ls.Count > 0)
            {
                suc = await AtCm.BatchSave(ls, false);
            }
            return(suc);
        }
Example #9
0
 /// <summary>
 /// 执行插入方法
 /// </summary>
 /// <param name="p_elem"></param>
 async void Insert(FrameworkElement p_elem)
 {
     _sketch.SetNodePos(p_elem, this.GetRelativePosition(_sketch));
     if (p_elem is SNode node)
     {
         node.ID = await AtCm.NewID();
     }
     _sketch.Insert(p_elem);
 }
Example #10
0
File: Menu.cs Project: Daoting/dt
        async Task OnDeleting()
        {
            if (IsGroup)
            {
                int count = await AtCm.GetScalar <int>("菜单-是否有子菜单", new { parentid = ID });

                Throw.If(count > 0, "含子菜单无法删除!");
            }
        }
Example #11
0
        async void OnSave(object sender, Mi e)
        {
            if (await AtCm.Save(_fv.Data.To <Rpt>()))
            {
                _lv.Data = await AtCm.Query <Rpt>("报表-最近修改");

                AtCm.PromptForUpdateModel();
            }
        }
Example #12
0
 async void OnSave(object sender, Mi e)
 {
     if (await AtCm.Save(_fv.Data.To <Menu>()))
     {
         OnFvDataChanged(_fv, _fv.Data);
         LoadTreeData();
         AtCm.PromptForUpdateModel();
     }
 }
Example #13
0
 async void OnSave(object sender, Mi e)
 {
     if (await AtCm.Save(_fv.Data.To <Role>()))
     {
         _needRefresh = true;
         CreateRole();
         _fv.GotoFirstCell();
     }
 }
Example #14
0
 async void Load()
 {
     if (!Kit.IsPhoneUI)
     {
         Height = 600;
         Width  = 400;
     }
     _lv.Data = await AtCm.Query("流程-可启动流程", new { userid = Kit.UserID });
 }
Example #15
0
File: Role.cs Project: Daoting/dt
        async Task OnSaving()
        {
            Throw.IfNullOrEmpty(Name, "角色名称不可为空!");

            if ((IsAdded || Cells["name"].IsChanged) &&
                await AtCm.GetScalar <int>("角色-名称重复", new { name = Name }) > 0)
            {
                Throw.Msg("角色名称重复!");
            }
        }
Example #16
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, "选项重复!");
            }
        }
Example #17
0
        async Task OnSaving()
        {
            Throw.IfNullOrEmpty(ID, "权限名称不可为空!");

            if ((IsAdded || Cells["id"].IsChanged) &&
                await AtCm.GetScalar <int>("权限-名称重复", new { id = ID }) > 0)
            {
                Throw.Msg("权限名称重复!");
            }
        }
Example #18
0
 async void OnSearch(object sender, string e)
 {
     if (string.IsNullOrEmpty(_owner.TypeFilter))
     {
         _lv.Data = await AtCm.Query("文件-搜索所有文件", new { name = $"%{e}%", userid = Kit.UserID });
     }
     else
     {
         _lv.Data = await AtCm.Query("文件-搜索扩展名文件", new { name = $"%{e}%", userid = Kit.UserID, extname = _owner.TypeFilter });
     }
 }
Example #19
0
        async void RemoveUser(IEnumerable <Row> p_rows)
        {
            var         roleID = _lvRole.SelectedRow.ID;
            List <long> users  = (from r in p_rows
                                  select r.Long("userid")).ToList();

            if (users.Count > 0 && await AtCm.RemoveRoleUsers(roleID, users))
            {
                _lvUser.Data = await AtCm.Query("角色-关联用户", new { roleid = roleID });
            }
        }
Example #20
0
        public async void Show(long p_prciID, long p_prcID)
        {
            _prciID = p_prciID;

            // 查询流程模板id
            if (p_prcID <= 0)
            {
                p_prcID = await AtCm.GetScalar <long>("流程-实例id获取模板id", new { id = p_prciID });
            }

            var def = await WfFormInfo.GetPrcDef(p_prcID);

            if (string.IsNullOrEmpty(def.Diagram))
            {
                Kit.Warn("流程图模板内容为空!");
                return;
            }

            _sketch.ReadXml(def.Diagram);
            var atvs = await AtCm.Query("流程-活动实例状态", new { prciid = p_prciID });

            if (atvs.Count > 0)
            {
                foreach (var node in _sketch.Container.Children.OfType <SNode>())
                {
                    var dr = (from c in atvs
                              where c.Long("atvdid") == node.ID
                              select c).LastOrDefault();
                    if (dr != null)
                    {
                        switch (dr.Str("status"))
                        {
                        //活动
                        case "0":
                            node.BorderBrush = Res.醒目红色;
                            break;

                        //结束
                        case "1":
                            node.BorderBrush = Res.GreenBrush;
                            break;
                        }
                        node.Click += OnNodeClick;
                    }
                }
            }

            if (!Kit.IsPhoneUI)
            {
                Height = 700;
                Width  = 500;
            }
            Show();
        }
Example #21
0
        /// <summary>
        /// 判断当前活动是否完成,发送者是否为当前活动的最后一个发送者
        /// </summary>
        /// <returns></returns>
        public async Task <bool> IsFinished()
        {
            if (InstCount == 1)
            {
                return(true);
            }

            int count = await AtCm.GetScalar <int>("流程-工作项个数", new { atviid = ID });

            return((count + 1) >= InstCount);
        }
Example #22
0
        async void RemoveRole(IEnumerable <Row> p_rows)
        {
            var         userID = _lvUser.SelectedRow.ID;
            List <long> roles  = (from r in p_rows
                                  select r.Long("roleid")).ToList();

            if (roles.Count > 0 && await AtCm.RemoveUserRoles(userID, roles))
            {
                _lvRole.Data = await AtCm.Query("用户-关联角色", new { userid = userID });
            }
        }
Example #23
0
 async void OnSearch(object sender, string e)
 {
     if (e == "#全部")
     {
         LoadAll();
     }
     else if (!string.IsNullOrEmpty(e))
     {
         _lvPrv.Data = await AtCm.Query <Prv>("权限-模糊查询", new { id = $"%{e}%" });
     }
     NaviTo("权限列表");
 }
Example #24
0
        async void OnSave(object sender, Mi e)
        {
            var op = _fv.Data.To <Option>();

            if (await AtCm.Save(op))
            {
                LoadCategory();
                _lv.Data = await AtCm.Query <Option>("选项-分类选项", new { Category = op.Category });

                AtCm.PromptForUpdateModel();
            }
        }
Example #25
0
 public Task<bool> MoveFiles(IEnumerable<Row> p_files, long p_folderID)
 {
     var ls = new List<Pubfile>();
     foreach (var row in p_files)
     {
         var pf = new Pubfile(ID: row.ID);
         pf.IsAdded = false;
         pf["ParentID"] = p_folderID;
         ls.Add(pf);
     }
     return AtCm.BatchSave(ls, false);
 }
Example #26
0
        async void OnUpload(object sender, Mi e)
        {
            var files = await Kit.PickFiles();

            if (files == null || files.Count == 0)
            {
                return;
            }

            int      cnt   = 0;
            DateTime ctime = Kit.Now;

            foreach (var file in files)
            {
                Row row = new Row();
                row.AddCell("id", await AtCm.NewID());
                row.AddCell("parentid", _fileMgr.FolderID);
                row.AddCell("name", file.DisplayName);
                row.AddCell("isfolder", false);
                row.AddCell("extname", file.Ext.TrimStart('.'));
                row.AddCell <string>("info");
                row.AddCell("ctime", ctime);
                _lv.Data.Add(row);

                FileList fl;
                var      elem = _lv.GetRowUI(_lv.Data.Count - 1);
                if (elem == null || (fl = elem.FindChildByType <FileList>()) == null)
                {
                    _lv.Data.Remove(row);
                    continue;
                }

                bool suc = await fl.UploadFiles(new List <FileData> {
                    file
                });

                if (suc)
                {
                    row["info"] = fl.Data;
                    suc         = await _fileMgr.SaveFile(row);
                }

                if (!suc)
                {
                    _lv.Data.Remove(row);
                }
                else
                {
                    cnt++;
                }
            }
            Kit.Msg($"成功上传{cnt}个文件");
        }
Example #27
0
        public async void Show(string p_paramid)
        {
            Title    = p_paramid;
            _lv.Data = await AtCm.Query("参数-用户设置", new { paramid = p_paramid });

            if (!Kit.IsPhoneUI)
            {
                Width  = 500;
                Height = 400;
            }
            await ShowAsync();
        }
Example #28
0
        /// <summary>
        /// 获取活动的所有可执行用户
        /// </summary>
        /// <param name="p_atvid"></param>
        /// <returns></returns>
        async Task <Table> GetAtvUsers(long p_atvid)
        {
            Dict dt = new Dict {
                { "atvid", p_atvid }
            };

            if (await AtCm.GetScalar <int>("流程-是否活动授权任何人", dt) == 0)
            {
                return(await AtCm.Query("流程-活动的所有执行者", dt));
            }
            return(await AtCm.Query("流程-所有未过期用户"));
        }
Example #29
0
 public Task<bool> SaveFile(Row p_row)
 {
     Pubfile pf = new Pubfile(
             ID: p_row.ID,
             ParentID: FolderID,
             Name: p_row.Str("name"),
             IsFolder: false,
             ExtName: p_row.Str("extname"),
             Info: p_row.Str("info"),
             Ctime: p_row.Date("ctime"));
     return AtCm.Save(pf, false);
 }
Example #30
0
        async void OnDelUser(object sender, Mi e)
        {
            if (!await Kit.Confirm($"确认要删除[{e.Row.Str("name")}]吗?"))
            {
                Kit.Msg("已取消删除!");
                return;
            }

            if (await AtCm.DeleteBySvc(e.Data.To <User>()))
            {
                LoadAll();
            }
        }