//------------------------------------------------------------------------------------------------- private static ForumTopic getTopicBySticky(StickyTopic st, long ownerId, string ownerType, string ownerUrl) { ForumTopic topic = new ForumTopic(); topic.Id = st.Id; topic.Title = st.Title; topic.Creator = new wojilu.Members.Users.Domain.User() { Name = st.CreatorName, Url = st.CreatorUrl }; topic.CreatorUrl = st.CreatorUrl; topic.Created = cvt.ToTime(st.Created); topic.Replies = st.Replies; topic.Hits = st.Views; topic.Replied = cvt.ToTime(st.LastUpdated); topic.RepliedUserName = st.LastUserName; topic.RepliedUserFriendUrl = st.LastUserUrl; topic.OwnerId = ownerId; topic.OwnerType = ownerType; topic.OwnerUrl = ownerUrl; topic.IsGlobalSticky = true; return(topic); }
public static string MoveDown(string json, long topicId) { List <StickyTopic> topics = GetTopics(json); StickyTopic t = getById(topics, topicId); SortUtil <StickyTopic> s = new SortUtil <StickyTopic>(t, topics); s.MoveDown(); return(Json.ToStringList(s.GetOrderedList())); }
public static String MoveDown(String json, int topicId) { List <StickyTopic> topics = GetTopics(json); StickyTopic t = getById(topics, topicId); SortUtil <StickyTopic> s = new SortUtil <StickyTopic>(t, topics); s.MoveDown(); return(SimpleJsonString.ConvertList(s.GetOrderedList())); }
private static Boolean needRemove(List <ForumTopic> newStickTopics, StickyTopic st) { foreach (ForumTopic ft in newStickTopics) { if (ft.Id == st.Id) { return(true); } } return(false); }
private static StickyTopic getStickyTopic(ForumTopic ft) { StickyTopic t = new StickyTopic(); t.Id = ft.Id; t.Title = ft.Title; t.CreatorName = ft.Creator.Name; t.CreatorUrl = ft.CreatorUrl; t.Created = ft.Created.ToString(); t.Replies = ft.Replies; t.Views = ft.Hits; t.LastUserName = ft.RepliedUserName; t.LastUserUrl = ft.RepliedUserFriendUrl; t.LastUpdated = ft.Replied.ToString(); return(t); }
private static List <StickyTopic> mergeData(List <StickyTopic> stickyList, List <ForumTopic> newTopics) { // 已有的不加,没有的再加上 List <StickyTopic> results = new List <StickyTopic>(); results.AddRange(stickyList); foreach (ForumTopic t in newTopics) { if (!isTopicFound(stickyList, t)) { StickyTopic topic = getStickyTopic(t); results.Add(topic); } } return(results); }
public int CompareTo(object obj) { StickyTopic target = (StickyTopic)obj; return(target.OrderId >= this.OrderId ? 1 : -1); }
private static Boolean needRemove( List<ForumTopic> newStickTopics, StickyTopic st ) { foreach (ForumTopic ft in newStickTopics) { if (ft.Id == st.Id) return true; } return false; }
//------------------------------------------------------------------------------------------------- private static ForumTopic getTopicBySticky( StickyTopic st, int ownerId, String ownerType, String ownerUrl ) { ForumTopic topic = new ForumTopic(); topic.Id = st.Id; topic.Title = st.Title; topic.Creator = new wojilu.Members.Users.Domain.User() { Name = st.CreatorName, Url = st.CreatorUrl }; topic.CreatorUrl = st.CreatorUrl; topic.Created = cvt.ToTime( st.Created ); topic.Replies = st.Replies; topic.Hits = st.Views; topic.Replied = cvt.ToTime( st.LastUpdated ); topic.RepliedUserName = st.LastUserName; topic.RepliedUserFriendUrl = st.LastUserUrl; topic.OwnerId = ownerId; topic.OwnerType = ownerType; topic.OwnerUrl = ownerUrl; topic.IsGlobalSticky = true; return topic; }
private static StickyTopic getStickyTopic( ForumTopic ft ) { StickyTopic t = new StickyTopic(); t.Id = ft.Id; t.Title = ft.Title; t.CreatorName = ft.Creator.Name; t.CreatorUrl = ft.CreatorUrl; t.Created = ft.Created.ToString(); t.Replies = ft.Replies; t.Views = ft.Hits; t.LastUserName = ft.RepliedUserName; t.LastUserUrl = ft.RepliedUserFriendUrl; t.LastUpdated = ft.Replied.ToString(); return t; }