private void GetSubscriptionObjectsHandler(object sender, SubscriptionEventArgs e) { var recipient = (IDirectRecipient)ForumNotifySource.Instance.GetRecipientsProvider().GetRecipient(e.UserID.ToString()); if (recipient == null) { _view.SubscriptionObjects = new List <object>(0); return; } List <string> objIDs = new List <string>(ForumNotifySource.Instance.GetSubscriptionProvider().GetSubscriptions(e.NotifyAction, recipient, false)); if (objIDs == null || objIDs.Count == 0) { _view.SubscriptionObjects = new List <object>(0); return; } if (String.Equals(e.NotifyAction.ID, SubscriptionConstants.NewPostInTopic.ID, StringComparison.InvariantCultureIgnoreCase)) { _view.SubscriptionObjects = ForumDataProvider.GetTopicsByIDs(e.TenantID, objIDs.ConvertAll <int>(id => Convert.ToInt32(id)), false) .ConvertAll <object>(topic => (object)topic); } else if (String.Equals(e.NotifyAction.ID, SubscriptionConstants.NewPostInThread.ID, StringComparison.InvariantCultureIgnoreCase)) { List <ThreadCategory> categories = null; List <Thread> threads = null; ForumDataProvider.GetThreadCategories(e.TenantID, false, out categories, out threads); threads.RemoveAll(tid => (objIDs.Find(id => id == tid.ID.ToString()) == null)); _view.SubscriptionObjects = threads.ConvertAll <object>(thread => (object)thread); } else if (String.Equals(e.NotifyAction.ID, SubscriptionConstants.NewPostByTag.ID, StringComparison.InvariantCultureIgnoreCase)) { _view.SubscriptionObjects = ForumDataProvider.GetTagByIDs(e.TenantID, objIDs.ConvertAll <int>(id => Convert.ToInt32(id))) .ConvertAll <object>(tag => (object)tag); } else if (String.Equals(e.NotifyAction.ID, SubscriptionConstants.NewTopicInForum.ID, StringComparison.InvariantCultureIgnoreCase)) { if (objIDs != null && objIDs.Count == 1 && objIDs[0] == null) { var objList = new List <object>(); objList.Add(null); _view.SubscriptionObjects = objList; } } }
public ForumThreadWrapperFull GetThreadTopics(int threadid) { var topicsIds = ForumDataProvider.GetTopicIDs(TenantId, threadid).Skip((int)_context.StartIndex); if (_context.Count > 0) { topicsIds = topicsIds.Take((int)_context.Count); } _context.SetDataPaginated(); return(new ForumThreadWrapperFull(ForumDataProvider.GetThreadByID(TenantId, threadid).NotFoundIfNull(), ForumDataProvider.GetTopicsByIDs(TenantId, topicsIds.ToList(), true))); }