本文整理汇总了C#中System.Web.Routing.RequestContext.GetRequestValue方法的典型用法代码示例。如果您正苦于以下问题:C# RequestContext.GetRequestValue方法的具体用法?C# RequestContext.GetRequestValue怎么用?C# RequestContext.GetRequestValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Routing.RequestContext
的用法示例。
在下文中一共展示了RequestContext.GetRequestValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MatchProvider
private static bool MatchProvider(MvcRoute applyTo, RequestContext requestContext)
{
var area = AreaHelpers.GetAreaName(requestContext.RouteData);
var controller = requestContext.GetRequestValue("controller");
var action = requestContext.GetRequestValue("action");
var matched = applyTo.Area.EqualsOrNullEmpty(area, StringComparison.OrdinalIgnoreCase)
&& applyTo.Controller.Equals(controller, StringComparison.OrdinalIgnoreCase)
&& applyTo.Action.EqualsOrNullEmpty(action, StringComparison.OrdinalIgnoreCase);
if (matched && applyTo.RouteValues != null)
{
foreach (var item in applyTo.RouteValues)
{
if (item.Value == null)
{
continue;
}
var routeValue = requestContext.GetRequestValue(item.Key);
if (routeValue == null)
{
matched = false;
break;
}
if (!item.Value.ToString().EqualsOrNullEmpty(routeValue.ToString(), StringComparison.OrdinalIgnoreCase))
{
matched = false;
break;
}
}
}
return matched;
}
示例2: GetSelectListItems
public IEnumerable<SelectListItem> GetSelectListItems(RequestContext requestContext, string filter)
{
var siteName = requestContext.GetRequestValue("siteName");
if (string.IsNullOrEmpty(siteName))
{
siteName = requestContext.GetRequestValue("parent");
}
if (!string.IsNullOrEmpty(siteName))
{
var site = new Site(siteName);
foreach (var item in ThemeFileManager.AllThemes(site))
{
yield return new SelectListItem() { Text = item, Value = item };
}
}
}
示例3: CreateSelectItemTreeNode
protected override void CreateSelectItemTreeNode(RequestContext requestContext, Page page, List<System.Web.Mvc.SelectListItem> list)
{
string uuid = requestContext.GetRequestValue("UUID");
if (uuid.ToLower() != page.UUID.ToLower())
{
base.CreateSelectItemTreeNode(requestContext,page, list);
}
}
示例4: GetSite
private static Site GetSite(RequestContext requestContext)
{
var siteName = requestContext.GetRequestValue("siteName");
if (!string.IsNullOrEmpty(siteName))
{
return SiteHelper.Parse(siteName);
}
return null;
}
示例5: GetSelectListItems
public IEnumerable<System.Web.Mvc.SelectListItem> GetSelectListItems(RequestContext requestContext, string filter)
{
var site = new Site(requestContext.GetRequestValue("siteName"));
var categories = Kooboo.CMS.Sites.Services.ServiceFactory.LabelManager.GetCategories(site).Where(it => !string.IsNullOrEmpty(it.Category));
if (!string.IsNullOrEmpty(filter))
{
categories = categories.Where(it => it.Category.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase));
}
return categories.Select(it => new SelectListItem() { Text = it.Category, Value = it.Category });
}
示例6: GetSelectListItems
public IEnumerable<System.Web.Mvc.SelectListItem> GetSelectListItems(RequestContext requestContext, string filter)
{
var site = Site.Current;
var fullName = requestContext.GetRequestValue("fullName");
var page = Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.Get(site, fullName);
Layout layout = Kooboo.CMS.Sites.Services.ServiceFactory.LayoutManager.Get(site, page.Layout);
var positionList = layout.Positions;
foreach (var position in positionList)
{
yield return new System.Web.Mvc.SelectListItem() { Value = position.ID, Text = position.ID };
}
}
示例7: CreateSelectItemTreeNode
protected override void CreateSelectItemTreeNode(RequestContext requestContext, Page page, List<System.Web.Mvc.SelectListItem> list)
{
string uuid = requestContext.GetRequestValue("UUID");
var sourcePage = new Page(page.Site, uuid);
var item = new SelectListItem();
if (sourcePage != page && sourcePage.Parent != page)
{
item.Text = page.FriendlyName;
item.Value = page.FullName;
list.Add(item);
}
var children = ServiceFactory.PageManager.ChildPages(Site.Current, page.FullName, null);
children.ForEach((p, index) =>
{
CreateSelectItemTreeNode(requestContext, p, list);
});
}
示例8: GetSite
private Site GetSite(RequestContext requestContext)
{
var siteName = requestContext.GetRequestValue("siteName");
if (!string.IsNullOrEmpty(siteName))
{
var site = new Site(siteName).AsActual();
return site;
}
return null;
}
示例9: GetPage
private Page GetPage(Site site, RequestContext requestContext)
{
var pageName = requestContext.GetRequestValue("UUID");
if (!string.IsNullOrEmpty(pageName))
{
var page = new Page(site, pageName).AsActual();
return page;
}
return null;
}
示例10: CreateItem
private static SelectListItemTree CreateItem(SiteNode siteNode, RequestContext requestContext)
{
if (siteNode == null)
{
return new SelectListItemTree();
}
var selectListItem = new SelectListItemTree();
var site = Kooboo.CMS.Sites.Models.IPersistableExtensions.AsActual(siteNode.Site);
selectListItem.Text = string.IsNullOrEmpty(site.DisplayName) ? site.Name : site.DisplayName;
selectListItem.Value = site.FullName;
string parent = requestContext.GetRequestValue("parent");
selectListItem.Selected = site.FullName.EqualsOrNullEmpty(parent, StringComparison.CurrentCultureIgnoreCase);
var children = siteNode.Children;
var items = new List<SelectListItemTree>();
foreach (var c in children)
{
items.Add(CreateItem(c, requestContext));
}
selectListItem.Items = items;
return selectListItem;
}
示例11: GetSelectListItems
public IEnumerable<SelectListItem> GetSelectListItems(RequestContext requestContext, string filter)
{
var siteName = requestContext.GetRequestValue("siteName");
if (string.IsNullOrEmpty(siteName))
{
siteName = requestContext.GetRequestValue("parent");
}
if (!string.IsNullOrEmpty(siteName))
{
var site = SiteHelper.Parse(siteName);
foreach (var item in ServiceFactory.ThemeManager.All(site, ""))
{
yield return new SelectListItem() { Text = item.Name, Value = item.Name };
}
}
}