/// <summary> /// 获取整个模块可用的的所有功能列表 /// </summary> /// <param name="boType"></param> /// <returns></returns> private OperationACList GetByModule(ModuleAC module) { var moduleScopeTranslated = OperationAC.ModuleScope.Translate(); var list = new OperationACList(); var m = module.Core; foreach (var op in m.CustomOpertions) { list.Add(new OperationAC { ScopeKeyLabel = moduleScopeTranslated, OperationKey = op.Name, Label = op.Label.Translate() }); } //模块的查看功能 list.Add(new OperationAC { ScopeKeyLabel = moduleScopeTranslated, OperationKey = SystemOperationKeys.Read, Label = SystemOperationKeys.Read.Translate(), }); //系统生成的界面,迭归生成功能列表 if (!m.IsCustomUI) { var blocks = UIModel.AggtBlocks.GetModuleBlocks(m); this.GetByBlocksRecur(blocks, list); } return(list); }
/// <summary> /// 递归获取某个聚合块中所有可用的操作列表 /// </summary> /// <param name="blocks"></param> /// <param name="list"></param> private void GetByBlocksRecur(AggtBlocks blocks, OperationACList list) { var mainBlock = blocks.MainBlock; //查看,编辑 list.Add(new OperationAC { ScopeKeyLabel = mainBlock.KeyLabel.Translate(), OperationKey = SystemOperationKeys.Read, Label = SystemOperationKeys.Read.Translate(), }); //list.Add(new OperationAC //{ // ScopeKeyLabel = mainBlock.KeyLabel.Translate(), // OperationKey = SystemOperationKeys.Edit, // Label = SystemOperationKeys.Edit.Translate(), //}); if (RafyEnvironment.Location.IsWebUI) { //功能按钮权限 foreach (var cmd in mainBlock.ViewMeta.AsWebView().Commands) { list.Add(new OperationAC { ScopeKeyLabel = mainBlock.KeyLabel.Translate(), OperationKey = cmd.Name, Label = cmd.Label.Translate(), }); } } else { //功能按钮权限 foreach (var cmd in mainBlock.ViewMeta.AsWPFView().Commands) { list.Add(new OperationAC { ScopeKeyLabel = mainBlock.KeyLabel.Translate(), OperationKey = cmd.Name, Label = cmd.Label.Translate(), }); } } foreach (var surrounder in blocks.Surrounders) { this.GetByBlocksRecur(surrounder, list); } foreach (var child in blocks.Children) { this.GetByBlocksRecur(child, list); } }
/// <summary> /// 获取整个模块可用的的所有功能列表 /// </summary> /// <param name="boType"></param> /// <returns></returns> private OperationACList GetByModule(ModuleAC module) { var moduleScopeTranslated = OperationAC.ModuleScope.Translate(); var list = new OperationACList(); var m = module.Core; foreach (var op in m.CustomOpertions) { list.Add(new OperationAC { ScopeKeyLabel = moduleScopeTranslated, OperationKey = op.Name, Label = op.Label.Translate() }); } //模块的查看功能 list.Add(new OperationAC { ScopeKeyLabel = moduleScopeTranslated, OperationKey = SystemOperationKeys.Read, Label = SystemOperationKeys.Read.Translate(), }); //系统生成的界面,迭归生成功能列表 if (!m.IsCustomUI) { var blocks = UIModel.AggtBlocks.GetModuleBlocks(m); this.GetByBlocksRecur(blocks, list); } return list; }
/// <summary> /// 初始化选择框:如果已经在禁用列表中,则把它的勾去除 /// </summary> /// <param name="list"></param> private void InitCheckBoxes(OperationACList list, ModuleAC curModule) { try { this._isBinding = true; this._opertaionsView.SelectAll(); var moduleKey = curModule.Core.KeyLabel; foreach (OperationAC item in list) { foreach (OrgPositionOperationDeny deny in this._denyList) { if (item.IsSame(deny)) { this._opertaionsView.SelectedEntities.Remove(item); break; } } } } finally { this._isBinding = false; } }