/// <summary>
        /// 获取树形页面的数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTree()
        {
            List<SystemTree> listSystemTree = new List<SystemTree>();
            
            IBLL.IDepartmentBLL db = new DepartmentBLL();
         
            DepartmentTreeNodeCollection tree = new DepartmentTreeNodeCollection();

            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);
        }
示例#2
0
        public ActionResult GetAllMetadata(string id)
        {
            DepartmentBLL m_BLL = new DepartmentBLL();
            IQueryable<Department> rows = m_BLL.GetAllMetadata(id);
            if (rows.Any())
            {//是否可以省
                return Json(new treegrid
                {
                    rows = rows.Select(s =>
                        new
                        {
                          id = s.id
					,name = s.name
					,_parentId =   s.parentid
					,state = s.Department1.Any(a => a.parentid == s.id) ? "closed" : null
					
                        }
                        ).OrderBy(o => o.id)
                });
            }
            return Content("[]");
        }
示例#3
0
 public DepartmentController(DepartmentBLL bll)
 {
     m_BLL = bll;
 }