public DataGridVM GetTree(DFDictionary dict)
        {
            var vm    = new DataGridVM();
            var di    = new DirectoryInfo(DFPub.ConfigFolder);
            var nodes = new List <WFTreeNode>();

            nodes.Add(new WFTreeNode()
            {
                id = "ROOT", pid = string.Empty, text = "所有表单"
            });

            foreach (var item in di.GetFiles("*.xml", SearchOption.AllDirectories).OrderBy(a => a.FullName))
            {
                var el = XElement.Load(item.FullName);
                if (el.Name != "Form")
                {
                    continue;
                }
                nodes.Add(new WFTreeNode()
                {
                    id   = DFPub.GetAttrValue(el, "Name"),
                    pid  = "ROOT",
                    text = string.Format("{0} {1}", DFPub.GetAttrValue(el, "Name"), DFPub.GetAttrValue(el, "Desc"))
                });
            }

            var listStatus = JsonSerializeHelper.DeserializeObject <List <WFTreeNode> >(Base64StringHelper.ConvertFromBase64String(dict["DF_TREE_VIEWSTATE"]));
            var list       = WFTreeHelper.GenerateTree("ROOT", nodes);

            // 下面这段代码就是为了处理保持客户端树的状态
            WFTreeHelper.SetStatus(nodes, listStatus);
            vm.rows = list;
            return(vm);
        }
        public DataGridVM GetTree(DFDictionary dict)
        {
            var vm         = new DataGridVM();
            var nodes      = Generate(SessionHelper.Get <FormM>("f"));
            var listStatus = JsonSerializeHelper.DeserializeObject <List <WFTreeNode> >(Base64StringHelper.ConvertFromBase64String(dict["DF_TREE_VIEWSTATE"]));
            var list       = WFTreeHelper.GenerateTree("ROOT", nodes);

            // 下面这段代码就是为了处理保持客户端树的状态
            WFTreeHelper.SetStatus(nodes, listStatus);
            vm.rows = list;
            return(vm);
        }
示例#3
0
 private List<WFTreeNode> QueryTree(DFDictionary dict)
 {
     var root = WF_M_DEPTLoader.Query("ROOT").FirstOrDefault();
     var nodes = WF_M_DEPTLoader.Query(string.Empty).OrderBy(a => a.DeptOrder.GetValueOrDefault()).Select(a => new WFTreeNode()
     {
         pid = a.PDeptId,
         id = a.DeptId,
         text = string.Format("{0} {1}", a.DeptName, a.DeptDisplayText.GetRes())
     }).ToList();
     var listStatus = JsonSerializeHelper.DeserializeObject<List<WFTreeNode>>(Base64StringHelper.ConvertFromBase64String(dict["DF_TREE_VIEWSTATE"]));
     var list = WFTreeHelper.GenerateTree("ROOT", nodes);
     WFTreeHelper.SetStatus(list, listStatus);
     return list;
 }
示例#4
0
        private List <WFTreeNode> QueryModuleTree(DFDictionary dict)
        {
            var root  = WF_M_MODULELoader.Query("ROOT").FirstOrDefault();
            var nodes = WF_M_MODULELoader.Query(string.Empty).OrderBy(a => a.ModuleOrder.GetValueOrDefault()).Select(a => new WFTreeNode()
            {
                pid  = a.PModuleId,
                id   = a.ModuleId,
                text = a.ModuleName
            }).ToList();
            var listStatus = JsonSerializeHelper.DeserializeObject <List <WFTreeNode> >(Base64StringHelper.ConvertFromBase64String(dict["DF_TREE_VIEWSTATE1"]));
            var list       = WFTreeHelper.GenerateTree("ROOT", nodes);

            WFTreeHelper.SetStatus(list, listStatus);
            return(list);
        }