コード例 #1
0
    private void LoadRoleTree(Microsoft.Web.UI.WebControls.TreeNode currentNode, RoleType currentRoleType)
    {
        IList subRoleType = null;

        if (currentRoleType != null)
        {
            subRoleType = currentRoleType.SubRoleTypes;
        }
        else
        {
            subRoleType = RoleTypeSrv.GetAllTopRoleType();
        }

        //增加角色分类。
        foreach (RoleType rt in subRoleType)
        {
            Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode();
            currentNode.Nodes.Add(node);
            node.Type    = "roletype";
            node.Text    = rt.Name;
            node.PKId    = rt.Id;
            node.OrderId = rt.OrderId.ToString();

            LoadRoleTree(node, rt);

            node.Expanded = true;
        }

        currentNode.Expanded = true;
    }
コード例 #2
0
    private void LoadRoleTree(Staff s)
    {
        IList ilRoleType = RoleTypeSrv.GetAllTopRoleType();

        //增加角色分类
        foreach (RoleType rt in ilRoleType)
        {
            Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode();
            tvRoles.Nodes.Add(node);
            node.Type = "roletype";
            node.Text = rt.Name;
            node.PKId = rt.Id;

            AddSubNodes(node, rt, s);

            node.Expanded = true;
        }

        tvRoles.Nodes[0].Expanded = true;
    }
コード例 #3
0
        public ActionResult RoleTypeInfoTree()
        {
            NodeType ntype = new NodeType();

            ntype.id    = "0";
            ntype.text  = "角色分类";
            ntype.ntype = "root";
            IList ilRoleType = RoleTypeSrv.GetAllTopRoleType();
            var   ilNodeType = GetRoleTypeList(ilRoleType);

            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"));
        }
コード例 #4
0
ファイル: StaffMgrController.cs プロジェクト: zszqwe/Gecko
        public ActionResult RolesTree(string Id)
        {
            IList    ilRoleType = RoleTypeSrv.GetAllTopRoleType();
            Staff    staff      = CommonSrv.LoadObjectById(typeof(Staff), Id) as Staff;
            NodeType ntype      = new NodeType();

            ntype.id    = "0";
            ntype.text  = "角色分类";
            ntype.ntype = "root";

            var ilNodeType = GetModulePermissionList(ilRoleType, staff);

            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"));
        }