コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
            }
        }