示例#1
0
        public IMenu[] Build()
        {
            this.GetUnVisibilityMenu(ApplicationService.Current().DataProvider);

            SystemSettingFacade facade = new SystemSettingFacade(ApplicationService.Current().DataProvider);
            bool   bIsAdmin            = false;
            string strUserCode         = ApplicationService.Current().UserCode;

            if (strUserCode.ToUpper() == "ADMIN")
            {
                bIsAdmin = true;
            }
            else
            {
                for (int i = 0; ApplicationService.Current().LoginInfo.UserGroups != null && i < ApplicationService.Current().LoginInfo.UserGroups.Length; i++)
                {
                    if (((UserGroup)ApplicationService.Current().LoginInfo.UserGroups[i]).UserGroupType == "ADMIN")
                    {
                        bIsAdmin = true;
                        break;
                    }
                }
            }
            if (bIsAdmin == true)
            {
                strUserCode = string.Empty;
            }

            ITreeObjectNode rootNode = facade.BuildMenuTreePDA(strUserCode);

            TreeObjectNodeSet set = rootNode.GetSubLevelChildrenNodes();

            ArrayList listMenu = new ArrayList();

            foreach (MenuTreeNode node in set)
            {
                if (node.MenuWithUrl.MenuType.ToUpper() == MenuType.MenuType_PDA.ToUpper())
                {
                    if (this.menuHT != null && this.menuHT.Contains(node.MenuWithUrl.ModuleCode))
                    {
                        continue;
                    }
                    if (this.htUnVisibilityMenu != null && this.htUnVisibilityMenu.Contains(node.MenuWithUrl.MenuCode))
                    {
                        continue;
                    }
                    listMenu.Add(BuildUltraMenuItem(node));
                }
            }

            if (listMenu.Count > 0)
            {
                MenuCommand[] menuList = new MenuCommand[listMenu.Count];
                listMenu.CopyTo(menuList);
                return(menuList);
            }
            return(null);
        }