private void LoadModuleTree(Microsoft.Web.UI.WebControls.TreeNode currentNode, ModuleType currentModuleType) { IList subModuleType = null; if (currentModuleType != null) { subModuleType = currentModuleType.SubModuleTypes; } else { subModuleType = ModuleTypeSrv.GetAllTopModuleType(); } //增加模块分类 foreach (ModuleType mt in subModuleType) { Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode(); currentNode.Nodes.Add(node); node.Type = "moduletype"; node.Text = mt.Name; node.PKId = mt.Id; node.OrderId = mt.OrderId.ToString(); LoadModuleTree(node, mt); node.Expanded = true; } currentNode.Expanded = true; }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); try { //当前职员。 string staffId = Request.QueryString["id"]; Staff staff = CommonSrv.LoadObjectById(typeof(Staff), staffId) as Staff; //权限。 SysCodeType sct = SysCodeTypeSrv.GetSysCodeTypeByTag("rights"); //生成树节点。 IList topModuleTypes = ModuleTypeSrv.GetAllTopModuleType(); foreach (ModuleType mt in topModuleTypes) { Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode(); tvRights.Nodes.Add(node); node.Type = "moduletype"; node.Text = mt.Name; AddSubNodes(node, mt, staff, sct); node.Expanded = true; } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "error", "<script type=\"text/javascript\">error=true;</script>"); log.Error(null, ex); } }
public ActionResult ModuleTypeInfoTree() { NodeType ntype = new NodeType(); ntype.id = "0"; ntype.text = "模块分类"; ntype.ntype = "root"; IList ilModuleType = ModuleTypeSrv.GetAllTopModuleType(); var ilNodeType = GetModuleTypeList(ilModuleType); ntype.children = ilNodeType; var rNodeType = new List <NodeType>(); rNodeType.Add(ntype); string jsonResult = JsonConvert.SerializeObject(rNodeType, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(Content(jsonResult, "application/json")); }
private void LoadModuleTree() { IList ilModuleType = ModuleTypeSrv.GetAllTopModuleType(); //增加模块 foreach (ModuleType mt in ilModuleType) { Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode(); tvModules.Nodes[0].Nodes.Add(node); node.Type = "moduletype"; node.Text = mt.Name; node.PKId = mt.Id; node.OrderId = mt.OrderId.ToString(); AddSubNodes(node, mt); node.Expanded = true; } tvModules.Nodes[0].Expanded = true; }
public ActionResult PermissionsTree(string Id) { Staff role = CommonSrv.LoadObjectById(typeof(Staff), Id) as Staff; //权限。 SysCodeType sct = SysCodeTypeSrv.GetSysCodeTypeByTag("rights"); NodeType ntype = new NodeType(); ntype.id = "0"; ntype.text = "模块分类"; ntype.ntype = "root"; IList ilModuleType = ModuleTypeSrv.GetAllTopModuleType(); var ilNodeType = GetModulePermissionList(ilModuleType, sct, role); ntype.children = ilNodeType; var rNodeType = new List <NodeType>(); rNodeType.Add(ntype); string jsonResult = JsonConvert.SerializeObject(rNodeType, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(Content(jsonResult, "application/json")); }
private void LoadModuleTree() { //获取当前登录的职员信息。 StaffSession ss = SessionUtil.GetStaffSession(); Staff s = CommonSrv.LoadObjectById(typeof(Staff), ss.LoginId) as Staff; //获取所有顶层模块。 IList ilModuleType = ModuleTypeSrv.GetAllTopModuleType(); //增加模块分类和模块。 foreach (ModuleType mt in ilModuleType) { Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode(); tvModules.Nodes.Add(node); node.Type = "moduletype"; node.Text = mt.Name; AddSubNodes(node, mt, s); node.Expanded = true; } //删除不必要的模块分类节点。 RemoveNeedlessModuleType(null); }