public JsonResult RoleTreeList(FormCollection form) { List <JsonTreeNode> nodes = new List <JsonTreeNode>(); string strparentId = form["id"];// ?? "0"; int? parentId = null; if (!string.IsNullOrEmpty(strparentId)) { parentId = Convert.ToInt32(strparentId); } var list = sysManageService.GetRoles(parentId, base.UserId); foreach (var item in list) { JsonTreeNode cnode = new JsonTreeNode(); cnode.id = item.RoleID.ToString(); cnode.text = item.RoleName; cnode.value = item.RoleCode; cnode.hasChildren = item.HasChild; cnode.classes = item.IsSystem ? "system" : "normal"; nodes.Add(cnode); } return(Json(nodes)); }