public GetSubscribedTopics ( int portalId, int moduleId, int userId, string forumIds, int rowIndex, int maxRows ) : IEnumerable |
||
portalId | int | |
moduleId | int | |
userId | int | |
forumIds | string | |
rowIndex | int | |
maxRows | int | |
Результат | IEnumerable |
private XmlRpcStruct GetSubscribedTopics(int startIndex, int endIndex) { var aftContext = ActiveForumsTapatalkModuleContext.Create(Context); if (aftContext == null || aftContext.Module == null) throw new XmlRpcFaultException(100, "Invalid Context"); Context.Response.AddHeader("Mobiquo_is_login", aftContext.UserId > 0 ? "true" : "false"); var portalId = aftContext.Module.PortalID; var forumModuleId = aftContext.ModuleSettings.ForumModuleId; var userId = aftContext.UserId; // Build a list of forums the user has access to var fc = new AFTForumController(); var forumIds = fc.GetForumsForUser(aftContext.ForumUser.UserRoles, portalId, forumModuleId, "CanRead"); var mainSettings = new SettingsInfo { MainSettings = new Entities.Modules.ModuleController().GetModuleSettings(forumModuleId) }; var profilePath = string.Format("{0}://{1}{2}", Context.Request.Url.Scheme, Context.Request.Url.Host, VirtualPathUtility.ToAbsolute("~/profilepic.ashx")); var maxRows = endIndex + 1 - startIndex; var subscribedTopics = fc.GetSubscribedTopics(portalId, forumModuleId, userId, forumIds, startIndex, maxRows).ToList(); return new XmlRpcStruct { {"total_topic_num", subscribedTopics.Count > 0 ? subscribedTopics[0].TopicCount : 0}, {"topics", subscribedTopics.Select(t => new ExtendedTopicStructure{ TopicId = t.TopicId.ToString(), AuthorAvatarUrl = string.Format("{0}?userId={1}&w=64&h=64", profilePath, t.LastReplyAuthorId), AuthorName = GetLastReplyAuthorName(mainSettings, t).ToBytes(), AuthorId = t.LastReplyAuthorId.ToString(), ForumId = t.ForumId.ToString(), ForumName = t.ForumName.ToBytes(), HasNewPosts = (t.LastReplyId < 0 && t.TopicId > t.UserLastTopicRead) || t.LastReplyId > t.UserLastReplyRead, IsLocked = t.IsLocked, ReplyCount = t.ReplyCount, Summary = GetSummary(null, t.LastReplyBody).ToBytes(), ViewCount = t.ViewCount, DateCreated = t.LastReplyDate, Title = HttpUtility.HtmlDecode(t.Subject + string.Empty).ToBytes() }).ToArray()} }; }