本文整理汇总了C#中Article.UpdateArticle方法的典型用法代码示例。如果您正苦于以下问题:C# Article.UpdateArticle方法的具体用法?C# Article.UpdateArticle怎么用?C# Article.UpdateArticle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article.UpdateArticle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveArticle
private Article SaveArticle(ISite site, CallingUser callingUser, Article article, string siteName, bool isNewArticle, int h2g2Id)
{
// Check: does user have edit permission
if ((!isNewArticle) && !article.HasEditPermission(callingUser))
{
throw new DnaWebProtocolException(ApiException.GetError(ErrorType.UserDoesNotHavePermissionToEditArticle));
}
// Check: profanities
bool moderateProfanities = false;
string matchingProfanity;
List<Term> terms = null;
CheckForProfanities(site, article.Subject + " " + article.GuideMLAsString, out moderateProfanities, out matchingProfanity, out terms);
// Check: url filter
if ((siteList.GetSiteOptionValueBool(site.SiteID, "General", "IsURLFiltered")) && !((callingUser.IsUserA(UserTypes.Editor) || callingUser.IsUserA(UserTypes.Notable))))
{
List<string> nonAllowedMatches = new List<string>();
UrlFilter urlFilter = new UrlFilter();
UrlFilter.FilterState result = urlFilter.CheckForURLs(article.Subject + " " + article.GuideMLAsString, nonAllowedMatches, site.SiteID, readerCreator);
if (result == UrlFilter.FilterState.Fail)
{
throw new DnaWebProtocolException(ApiException.GetError(ErrorType.ArticleContainsURLs));
}
}
// Check: email filter
if ((siteList.GetSiteOptionValueBool(site.SiteID, "Forum", "EmailAddressFilter")) && !((callingUser.IsUserA(UserTypes.Editor) || callingUser.IsUserA(UserTypes.Notable))))
{
if (EmailAddressFilter.CheckForEmailAddresses(article.Subject + " " + article.GuideMLAsString))
{
throw new DnaWebProtocolException(ApiException.GetError(ErrorType.ArticleContainsEmailAddress));
}
}
if (isNewArticle)
{
article.CreateNewArticle(cacheManager, readerCreator, callingUser.UserID, site.SiteID);
//Users subscribed to this author should have their subscribed content updated.
callingUser.UpdateUserSubscriptions(readerCreator, article.H2g2Id);
}
else // existing article
{
//Don't overwrite the existing editor of the article
int editorId = 0;
try
{
editorId = article.ArticleInfo.PageAuthor.Editor.user.UserId;
if (editorId == 0)
{
editorId = callingUser.UserID;
}
}
catch
{
editorId = callingUser.UserID;
}
article.UpdateArticle(cacheManager, readerCreator, editorId);
}
// set the archive status
if (callingUser.IsUserA(UserTypes.Editor))
{
article.SetArticleForumArchiveStatus(readerCreator, false);
}
// moderate isUserImmuneFromModeration needed
bool isSiteModerated = !(site.ModerationStatus == BBC.Dna.Moderation.Utils.ModerationStatus.SiteStatus.UnMod);
bool isUserModerated = (callingUser.IsPreModerated || callingUser.IsPostModerated);
bool isArticleModerated = ((article.ArticleInfo.ModerationStatus == BBC.Dna.Moderation.Utils.ModerationStatus.ArticleStatus.PreMod) || article.ArticleInfo.ModerationStatus == BBC.Dna.Moderation.Utils.ModerationStatus.ArticleStatus.PostMod);
bool isArticleInModeration = article.IsArticleIsInModeration(readerCreator);
bool isUserInSinbin = (callingUser.IsAutoSinBin == 1);
bool isUserImmuneFromModeration = callingUser.HasSpecialEditPermissions(article.H2g2Id);
// Queue, update moderation status and hide the guide entry.
int modID = 0;
if (!isUserImmuneFromModeration)
{
if (isSiteModerated || isUserModerated || isArticleModerated || isArticleInModeration || moderateProfanities || isUserInSinbin)
{
if (!String.IsNullOrEmpty(matchingProfanity)) { matchingProfanity = "Profanities: " + matchingProfanity; }
article.QueueForModeration(readerCreator, matchingProfanity, ref modID);
}
}
if (article.HiddenStatus == (int)BBC.Dna.Moderation.Utils.CommentStatus.Hidden.NotHidden)
{
//visible
article.UnhideArticle(readerCreator, 0, 0, callingUser.UserID);
}
else
{
//.........这里部分代码省略.........