Exemple #1
0
        MenuItemEx ConvertToEx(We7.CMS.Common.MenuItem menuItem, string keyword, int state)
        {
            if (state < 100)
            {
                if (state != menuItem.Type)
                {
                    return(null);
                }
                else if (!string.IsNullOrEmpty(keyword) && menuItem.Name.IndexOf(keyword) == -1)
                {
                    return(null);
                }
            }

            MenuItemEx menuItemEx = new MenuItemEx();

            menuItemEx.Import(menuItem);
            if (menuItem.Type == 99)
            {
                menuItemEx.MenuType             = "用户自定义菜单";
                menuItemEx.MenuDelVisble        = "";
                menuItemEx.MenuSystemVisble     = "none";
                menuItemEx.MenuSystemShowVisble = "none";
                menuItemEx.MenuDelUrl           = String.Format("javascript:DeleteConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            else if (menuItem.Type == 2)
            {
                menuItemEx.MenuType             = "隐藏菜单";
                menuItemEx.MenuDelVisble        = "none";
                menuItemEx.MenuSystemVisble     = "none";
                menuItemEx.MenuSystemShowVisble = "";
                menuItemEx.MenuSystemShowUrl    = String.Format("javascript:ShowConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            else
            {
                menuItemEx.MenuType             = "系统菜单";
                menuItemEx.MenuDelVisble        = "none";
                menuItemEx.MenuSystemVisble     = "";
                menuItemEx.MenuSystemShowVisble = "none";
                menuItemEx.MenuSystemUrl        = String.Format("javascript:HideConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            return(menuItemEx);
        }
        MenuItemEx ConvertToEx(We7.CMS.Common.MenuItem menuItem, string keyword, int state)
        {
            if (state < 100)
            {
                if (state != menuItem.Type)
                {
                    return(null);
                }
                else if (!string.IsNullOrEmpty(keyword) && menuItem.Name.IndexOf(keyword) == -1)
                {
                    return(null);
                }
            }

            MenuItemEx menuItemEx = new MenuItemEx();

            menuItemEx.Import(menuItem);
            string suffix = "";

            switch (menuItem.MenuType)
            {
            case 0:
                suffix = "(普通)";
                break;

            case 1:
                suffix = "(顶级)";
                break;

            case 2:
                suffix = "(分组)";
                break;

            case 3:
                suffix = "(引用)";
                break;

            default:
                suffix = "(普通)";
                break;
            }
            if (menuItem.Type == 99)
            {
                menuItemEx.MenuType             = "用户自定义菜单" + suffix;
                menuItemEx.MenuDelVisble        = "";
                menuItemEx.MenuSystemVisble     = "none";
                menuItemEx.MenuSystemShowVisble = "none";
                menuItemEx.MenuDelUrl           = String.Format("javascript:DeleteConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            else if (menuItem.Type == 2)
            {
                menuItemEx.MenuType             = "隐藏菜单" + suffix;
                menuItemEx.MenuDelVisble        = "none";
                menuItemEx.MenuSystemVisble     = "none";
                menuItemEx.MenuSystemShowVisble = "";
                menuItemEx.MenuSystemShowUrl    = String.Format("javascript:ShowConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            else
            {
                menuItemEx.MenuType             = "系统菜单" + suffix;
                menuItemEx.MenuDelVisble        = "none";
                menuItemEx.MenuSystemVisble     = "";
                menuItemEx.MenuSystemShowVisble = "none";
                menuItemEx.MenuSystemUrl        = String.Format("javascript:HideConfirm('{0}','{1}');", menuItem.ID, menuItem.Name);
            }
            return(menuItemEx);
        }