/// <summary> /// 是否具有访问指定控制ID的权限 /// </summary> /// <param name="controlId">功能控制ID</param> /// <returns></returns> public bool HasFunction(string controlId) { bool result = false; if (string.IsNullOrEmpty(controlId)) { result = true; } else if (FunctionDict != null && FunctionDict.ContainsKey(controlId)) { result = true; } return(result); }
/// <summary> /// 注册功能到字典中 /// </summary> /// <param name="component"></param> /// <exception cref="ArgumentException">不能注册重复的功能项</exception> private void RegisterFunctionDict(FunctionComponent component) { if (!string.IsNullOrEmpty(component.FunctionKey)) { if (FunctionDict.ContainsKey(component.FunctionKey)) { throw new ArgumentException("不能注册重复的功能项"); } FunctionDict.Add(component.FunctionKey, component); } if (component.ChildFunctionItems != null) { foreach (var childFunction in component.ChildFunctionItems) { RegisterFunctionDict(childFunction); } } }