예제 #1
0
        //[列表]根据传入的参数构建一组工具条按钮
        public static HtmlString ListViewButtons(this IHtmlHelper htmlHelper, ClaimsPrincipal User, List <ToolBarActionButton> Buttons)
        {
            //初始化工具条按钮的权限
            IToolBarActionButtonRight toolBarRight = htmlHelper.ViewContext as IToolBarActionButtonRight;

            if (toolBarRight != null)
            {
                toolBarRight.LoadToolBarActionButtonRight();
            }
            else
            {
                LoadToolBarActionLimit.load(htmlHelper, User);
            }
            StringBuilder toolBarBuilder = new StringBuilder();

            //输公共按钮前的按钮
            if (Buttons != null && Buttons.Count > 0)
            {
                foreach (ToolBarActionButton button in Buttons)
                {
                    if (!IsButtonRight(htmlHelper.ViewContext.FormContext, button.Name))
                    {
                        continue;
                    }
                    toolBarBuilder.AppendLine(BuilderListActionButton(button, htmlHelper.ViewContext.FormContext));
                }
            }
            return(new HtmlString(toolBarBuilder.ToString()));
        }
예제 #2
0
        //[[工具栏]]根据传入的参数构建一组工具条按钮
        public static HtmlString ListToolBarButtons(this IHtmlHelper htmlHelper, ClaimsPrincipal User, List <ToolBarActionButton> Buttons, bool isfullcreate = false)
        {
            //初始化工具条按钮的权限
            IToolBarActionButtonRight toolBarRight = htmlHelper.ViewContext as IToolBarActionButtonRight;

            if (toolBarRight != null)
            {
                toolBarRight.LoadToolBarActionButtonRight();
            }
            else
            {
                LoadToolBarActionLimit.load(htmlHelper, User);
            }
            StringBuilder toolBarBuilder = new StringBuilder();

            //输公共按钮前的按钮
            //ToolBarActionButton [] tempButtons = null;
            if (Buttons != null && Buttons.Count > 0)
            {
                foreach (ToolBarActionButton button in Buttons)
                {
                    if (!IsButtonRight(htmlHelper.ViewContext.FormContext, button.Name))
                    {
                        continue;
                    }
                    toolBarBuilder.AppendLine(BuilderToolBarActionButton(button, htmlHelper.ViewContext.FormContext));
                }
            }

            string resultHtml = "";

            if (isfullcreate && toolBarBuilder.Length != 0)
            {
                resultHtml = toolBarBuilder.ToString();
            }
            else
            {
                resultHtml = toolBarBuilder.ToString();
            }
            return(new HtmlString(resultHtml));
        }