/// <summary> /// 获取子节点数据 /// </summary> /// <param name="pParentNodeID">父节点ID</param> /// <returns></returns> protected override TreeNodes GetNodes(string pParentNodeID) { TreeNodes nodes = new TreeNodes(); var service = new ZCourseBLL(new SessionManager().CurrentUserLoginInfo); IList <ZCourseEntity> data = new List <ZCourseEntity>(); string content = string.Empty; string key = string.Empty; if (Request("node") != null && Request("node") != string.Empty) { key = Request("node").ToString().Trim(); } if (key == "root") { key = ""; } var queryEntity = new ZCourseEntity(); queryEntity.ParentId = key; //queryEntity.ApplicationId = Request("ApplicationId"); queryEntity.OrderBy = "CourseName asc"; data = service.GetCourses(queryEntity, 0, 1000); var jsonData = new JsonData(); jsonData.totalCount = data.Count.ToString(); jsonData.data = data; var parentCode = string.Empty; if (data.Count > 0) { foreach (var item in data) { nodes.Add(item.CourseId, item.CourseName, item.ParentId, item.CourseLevel == 2 ? true : false); } } // //var root = new TreeNodes(); //root.Add(new TreeNode() { ID = "1", IsLeaf = false, Text = "1" }); //root.Add(new TreeNode() { ID = "1_1", ParentID = "1", IsLeaf = false, Text = "1_1" }); //root.Add(new TreeNode() { ID = "1_1_1", ParentID = "1_1", IsLeaf = false, Text = "1_1_1`" }); return(nodes); }
/// <summary> /// 获取列表 /// </summary> public string GetListData() { var service = new ZCourseBLL(new SessionManager().CurrentUserLoginInfo); IList <ZCourseEntity> data = new List <ZCourseEntity>(); string content = string.Empty; string key = ""; if (Request("pid") != null && Request("pid") != string.Empty) { key = Request("pid").ToString().Trim(); } data = service.GetAll(); var jsonData = new JsonData(); jsonData.totalCount = data.Count.ToString(); jsonData.data = data; content = jsonData.ToJSON(); return(content); }