本文整理汇总了C#中MrCMS.Entities.Documents.Web.Webpage类的典型用法代码示例。如果您正苦于以下问题:C# Webpage类的具体用法?C# Webpage怎么用?C# Webpage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Webpage类属于MrCMS.Entities.Documents.Web命名空间,在下文中一共展示了Webpage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TotalViewsFor
public static int TotalViewsFor(this HtmlHelper helper, Webpage webpage)
{
if (webpage == null)
return 0;
var session = helper.ViewContext.HttpContext.Get<ISession>();
AnalyticsPageView pageView = null;
AnalyticsSession analyticsSession = null;
AnalyticsUser analyticsUser = null;
IQueryOver<AnalyticsPageView, AnalyticsPageView> queryOver = session.QueryOver(() => pageView)
.JoinAlias(() => pageView.AnalyticsSession, () => analyticsSession)
.JoinAlias(() => analyticsSession.AnalyticsUser, () => analyticsUser)
.Where(x => x.Webpage.Id == webpage.Id);
PageViewResult result = null;
var viewResult = queryOver
.SelectList(builder =>
builder
.SelectGroup(() => pageView.Url)
.WithAlias(() => result.Url)
.SelectGroup(() => pageView.Webpage.Id)
.WithAlias(() => result.WebpageId)
.SelectCountDistinct(() => analyticsUser.Id)
.WithAlias(() => result.Unique)
.SelectCountDistinct(() => analyticsSession.Id)
.WithAlias(() => result.Sessions)
.SelectCountDistinct(() => pageView.Id)
.WithAlias(() => result.Total)
)
.TransformUsing(Transformers.AliasToBean<PageViewResult>())
.Take(1).SingleOrDefault<PageViewResult>();
return viewResult == null ? 0 : viewResult.Total;
}
开发者ID:neozhu,项目名称:Ecommerce,代码行数:35,代码来源:WebpageStatsExtensions.cs
示例2: RegisterAnonymousVote
private VoteResponse RegisterAnonymousVote(VoteModel voteModel, Comment comment, Webpage webpage, bool isUpvote)
{
if (comment.Votes.Any(v => v.IPAddress == voteModel.IPAddress))
{
return new VoteResponse
{
Type = CommentResponseType.Info,
Message = "Already voted",
RedirectUrl = "~/" + webpage.LiveUrlSegment
};
}
var vote = new Vote
{
IsUpvote = isUpvote,
Comment = comment,
IPAddress = voteModel.IPAddress
};
comment.Votes.Add(vote);
_session.Transact(session => session.Save(vote));
return new VoteResponse
{
Message = "Vote registered",
RedirectUrl = "~/" + webpage.LiveUrlSegment,
Type = CommentResponseType.Success
};
}
开发者ID:olegil,项目名称:Commenting,代码行数:26,代码来源:CommentVotingUiService.cs
示例3: GetRootNodes
public List<MobileFriendlyNavigationRootNode> GetRootNodes(Webpage rootWebpage)
{
using (MiniProfiler.Current.Step("Get Root Nodes"))
{
return _cacheManager.Get(
string.Format("mobile-friendly-nav.{0}.{1}", _site.Id, (rootWebpage == null ? "0" : rootWebpage.Id.ToString())), () =>
{
var rootNodes = _session.QueryOver<Webpage>()
.Where(
node => node.Parent == rootWebpage && node.RevealInNavigation && node.Published)
.OrderBy(node => node.DisplayOrder).Asc
.Cacheable()
.List();
var mobileFriendlyNavigationChildNodes = GetMobileFriendlyNavigationChildNodes(rootNodes);
var mobileFriendlyNavigationRootNodes = rootNodes
.Select(root => new MobileFriendlyNavigationRootNode
{
Id = root.Id,
Name = root.Name,
UrlSegment = root.LiveUrlSegment,
Children = GetChildNodeTransforms(mobileFriendlyNavigationChildNodes, root),
DocumentType = root.GetType().FullName,
DisplayOrder = root.DisplayOrder
}).ToList();
mobileFriendlyNavigationRootNodes = _processRootNodes.Process(mobileFriendlyNavigationRootNodes);
return mobileFriendlyNavigationRootNodes.OrderBy(node => node.DisplayOrder).ToList();
}, TimeSpan.FromMinutes(5), CacheExpiryType.Absolute);
}
}
开发者ID:neozhu,项目名称:Ecommerce,代码行数:33,代码来源:MobileFriendlyNavigationService.cs
示例4: GetAllOtherUrls
public List<UrlHistoryInfo> GetAllOtherUrls(Webpage webpage)
{
var urlHistoryInfo = new UrlHistoryInfo();
var urlHistoryInfoList =
_session.QueryOver<UrlHistory>()
.SelectList(
builder =>
builder.Select(history => history.UrlSegment)
.WithAlias(() => urlHistoryInfo.UrlSegment)
.Select(history => history.Webpage.Id)
.WithAlias(() => urlHistoryInfo.WebpageId))
.TransformUsing(Transformers.AliasToBean<UrlHistoryInfo>())
.Cacheable()
.List<UrlHistoryInfo>();
var webpageHistoryInfoList =
_session.QueryOver<Webpage>()
.SelectList(
builder =>
builder.Select(page => page.UrlSegment)
.WithAlias(() => urlHistoryInfo.UrlSegment)
.Select(page => page.Id)
.WithAlias(() => urlHistoryInfo.WebpageId))
.TransformUsing(Transformers.AliasToBean<UrlHistoryInfo>())
.Cacheable()
.List<UrlHistoryInfo>();
return urlHistoryInfoList.Union(webpageHistoryInfoList).Where(info => info.WebpageId != webpage.Id).ToList();
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:28,代码来源:UrlHistoryImportService.cs
示例5: AddCustomSiteMapData
public void AddCustomSiteMapData(Webpage webpage, XElement urlset, XDocument xmlDocument)
{
if (webpage == null)
return;
var info = GetInfo(webpage);
info.Append(webpage, urlset, xmlDocument);
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:7,代码来源:SiteMapElementAppender.cs
示例6: SetTags
public void SetTags(DocumentImportDTO documentDto, Webpage webpage)
{
List<string> tagsToAdd =
documentDto.Tags.Where(
s => !webpage.Tags.Select(tag => tag.Name).Contains(s, StringComparer.InvariantCultureIgnoreCase))
.ToList();
List<Tag> tagsToRemove =
webpage.Tags.Where(
tag => !documentDto.Tags.Contains(tag.Name, StringComparer.InvariantCultureIgnoreCase)).ToList();
foreach (string item in tagsToAdd)
{
Tag tag = GetExistingTag(item);
bool isNew = tag == null;
if (isNew)
{
tag = new Tag {Name = item};
_session.Transact(session => session.Save(tag));
}
if (!webpage.Tags.Contains(tag))
webpage.Tags.Add(tag);
if (!tag.Documents.Contains(webpage))
tag.Documents.Add(webpage);
_session.Transact(session => session.Update(tag));
}
foreach (Tag tag in tagsToRemove)
{
webpage.Tags.Remove(tag);
tag.Documents.Remove(webpage);
Tag closureTag = tag;
_session.Transact(session => session.Update(closureTag));
}
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:34,代码来源:UpdateTagsService.cs
示例7: GetAddCommentsInfo
public CommentsViewInfo GetAddCommentsInfo(Webpage webpage)
{
if (!webpage.AreCommentsEnabled(_getWebpageCommentingInfo.Get(webpage), _settings))
{
return new CommentsViewInfo { Disabled = true };
}
if (!_settings.AllowGuestComments && CurrentRequestData.CurrentUser == null)
{
return new CommentsViewInfo
{
View = "Login",
Model = new LoginModel(),
};
}
if (CurrentRequestData.CurrentUser == null)
{
return new CommentsViewInfo
{
View = "Guest",
Model = new GuestAddCommentModel { WebpageId = webpage.Id },
};
}
return new CommentsViewInfo
{
View = "LoggedIn",
Model = new LoggedInUserAddCommentModel { WebpageId = webpage.Id },
};
}
开发者ID:olegil,项目名称:Commenting,代码行数:28,代码来源:CommentsUIService.cs
示例8: UpdateCategory
private void UpdateCategory(ISession session, CategoryData categoryData, Webpage parent, HashSet<CategoryData> allData, NopImportContext nopImportContext)
{
CategoryData data = categoryData;
var suggestParams = new SuggestParams
{
DocumentType = typeof(Category).FullName,
PageName = data.Name,
UseHierarchy = true
};
var category = new Category
{
Name = data.Name,
UrlSegment = string.IsNullOrWhiteSpace(data.Url) ? _webpageUrlService.Suggest(parent, suggestParams) : data.Url,
Parent = parent,
CategoryAbstract = data.Abstract.LimitCharacters(500),
PublishOn = data.Published ? CurrentRequestData.Now.Date : (DateTime?)null,
RevealInNavigation = true
};
var mediaFile = nopImportContext.FindNew<MediaFile>(data.PictureId);
if (mediaFile != null)
{
category.FeatureImage = mediaFile.FileUrl;
}
session.Save(category);
nopImportContext.AddEntry(data.Id, category);
List<CategoryData> children = allData.Where(d => d.ParentId == data.Id).ToList();
foreach (CategoryData child in children)
{
UpdateCategory(session, child, category, allData, nopImportContext);
}
}
开发者ID:neozhu,项目名称:Ecommerce,代码行数:31,代码来源:ImportCategories.cs
示例9: ClearFormData
public void ClearFormData(Webpage webpage)
{
_session.Transact(session =>
{
webpage.FormPostings.ForEach(session.Delete);
webpage.FormPostings.Clear();
});
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:FormAdminService.cs
示例10: GetFacets
public override IEnumerable<SEOAnalysisFacet> GetFacets(Webpage webpage, HtmlNode document, string analysisTerm)
{
string url = webpage.AbsoluteUrl;
yield return
url.Replace("-", " ").Contains(analysisTerm, StringComparison.OrdinalIgnoreCase)
? GetFacet("URL contains term", SEOAnalysisStatus.Success, "The URL contains '" + analysisTerm + "'")
: GetFacet("URL contains term", SEOAnalysisStatus.Error, "The URL does not contain '" + analysisTerm + "'");
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:URLContainsTerm.cs
示例11: ShouldExclude
public bool ShouldExclude(Webpage webpage)
{
if (webpage == null)
return true;
return _siteSettings.Error403PageId == webpage.Id
|| _siteSettings.Error404PageId == webpage.Id
|| _siteSettings.Error500PageId == webpage.Id;
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:ExcludeFromSitemapBecauseIsErrorPage.cs
示例12: GetFacets
public override IEnumerable<SEOAnalysisFacet> GetFacets(Webpage webpage, HtmlNode document, string analysisTerm)
{
var elements = document.GetElementsOfType("h1");
if (elements.Count() > 1)
yield return
GetFacet("Document contains multiple H1 tags", SEOAnalysisStatus.Error,
"There should only be one H1 tag in a document.");
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:SingleH1Tag.cs
示例13: GetPageTemplateLayout
private static Layout GetPageTemplateLayout(Webpage webpage)
{
if (webpage.PageTemplate != null && webpage.PageTemplate.Layout != null)
{
return webpage.PageTemplate.Layout;
}
return null;
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:GetCurrentLayout.cs
示例14: RenderForm
public string RenderForm(Webpage webpage, FormSubmittedStatus submitted)
{
if (webpage == null)
return string.Empty;
return string.IsNullOrWhiteSpace(webpage.FormDesign)
? _defaultFormRenderer.GetDefault(webpage, submitted)
: _customFormRenderer.GetForm(webpage, submitted);
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:FormRenderingManager.cs
示例15: UpdateUrlHistories
private void UpdateUrlHistories(Webpage webpage, List<string> urlsToAdd, List<UrlHistory> urlsToRemove)
{
_session.Transact(session =>
{
AddUrls(webpage, urlsToAdd, session);
RemoveUrls(webpage, urlsToRemove, session);
});
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:9,代码来源:UpdateUrlHistoryService.cs
示例16: GetForm
public TagBuilder GetForm(Webpage webpage)
{
var tagBuilder = new TagBuilder("form");
tagBuilder.Attributes["method"] = "POST";
tagBuilder.Attributes["enctype"] = "multipart/form-data";
tagBuilder.Attributes["action"] = string.Format("/save-form/{0}", webpage.Id);
return tagBuilder;
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:9,代码来源:DefaultFormRenderer.cs
示例17: GetSecondary
public IEnumerable<string> GetSecondary(Webpage webpage)
{
Tag tagAlias = null;
var documentTags = _session.QueryOver<Webpage>()
.Where(page => page.Id == webpage.Id)
.JoinAlias(page => page.Tags, () => tagAlias)
.Select(page => tagAlias.Name).List<string>();
return GetSecondaryTerms(webpage, documentTags);
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:9,代码来源:GetCoreWebpageSearchTerms.cs
示例18: ShouldAppend
public bool ShouldAppend(Webpage webpage)
{
if (webpage == null)
return false;
if (_exclusionReasons.Any(sitemap => sitemap.ShouldExclude(webpage)))
return false;
var info = GetInfo(webpage);
return info.ShouldAppend(webpage);
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:9,代码来源:SiteMapElementAppender.cs
示例19: GetSecondaryTerms
private IEnumerable<string> GetSecondaryTerms(Webpage webpage, IEnumerable<string> tags)
{
yield return webpage.BodyContent;
yield return webpage.UrlSegment;
foreach (string tag in tags)
{
yield return tag;
}
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:9,代码来源:GetCoreWebpageSearchTerms.cs
示例20: RemoveUrls
private static void RemoveUrls(Webpage webpage, List<UrlHistory> urlsToRemove, ISession session)
{
foreach (UrlHistory history in urlsToRemove)
{
webpage.Urls.Remove(history);
history.Webpage = null;
UrlHistory closureHistory = history;
session.Update(closureHistory);
}
}
开发者ID:neozhu,项目名称:MrCMS,代码行数:10,代码来源:UpdateUrlHistoryService.cs
注:本文中的MrCMS.Entities.Documents.Web.Webpage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论