本文整理汇总了C#中IDnaDataReader.GetDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.GetDateTime方法的具体用法?C# IDnaDataReader.GetDateTime怎么用?C# IDnaDataReader.GetDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDnaDataReader
的用法示例。
在下文中一共展示了IDnaDataReader.GetDateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNewUserEventActivity
static public SiteEvent CreateNewUserEventActivity(IDnaDataReader dataReader, IDnaDataReaderCreator creator)
{
SiteEvent siteEvent = null;
try
{
siteEvent = new SiteEvent();
siteEvent.SiteId = dataReader.GetInt32NullAsZero("siteid");
siteEvent.Date = new Date(dataReader.GetDateTime("DateCreated"));
siteEvent.Type = SiteActivityType.NewUserToSite;
siteEvent.ActivityData = XElement.Parse(
string.Format(DataFormat,
dataReader.GetInt32NullAsZero("user_userid"), dataReader.GetStringNullAsEmpty("user_username"),
dataReader.GetInt32NullAsZero("siteid"))
);
siteEvent.UserId = dataReader.GetInt32NullAsZero("user_userid");
siteEvent.SaveEvent(creator);
}
catch(Exception e)
{
siteEvent = null;
SiteEventsProcessor.SiteEventLogger.LogException(e);
}
return siteEvent;
}
示例2: CreateComplaintArticleEventActivity
static public SiteEvent CreateComplaintArticleEventActivity(IDnaDataReader dataReader, IDnaDataReaderCreator creator)
{
SiteEvent siteEvent = null;
try
{
siteEvent = new SiteEvent();
siteEvent.SiteId = dataReader.GetInt32NullAsZero("siteid");
siteEvent.Date = new Date(dataReader.GetDateTime("DateCreated"));
siteEvent.Type = SiteActivityType.ComplaintArticle;
var complainantUserName = dataReader.GetStringNullAsEmpty("complainantUserName");
if (String.IsNullOrEmpty(complainantUserName))
{
complainantUserName = "Anonymous";
}
siteEvent.ActivityData = XElement.Parse(
string.Format(DataFormat,
dataReader.GetInt32NullAsZero("complaintantID_userid"), complainantUserName,
dataReader.GetInt32NullAsZero("h2g2id"), dataReader.GetStringNullAsEmpty("subject"),
dataReader.GetStringNullAsEmpty("complainttext"))
);
siteEvent.UserId = 0;
siteEvent.SaveEvent(creator);
}
catch(Exception e)
{
siteEvent = null;
SiteEventsProcessor.SiteEventLogger.LogException(e);
}
return siteEvent;
}
示例3: CreateLinkFromReader
public static Link CreateLinkFromReader(IDnaDataReader reader)
{
Link link = new Link();
link.Type = reader.GetStringNullAsEmpty("destinationtype");
link.LinkId = reader.GetInt32NullAsZero("linkid");
link.TeamId = reader.GetInt32NullAsZero("teamid");
link.Relationship = reader.GetStringNullAsEmpty("relationship");
link.Private = reader.GetTinyIntAsInt("private");
link.Description = reader.GetStringNullAsEmpty("linkdescription");
link.DateLinked = new DateElement(reader.GetDateTime("DateLinked"));
link.Submitter = new UserElement() { user = BBC.Dna.Objects.User.CreateUserFromReader(reader, "submitter") };
//Create appropriate URL from link type.
int destinationId = reader.GetInt32NullAsZero("DestinationID");
switch (link.Type)
{
case "article":
{
link.DnaUid = "A" + destinationId.ToString();
break;
}
case "userpage":
{
link.DnaUid = "U" + destinationId.ToString();
break;
}
case "category":
{
link.DnaUid = "C" + destinationId.ToString();
break;
}
case "forum":
{
link.DnaUid = "F" + destinationId.ToString();
break;
}
case "thread":
{
link.DnaUid = "T" + destinationId.ToString();
break;
}
case "posting":
{
link.DnaUid = "TP" + destinationId.ToString();
break;
}
default: // "club" )
{
link.DnaUid = "G" + destinationId.ToString();
break;
}
}
return link;
}
示例4: GetTopicFromReader
/// <summary>
/// Gets the topic elements from the current reader.
/// </summary>
/// <param name="reader"></param>
/// <returns></returns>
static public TopicElement GetTopicFromReader(IDnaDataReader reader)
{
var topicEdit = new TopicElement();
topicEdit.TopicId = reader.GetInt32NullAsZero("topicid");
topicEdit.H2G2Id = reader.GetInt32NullAsZero("h2g2ID");
topicEdit.SiteId = reader.GetInt32NullAsZero("SiteID");
topicEdit.TopicStatus = (TopicStatus)reader.GetInt32NullAsZero("TopicStatus");
topicEdit.Title = reader.GetStringNullAsEmpty("TITLE");
topicEdit.ForumId = reader.GetInt32NullAsZero("ForumID");
topicEdit.Description = reader.GetStringNullAsEmpty("description");
topicEdit.Position = reader.GetInt32NullAsZero("position");
topicEdit.TopicLinkId = reader.GetInt32NullAsZero("topiclinkid");
topicEdit.Createdby = new TopicCreatedDate
{
CreatedDate = new DateElement(reader.GetDateTime("createddate")),
Username = reader.GetStringNullAsEmpty("CreatedByUserName"),
Userid = reader.GetInt32NullAsZero("CreatedByUserID")
};
topicEdit.Updatedby = new TopicLastUpdated()
{
LastUpdated = new DateElement(reader.GetDateTime("LastUpdated")),
Username = reader.GetStringNullAsEmpty("UpdatedByUserName"),
Userid = reader.GetInt32NullAsZero("UpdatedByUserID")
};
topicEdit.Style = reader.GetInt32NullAsZero("style");
topicEdit.ForumPostCount = reader.GetInt32NullAsZero("forumpostcount");
topicEdit.FrontPageElement.Elementid = reader.GetInt32NullAsZero("FP_ElementID");
topicEdit.FrontPageElement.Position = reader.GetInt32NullAsZero("FP_Position");
topicEdit.FrontPageElement.Title = reader.GetStringNullAsEmpty("FP_Title");
topicEdit.FrontPageElement.TemplateElement = reader.GetInt32NullAsZero("FP_Template");
topicEdit.FrontPageElement.Text = reader.GetStringNullAsEmpty("FP_Text");
topicEdit.FrontPageElement.ImageName = reader.GetStringNullAsEmpty("FP_ImageName");
topicEdit.FrontPageElement.ImageAltText = reader.GetStringNullAsEmpty("FP_ImageAltText");
topicEdit.FrontPageElement.ForumPostCount = reader.GetInt32NullAsZero("forumpostcount");
topicEdit.FrontPageElement.TopicId = reader.GetInt32NullAsZero("topicid");
topicEdit.Fastmod = reader.GetInt32NullAsZero("fastmod");
topicEdit.Editkey = reader.GetGuid("editkey");
topicEdit.FrontPageElement.Editkey = reader.GetGuid("FP_EditKey");
return topicEdit;
}
示例5: CreateExModerationEvent
public static ExModerationEvent CreateExModerationEvent(IDnaDataReader dataReader)
{
ExModerationEvent activity = PolicyInjection.Create<ExModerationEvent>();
activity.ModId = dataReader.GetInt32NullAsZero("modid");
activity.Notes = dataReader.GetString("notes") ?? "";
activity.Uri = dataReader.GetString("uri") ?? "";
activity.DateCompleted = dataReader.GetDateTime("datecompleted");
activity.Decision = dataReader.GetInt32NullAsZero("status");
activity.CallBackUri = dataReader.GetString("callbackuri") ?? "";
return activity;
}
示例6: CreateArticleModerationDecisionActivity
static public SiteEvent CreateArticleModerationDecisionActivity(IDnaDataReader dataReader, IDnaDataReaderCreator creator)
{
SiteEvent siteEventArticleModerationDecision = null;
try
{
siteEventArticleModerationDecision = new SiteEvent();
siteEventArticleModerationDecision.SiteId = dataReader.GetInt32NullAsZero("siteid");
siteEventArticleModerationDecision.Date = new Date(dataReader.GetDateTime("DateCreated"));
var statusId = dataReader.GetInt32NullAsZero("statusid");
switch ((ModerationDecisionStatus)statusId)
{
case ModerationDecisionStatus.Fail:
siteEventArticleModerationDecision.Type = SiteActivityType.ModerateArticleFailed;
siteEventArticleModerationDecision.ActivityData = XElement.Parse(
string.Format(DataFormatFailed, dataReader.GetInt32NullAsZero("h2g2id"),
dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
dataReader.GetStringNullAsEmpty("ModReason")
));
break;
case ModerationDecisionStatus.Referred:
siteEventArticleModerationDecision.Type = SiteActivityType.ModerateArticleReferred;
siteEventArticleModerationDecision.ActivityData = XElement.Parse(
string.Format(DataFormatReferred, dataReader.GetInt32NullAsZero("h2g2id"),
dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
dataReader.GetStringNullAsEmpty("Notes"))
);
break;
default:
siteEventArticleModerationDecision = null;
break;
}
siteEventArticleModerationDecision.UserId = 0;
siteEventArticleModerationDecision.SaveEvent(creator);
}
catch(Exception e)
{
siteEventArticleModerationDecision = null;
SiteEventsProcessor.SiteEventLogger.LogException(e);
}
return siteEventArticleModerationDecision;
}
示例7: SetProperties
protected override void SetProperties(IDnaDataReader reader)
{
base.SetProperties(reader);
ThreadEntryId = reader.GetNullableInt32("ThreadEntryId");
ModClassId = reader.GetInt32("ModClassId");
SiteId = reader.GetInt32("SiteId");
ForumId = reader.GetInt32("ForumId");
ThreadId = reader.GetNullableInt32("ThreadId");
UserId = reader.GetInt32("UserId");
DatePosted = reader.GetDateTime("DatePosted");
Text = reader.GetString("text");
RiskModThreadEntryQueueId = reader.GetInt32("RiskModThreadEntryQueueId");
}
示例8: SetProperties
protected override void SetProperties(IDnaDataReader reader)
{
base.SetProperties(reader);
ThreadEntryId = reader.GetInt32("ThreadEntryId");
ModClassId = reader.GetInt32("ModClassId");
SiteId = reader.GetInt32("SiteId");
ForumId = reader.GetInt32("ForumId");
ThreadId = reader.GetInt32("ThreadId");
UserId = reader.GetInt32("UserId");
NextSibling = reader.GetNullableInt32("NextSibling");
Parent = reader.GetNullableInt32("Parent");
PrevSibling = reader.GetNullableInt32("PrevSibling");
FirstChild = reader.GetNullableInt32("FirstChild");
DatePosted = reader.GetDateTime("DatePosted");
Text = reader.GetString("text");
}
示例9: OpenSocialActivityDataReaderAdapter
public OpenSocialActivityDataReaderAdapter(IDnaDataReader dataReader)
{
Body = dataReader.GetString("Body");
PostedTime = dataReader.GetDateTime("ActivityTime").MillisecondsSinceEpoch();
DisplayName = dataReader.GetString("displayName");
ObjectTitle = dataReader.GetString("ObjectTitle");
ObjectDescription =dataReader.GetString("Body");
UserName = dataReader.GetString("Username");
ApplicationActivityObjectId = dataReader.GetInt32("PostID");
var appName = dataReader.GetString("DnaUrl") ?? "";
ObjectUri = (dataReader.GetString("ObjectUriFormat") ?? "").FormatReplacementStrings(dataReader.GetInt32("ForumID"),
dataReader.GetInt32("ThreadID"), dataReader.GetInt32("PostID"), appName, dataReader.GetString("BlogUrl") ?? "",
dataReader.GetString("ObjectUri") ?? "");
ContentPermaUrl = (dataReader.GetString("ContentPermaUrl") ?? "").FormatReplacementStrings(dataReader.GetInt32("ForumID"),
dataReader.GetInt32("ThreadID"), dataReader.GetInt32("PostID"), appName, dataReader.GetString("BlogUrl") ?? "",
dataReader.GetString("ObjectUri") ?? "");
CustomActivityType = dataReader.GetString("CustomActivityType") ?? "";
}
示例10: CreateUserFromReader
//.........这里部分代码省略.........
user.TaxonomyNode= reader.GetInt32NullAsZero(prefix + "TaxonomyNode");
}
if (reader.Exists(prefix + "UserName"))
{
user.UserName = reader.GetStringNullAsEmpty(prefix + "UserName") ?? "";
}
else if (reader.Exists(prefix + "Name"))
{
user.UserName = reader.GetStringNullAsEmpty(prefix + "Name") ?? "";
}
if (user.UserName == String.Empty)
{
user.UserName = "Member " + user.UserId.ToString();
}
/* NO NO not emails
* if (reader.Exists(prefix + "Email"))
{
user.Email = reader.GetStringNullAsEmpty(prefix + "Email") ?? "";
}
*/
if (reader.Exists(prefix + "SiteSuffix"))
{
user.SiteSuffix = reader.GetStringNullAsEmpty(prefix + "SiteSuffix") ?? "";
}
if (reader.Exists(prefix + "Area"))
{
user.Area = reader.GetStringNullAsEmpty(prefix + "Area") ?? "";
}
if (reader.Exists(prefix + "Title"))
{
user.Title = reader.GetStringNullAsEmpty(prefix + "Title") ?? "";
}
if (reader.Exists(prefix + "SubQuota"))
{
user.SubQuota = reader.GetInt32NullAsZero(prefix + "SubQuota");
}
if (reader.Exists(prefix + "Allocations"))
{
user.Allocations = reader.GetInt32NullAsZero(prefix + "Allocations");
}
if (reader.Exists(prefix + "Journal"))
{
user.Journal = reader.GetInt32NullAsZero(prefix + "Journal");
}
if (reader.Exists(prefix + "Active") && !reader.IsDBNull(prefix + "Active"))
{
user.Active = reader.GetBoolean(prefix + "Active");
}
if (reader.Exists(prefix + "DateLastNotified") && reader.GetValue(prefix + "DateLastNotified") != DBNull.Value)
{
user.DateLastNotified = new DateElement(reader.GetDateTime(prefix + "DateLastNotified"));
}
if (reader.Exists(prefix + "DateJoined") && reader.GetValue(prefix + "DateJoined") != DBNull.Value)
{
user.DateJoined = new DateElement(reader.GetDateTime(prefix + "DateJoined"));
}
if (reader.Exists(prefix + "ForumPostedTo"))
{
user.ForumPostedTo = reader.GetInt32NullAsZero(prefix + "ForumPostedTo");
}
if (reader.Exists(prefix + "Masthead"))
{
user.MastHead = reader.GetInt32NullAsZero(prefix + "Masthead");
}
if (reader.Exists(prefix + "SinBin"))
{
user.SinBin = reader.GetInt32NullAsZero(prefix + "SinBin");
}
if (reader.Exists(prefix + "ForumID"))
{
user.ForumId = reader.GetInt32NullAsZero(prefix + "ForumID");
}
var siteId = 0;
if (reader.Exists("SiteID"))
{
siteId = reader.GetInt32NullAsZero("SiteID");
}
if (siteId != 0 && user.UserId != 0)
{
var userGroups = (UserGroups)SignalHelper.GetObject(typeof(UserGroups));
var groupList = userGroups.GetUsersGroupsForSite(user.UserId, siteId);
foreach (var group in groupList)
{
user.Groups.Add(new Group(){Name = group.Name.ToUpper()});
}
}
else
{
}
return (User)user;
}
示例11: SetProperties
protected virtual void SetProperties(IDnaDataReader reader)
{
EventId = reader.GetInt32("EventId");
EventType = (EventTypes)reader.GetInt32("EventType");
EventDate = reader.GetDateTime("EventDate");
}
示例12: CreatePostFromReader
public static Post CreatePostFromReader(IDnaDataReader reader)
{
Post post = new Post();
post.YourLastPost = reader.GetInt32NullAsZero("YourLastPost");
post.YourLastPostIndex = reader.GetInt32NullAsZero("YourLastPostIndex");
post.CountPosts = reader.GetInt32NullAsZero("CountPosts");
post.Thread = PostThreadInfo.CreatePostThreadInfoFromReader(reader);
if (reader["LastReply"] != DBNull.Value)
{
post.LastReply = new DateElement(reader.GetDateTime("LastReply"));
}
if (post.YourLastPost > 0)
{
if (reader["MostRecent"] != DBNull.Value)
{
post.MostRecent = new DateElement(reader.GetDateTime("MostRecent"));
}
}
post.SiteId = reader.GetInt32NullAsZero("SiteId");
post.Private = reader.GetInt32NullAsZero("Private");
post.HasReply = reader.GetInt32NullAsZero("Replies");
post.FirstPoster = new UserElement() { user = BBC.Dna.Objects.User.CreateUserFromReader(reader, "FirstPoster") };
return post;
}
示例13: GenerateForumThreadPostsXML
/// <summary>
/// Generates/fills the full forum thread posts xml document
/// </summary>
/// <param name="uid">The unique identifier for the Comment CommentBoxForum</param>
/// <param name="fromPostIndex">Start Post Index</param>
/// <param name="toPostIndex">Finish Post Index</param>
/// <param name="show">If no to and from parameters we need the number of comments to show</param>
/// <param name="dataReader">Dna Data Reader object</param>
/// <param name="title">Passed in title of the comment</param>
/// <param name="url">the passed in host page url</param>
private void GenerateForumThreadPostsXML(string uid, int fromPostIndex, int toPostIndex, int show, IDnaDataReader dataReader, string title, string url)
{
int forumPostCount;
int returnedPostCount;
ExtractPostCount(dataReader, out forumPostCount);
// Put the forum closing date into the xml
XmlNode commentBox = RootElement.SelectSingleNode("COMMENTBOX");
if (commentBox == null)
{
// Create this node
commentBox = AddElementTag(RootElement, "COMMENTBOX");
}
// Add the closing date time to the xml, if we have one
bool forumClosed = false;
bool isForumCloseDateNull = dataReader.IsDBNull("ForumCloseDate");
string existingtitle = dataReader.GetStringNullAsEmpty("commentforumtitle");
string existingurl = dataReader.GetStringNullAsEmpty("URL");
existingurl = StringUtils.EscapeAllXml(existingurl);
url = StringUtils.EscapeAllXml(url);
int forumID = dataReader.GetInt32NullAsZero("forumID");
if (!isForumCloseDateNull)
{
DateTime closeDate = dataReader.GetDateTime("ForumCloseDate");
//TODO: Write DnaComponent.AddDateElement method to encapsulate this
XmlNode endDate = AddElementTag(commentBox, "ENDDATE");
endDate.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, closeDate));
forumClosed = closeDate < DateTime.Now;
}
returnedPostCount = CreateForumThreadPosts(uid, fromPostIndex, toPostIndex, dataReader, show, forumPostCount, commentBox);
AddMoreAttribute(dataReader, forumPostCount, toPostIndex, returnedPostCount);
// Modify the CanWrite flag depending on the user or if either the site or forum are closed
UpdateCanWriteStatus(forumClosed);
//Update the comment forum title if the passed in value is changed
if (title != String.Empty && title != existingtitle)
{
UpdateCommentForumTitle(forumID, title);
XmlNodeList commentForumTitleNodes = RootElement.SelectNodes("COMMENTBOX/FORUMTHREADPOSTS/POST/COMMENTFORUMTITLE");
foreach (XmlNode commentForumTitle in commentForumTitleNodes)
{
commentForumTitle.InnerText = title;
}
}
if (url != string.Empty && url != existingurl)
{
UpdateCommentForumURL(forumID, url);
XmlNode commentForumUrlNode = RootElement.SelectSingleNode("COMMENTBOX/FORUMTHREADPOSTS");
if (commentForumUrlNode.Attributes["HOSTPAGEURL"] != null)
{
commentForumUrlNode.Attributes["HOSTPAGEURL"].InnerText = url;
}
}
}
示例14: AddCommentForumListXML
/// <summary>
/// Generates the individual Comment CommentBoxForum Xml within the Comment CommentBoxForum List xml page
/// </summary>
/// <param name="dataReader">SP containing the comment forums</param>
/// <param name="commentForumList">Parent node to attach to</param>
private void AddCommentForumListXML(IDnaDataReader dataReader, XmlNode commentForumList)
{
// start creating the comment forum structure
XmlNode commentForum = CreateElementNode("COMMENTFORUM");
AddAttribute(commentForum, "UID", dataReader.GetStringNullAsEmpty("uid"));
AddAttribute(commentForum, "FORUMID", dataReader.GetInt32NullAsZero("forumID").ToString());
AddAttribute(commentForum, "FORUMPOSTCOUNT", dataReader.GetInt32NullAsZero("forumpostcount").ToString());
AddAttribute(commentForum, "FORUMPOSTLIMIT", InputContext.GetSiteOptionValueInt("Forum", "PostLimit"));
AddAttribute(commentForum, "CANWRITE", dataReader.GetByteNullAsZero("CanWrite").ToString());
AddAttribute(commentForum, "NOTSIGNEDINUSERID", dataReader.GetInt32NullAsZero("NotSignedInUserID").ToString());
AddTextTag(commentForum, "HOSTPAGEURL", dataReader.GetStringNullAsEmpty("url"));
AddTextTag(commentForum, "TITLE", dataReader.GetStringNullAsEmpty("title"));
AddTextTag(commentForum, "MODSTATUS", dataReader.GetByteNullAsZero("ModerationStatus"));
AddTextTag(commentForum, "SITEID", dataReader.GetInt32NullAsZero("siteid"));
AddTextTag(commentForum, "FASTMOD", dataReader.GetInt32NullAsZero("fastmod"));
if (dataReader.DoesFieldExist("DateCreated") && !dataReader.IsDBNull("DateCreated"))
{
DateTime dateCreated = dataReader.GetDateTime("DateCreated");
AddElement(commentForum, "DATECREATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateCreated));
}
if (dataReader.DoesFieldExist("ForumCloseDate") && !dataReader.IsDBNull("ForumCloseDate"))
{
DateTime closeDate = dataReader.GetDateTime("ForumCloseDate");
AddElement(commentForum, "CLOSEDATE", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, closeDate));
}
if (dataReader.DoesFieldExist("LastUpdated") && !dataReader.IsDBNull("LastUpdated"))
{
DateTime dateLastUpdated = dataReader.GetDateTime("LastUpdated");
AddElement(commentForum, "LASTUPDATED", DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, dateLastUpdated));
}
int forumId = dataReader.GetInt32NullAsZero("forumID");
//get terms admin object
TermsFilterAdmin termsAdmin = TermsFilterAdmin.CreateForumTermAdmin(InputContext.CreateDnaDataReaderCreator(), _cache, forumId);
XmlDocument termNodeDoc = SerialiseToXmlDoc(termsAdmin);
string termNodeText = termNodeDoc.DocumentElement.InnerXml.ToString();
AddXmlTextTag(commentForum, "TERMS", termNodeText);
commentForumList.AppendChild(commentForum);
}
示例15: CreatePostModerationDecisionActivity
static public List<SiteEvent> CreatePostModerationDecisionActivity(IDnaDataReader dataReader, IDnaDataReaderCreator creator)
{
List<SiteEvent> siteEventList = new List<SiteEvent>();
try
{
SiteEvent siteEvent1 = null;
siteEvent1 = new SiteEvent();
siteEvent1.SiteId = dataReader.GetInt32NullAsZero("siteid");
siteEvent1.Date = new Date(dataReader.GetDateTime("DateCreated"));
var statusId = dataReader.GetInt32NullAsZero("status");
var type = "post";
if (!string.IsNullOrEmpty(dataReader.GetStringNullAsEmpty("parenturl")))
{
type = "comment";
}
switch ((ModerationDecisionStatus)statusId)
{
case ModerationDecisionStatus.Fail:
siteEvent1.Type = SiteActivityType.ModeratePostFailed;
siteEvent1.ActivityData = XElement.Parse(
string.Format(DataFormatFailed,
dataReader.GetInt32NullAsZero("forumid"), dataReader.GetInt32NullAsZero("postid"),
dataReader.GetInt32NullAsZero("threadid"), dataReader.GetStringNullAsEmpty("parenturl"), type,
dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
dataReader.GetStringNullAsEmpty("ModReason"))
);
siteEvent1.UserId = dataReader.GetInt32NullAsZero("author_userid");
siteEventList.Add(siteEvent1);
if (dataReader.GetInt32NullAsZero("complainantid") != 0)
{//complaint upheld event
var siteEvent2 = new SiteEvent();
siteEvent2.SiteId = dataReader.GetInt32NullAsZero("siteid");
siteEvent2.Date = new Date(dataReader.GetDateTime("DateCreated"));
siteEvent2.Type = SiteActivityType.ComplaintPostUpHeld;
siteEvent2.ActivityData = XElement.Parse(
string.Format(DataFormatUpHeld,
dataReader.GetInt32NullAsZero("forumid"), dataReader.GetInt32NullAsZero("postid"),
dataReader.GetInt32NullAsZero("threadid"), dataReader.GetStringNullAsEmpty("parenturl"), type,
dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
dataReader.GetStringNullAsEmpty("ModReason"))
);
siteEvent2.UserId = dataReader.GetInt32NullAsZero("complainantid");
siteEventList.Add(siteEvent2);
}
break;
case ModerationDecisionStatus.Referred:
siteEvent1.Type = SiteActivityType.ModeratePostReferred;
siteEvent1.ActivityData = XElement.Parse(
string.Format(DataFormatReferred,
dataReader.GetInt32NullAsZero("forumid"), dataReader.GetInt32NullAsZero("postid"),
dataReader.GetInt32NullAsZero("threadid"), dataReader.GetStringNullAsEmpty("parenturl"), type,
dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
dataReader.GetStringNullAsEmpty("Notes"))
);
siteEvent1.UserId = dataReader.GetInt32NullAsZero("author_userid");
siteEventList.Add(siteEvent1);
break;
case ModerationDecisionStatus.Passed:
if (dataReader.GetInt32NullAsZero("complainantid") != 0)
{//complaint rejected
if (dataReader.GetStringNullAsEmpty("complainttext").IndexOf(ComplaintStringPrefix) < 0)
{
siteEvent1.Type = SiteActivityType.ComplaintPostRejected;
siteEvent1.ActivityData = XElement.Parse(
string.Format(DataFormatReject,
dataReader.GetInt32NullAsZero("forumid"), dataReader.GetInt32NullAsZero("postid"),
dataReader.GetInt32NullAsZero("threadid"), dataReader.GetStringNullAsEmpty("parenturl"), type,
dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
dataReader.GetStringNullAsEmpty("Notes"))
);
siteEvent1.UserId = dataReader.GetInt32NullAsZero("complainantid");
siteEventList.Add(siteEvent1);
}
else
{//is a reinstate so add that event
siteEvent1.Type = SiteActivityType.ModeratePostFailedReversal;
siteEvent1.ActivityData = XElement.Parse(string.Format(DataFormatReversed,
dataReader.GetInt32NullAsZero("forumid"), dataReader.GetInt32NullAsZero("postid"),
dataReader.GetInt32NullAsZero("threadid"), dataReader.GetStringNullAsEmpty("parenturl"), type,
dataReader.GetInt32NullAsZero("author_userid"), dataReader.GetStringNullAsEmpty("author_username"),
dataReader.GetInt32NullAsZero("mod_userid"), dataReader.GetStringNullAsEmpty("mod_username"),
dataReader.GetStringNullAsEmpty("Notes"))
);
siteEvent1.UserId = dataReader.GetInt32NullAsZero("author_userid");
siteEventList.Add(siteEvent1);
}
}
break;
//.........这里部分代码省略.........