示例#1
0
        public void AddMenu(CreateMenuInfo Menu)
        {
            var key = "";

            if (!string.IsNullOrEmpty(Menu.ParentKey))
            {
                key = string.Format("{0}.Menus.{1}", Menu.ParentKey, Menu.Name);
            }
            else if (!string.IsNullOrEmpty(Menu.BusinessKey))
            {
                key = string.Format("BusinessSystem.{0}.Menus.{1}", Menu.BusinessKey, Menu.Name);
            }
            else
            {
                throw new Exception("必须指定业务系统或者父级模块的Key");
            }

            if (_DisableKey.Contains(Menu.Name))
            {
                throw new Exception(string.Format("使用了保留关键字:{0}", Menu.Name));
            }

            if (string.IsNullOrEmpty(Menu.Name))
            {
                throw new Exception("菜单Key不能为空");
            }

            var module = new ConfigEntity()
            {
                Key       = key,
                Value     = Menu.Text,
                IsDeleted = false,
                Type      = "1"
            };

            _IBaseConfig.Add(module);

            addMenuProperty(key, "href", Menu.Href);
            addMenuProperty(key, "icon", Menu.Icon);
            addMenuProperty(key, "param", Menu.Param);
            addMenuProperty(key, "permission", Menu.PermissionKey);
            addMenuProperty(key, "index", Menu.IndexValue.ToString());
        }
示例#2
0
 public void AddModule(CreateMenuInfo Module)
 {
     _IMenu.AddMenu(Module);
 }