コード例 #1
0
ファイル: MenuBuilderNew.cs プロジェクト: windygu/.net-wms
        public void Build(WebDataMenu ultraMenu, ControlLibrary.Web.Language.LanguageComponent languageComponent, IDomainDataProvider _domainDataProvider)
        {
            this.GetXMLMenu();  //获取不要显示的模块
            this.GetUnVisibilityMenu(_domainDataProvider);

            if (ultraMenu == null)
            {
                return;
            }

            ultraMenu.Items.Clear();

            //BenQGuru.eMES.Common.Domain.IDomainDataProvider _domainDataProvider = BenQGuru.eMES.Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider();
            SystemSettingFacade facade = new SystemSettingFacade(_domainDataProvider);

            #region 添加报表平台菜单入口

            //获得系统参数里面的报表平台菜单入口
            string reportViewMenuCode = string.Empty;
            Domain.BaseSetting.Parameter parameter = (Domain.BaseSetting.Parameter)facade.GetParameter("REPORTMENU", "REPORTMENU");
            if (parameter != null)
            {
                reportViewMenuCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(parameter.ParameterAlias));
            }

            //获得系统参数里面的报表平台菜单Item
            DataMenuItem reportViewMenuItem = GetReportViewMenuRoot(reportViewMenuCode, languageComponent, _domainDataProvider);

            #endregion

            ITreeObjectNode rootNode = facade.BuildMenuTree();

            TreeObjectNodeSet set = rootNode.GetSubLevelChildrenNodes();
            foreach (MenuTreeNode node in set)
            {
                if (node.MenuWithUrl.MenuType.ToUpper() == MenuType.MenuType_BS.ToUpper())
                {
                    if (this.menuHT != null && this.menuHT.Contains(node.MenuWithUrl.ModuleCode))
                    {
                        continue;
                    }
                    if (this.htUnVisibilityMenu != null && this.htUnVisibilityMenu.Contains(node.MenuWithUrl.MenuCode))
                    {
                        continue;
                    }
                    ultraMenu.Items.Add(BuildUltraMenuItem(node, languageComponent, reportViewMenuCode, reportViewMenuItem));
                }
            }

            DataMenuItem item = new DataMenuItem();

            item.Text        = "";
            item.NavigateUrl = "#";

            ultraMenu.Items.Add(item);

            if (_domainDataProvider != null)
            {
                ((SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
            }
        }