Пример #1
0
 public static MvcHtmlString EditLink <T>(this HtmlHelper <PagedData <T> > htmlHelper, T model) where T : IModelWithCode
 {
     return(htmlHelper.AuthorizedActionLink("编辑", "Edit", new
     {
         code = model.Code
     }, new
     {
         @class = "modify"
     }));
 }
Пример #2
0
 public static MvcHtmlString DeleteLink <T>(this HtmlHelper <PagedData <T> > htmlHelper, T model) where T : IModelWithCode
 {
     return(htmlHelper.AuthorizedActionLink("删除", "Delete", new
     {
         code = model.Code
     }, new
     {
         @class = "delete",
         title = model.ToString()
     }));
 }
Пример #3
0
 public static MvcHtmlString DetailsLink <T>(this HtmlHelper <PagedData <T> > htmlHelper, T model) where T : IModelWithCode
 {
     return(htmlHelper.AuthorizedActionLink("查看", "Details", new
     {
         code = model.Code,
         controller = typeof(T).Name.Replace("Controller", "")
     }, new
     {
         @class = "details"
     }));
 }
        public static MvcHtmlString AuthorizedActionLinkIf(this HtmlHelper htmlHelper, bool condition, string linkText, string actionName, object routeValues = null, object htmlAttributes = null)
        {
            MvcHtmlString result;

            if (condition)
            {
                result = htmlHelper.AuthorizedActionLink(linkText, actionName, routeValues, htmlAttributes);
            }
            else
            {
                result = MvcHtmlString.Empty;
            }
            return(result);
        }
Пример #5
0
        public static MvcHtmlString CancelLink <T>(this HtmlHelper <T> htmlHelper) where T : IModelWithCode
        {
            string arg_34_1 = "取消";
            string arg_34_2 = "Cancel";
            T      model    = htmlHelper.ViewData.Model;

            return(htmlHelper.AuthorizedActionLink(arg_34_1, arg_34_2, new
            {
                code = model.Code
            }, new
            {
                @class = "button"
            }));
        }
        public static MvcHtmlString AuthorizedActionLink <TModel, TMember>(this HtmlHelper <TModel> htmlHelper, System.Linq.Expressions.Expression <System.Func <TModel, TMember> > expresion, string action, string controller = null, object routeValues = null, object htmlAttributes = null)
        {
            MvcHtmlString text = htmlHelper.DisplayValueFor(htmlHelper.ViewData.Model, expresion);
            MvcHtmlString result;

            if (MvcHtmlString.IsNullOrEmpty(text))
            {
                result = MvcHtmlString.Empty;
            }
            else
            {
                result = htmlHelper.AuthorizedActionLink(text.ToHtmlString(), action, controller, routeValues, htmlAttributes);
            }
            return(result);
        }
        public static MvcHtmlString AuthorizedActionLinkOrPlainText(this HtmlHelper helper, string linkText, string action, string controller = null, System.Web.Routing.RouteValueDictionary routeValue = null, System.Collections.Generic.IDictionary <string, object> htmlAttributes = null)
        {
            MvcHtmlString s = helper.AuthorizedActionLink(linkText, action, controller, routeValue, htmlAttributes);
            MvcHtmlString result;

            if (MvcHtmlString.IsNullOrEmpty(s))
            {
                result = MvcHtmlString.Create(helper.Encode(linkText));
            }
            else
            {
                result = s;
            }
            return(result);
        }
Пример #8
0
        public static MvcHtmlString AuthorizedMenuItem(this HtmlHelper helper, string linkText, string action, string controller, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary <string, object> htmlAttributes = null)
        {
            MvcHtmlString link = helper.AuthorizedActionLink(linkText, action, controller, routeValues, htmlAttributes);
            MvcHtmlString result;

            if (link == MvcHtmlString.Empty)
            {
                result = MvcHtmlString.Empty;
            }
            else
            {
                TagBuilder builer = new TagBuilder("li")
                {
                    InnerHtml = link.ToHtmlString()
                };
                result = MvcHtmlString.Create(builer.ToString());
            }
            return(result);
        }
Пример #9
0
        public static MvcHtmlString PrintLink <T>(this HtmlHelper <T> htmlHelper) where T : IModelWithCode
        {
            T             model = htmlHelper.ViewData.Model;
            MvcHtmlString result;

            if (model == null)
            {
                result = MvcHtmlString.Empty;
            }
            else
            {
                result = htmlHelper.AuthorizedActionLink("打印", "Print", new
                {
                    code = model.Code
                }, new
                {
                    @class = "button"
                });
            }
            return(result);
        }
 public static MvcHtmlString AuthorizedActionLink <TController>(this HtmlHelper helper, string linkText, string action) where TController : IController
 {
     return(helper.AuthorizedActionLink(linkText, action, null, null));
 }
 public static MvcHtmlString AuthorizedActionLink <TController>(this HtmlHelper helper, string linkText, string action, object routeValues = null, object htmlAttributes = null) where TController : IController
 {
     return(helper.AuthorizedActionLink(linkText, action, typeof(TController).Name.Replace("Controller", ""), routeValues, htmlAttributes));
 }
 public static MvcHtmlString AuthorizedActionLink(this HtmlHelper htmlHelper, string linkText, string actionName)
 {
     return(htmlHelper.AuthorizedActionLink(linkText, actionName, null, new System.Web.Routing.RouteValueDictionary(), new System.Web.Routing.RouteValueDictionary()));
 }
 public static MvcHtmlString AuthorizedActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, object routeValues, object htmlAttributes)
 {
     return(htmlHelper.AuthorizedActionLink(linkText, actionName, controllerName, new System.Web.Routing.RouteValueDictionary(routeValues), new System.Web.Routing.RouteValueDictionary(htmlAttributes)));
 }
 public static MvcHtmlString AuthorizedActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, System.Web.Routing.RouteValueDictionary routeValues, System.Collections.Generic.IDictionary <string, object> htmlAttributes)
 {
     return(htmlHelper.AuthorizedActionLink(linkText, actionName, null, routeValues, htmlAttributes));
 }