/// <summary>
        /// 获取树形页面的数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTree()
        {
            List<SystemTree> listSystemTree = new List<SystemTree>();

            IBLL.ISysDepartmentBLL db = new SysDepartmentBLL();

            SysDepartmentTreeNodeCollection tree = new SysDepartmentTreeNodeCollection();

            var trees = db.GetAll().OrderBy(o => o.Id);
            if (trees != null)
            {
                string parentId = Request["parentid"];//父节点编号
                if (string.IsNullOrWhiteSpace(parentId))
                {
                    tree.Bind(trees, null, ref listSystemTree);
                }
                else
                {
                    tree.Bind(trees, parentId, ref listSystemTree);
                }
            }
            return Json(listSystemTree, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取树形页面的数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTree()
        {
            List <DataList> listSystemTree = new List <DataList>();

            IBLL.ISysDepartmentBLL db = new SysDepartmentBLL();

            SysDepartmentTreeNodeCollection tree = new SysDepartmentTreeNodeCollection();

            var trees = db.GetAll().OrderBy(o => o.Id);

            if (trees != null)
            {
                string parentId = Request["parentid"];//父节点编号
                if (string.IsNullOrWhiteSpace(parentId))
                {
                    tree.Bind(trees, null, ref listSystemTree);
                }
                else
                {
                    tree.Bind(trees, parentId, ref listSystemTree);
                }
            }
            return(Json(listSystemTree, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 获取树形页面的数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTree()
        {
            List <SystemTree> listSystemTree = new List <SystemTree>();
            string            parentId       = Request["parentid"];//父节点编号;

            using (SysDepartmentBLL db = new SysDepartmentBLL())
            {
                SysDepartmentTreeNodeCollection tree = new SysDepartmentTreeNodeCollection();
                var trees = db.GetAll().OrderBy(o => o.Sort);
                if (trees != null)
                {
                    tree.Bind(trees, parentId, ref listSystemTree);
                }
            }
            return(Json(listSystemTree, JsonRequestBehavior.AllowGet));
        }