Пример #1
0
        private void CreateTree()
        {
            List <RadTreeNode> nodeList = new List <RadTreeNode>();
            var appDomains = resview.LoadApplicationDomains();

            // var resourceTypes = view.LoadResourceTypeList();
            if (appDomains != null)
            {
                var resources = view.LoadResources(CurrentRoleId);
                List <SecurityResourceDto> submenus = new List <SecurityResourceDto>();
                if (resources != null)
                {
                    submenus = resources.Where(it => it.ResourceTypeId == 1 || it.ResourceTypeId == 0).ToList();
                }
                foreach (var appDomain in appDomains.OrderBy(it => it.Title).ToList())
                {
                    var appNode = CreateApplicationNode(appDomain);
                    appNode.Value = appDomain;

                    var submenuList = submenus.Where(it => it.AppDomainId == appDomain.ApplicationDomainId && it.ParentId == null).ToList();
                    if (submenuList != null)
                    {
                        foreach (var submenu in submenuList)
                        {
                            var submenuNode = CreateSubmenuTree(submenu, submenus);

                            if (submenuNode != null)
                            {
                                if (submenu.Checked)
                                {
                                    submenuNode.Checked = true;
                                    appNode.Checked     = true;
                                }
                                submenuNode.Value = submenu;
                                appNode.Nodes.Add(submenuNode);
                            }
                        }
                    }
                    nodeList.Add(appNode);
                }
            }

            this.radTreeViewResource.Nodes.AddRange(nodeList);
        }
Пример #2
0
        private void CreateTree()
        {
            List <RadTreeNode> nodeList = new List <RadTreeNode>();
            var appDomains = view.LoadApplicationDomains();

            // var resourceTypes = view.LoadResourceTypeList();
            if (appDomains != null)
            {
                var resources = view.LoadResources(0);

                List <SecurityResourceDto> submenus = new List <SecurityResourceDto>();
                if (resources != null)
                {
                    submenus = resources.Where(it => it.ResourceTypeId == 1 || it.ResourceTypeId == 0).ToList();
                }
                foreach (var appDomain in appDomains.OrderBy(it => it.Title).ToList())
                {
                    var appNode = CreateApplicationNode(appDomain);
                    appNode.Value = appDomain;
                    addContextMenu(appNode, MenuType.AppDomain);
                    var submenuList = submenus.Where(it => it.AppDomainId == appDomain.ApplicationDomainId && it.ParentId == null).ToList();
                    if (submenuList != null)
                    {
                        foreach (var submenu in submenuList)
                        {
                            var submenuNode = CreateSubmenuTree(submenu, submenus);
                            addContextMenu(submenuNode, (MenuType)submenu.ResourceTypeId);
                            if (submenuNode != null)
                            {
                                submenuNode.Value = submenu;
                                appNode.Nodes.Add(submenuNode);
                            }
                        }
                    }
                    nodeList.Add(appNode);
                }
            }
            //var submenu = resourceTypes.Where(it => it.Title == "submenu").FirstOrDefault();
            //if (submenu != null)
            //{

            //}
            this.radTreeViewResource.Nodes.AddRange(nodeList);
        }