Пример #1
0
        public List <SueetieForumMessage> GetRecentForumMessages(int numRecords, int userID, int applicationID, bool isRestricted)
        {
            ContentQuery contentQuery = new ContentQuery
            {
                NumRecords    = numRecords,
                UserID        = userID,
                ContentTypeID = (int)SueetieContentType.ForumMessage,
                GroupID       = -1,
                ApplicationID = applicationID,
                IsRestricted  = isRestricted,
                TruncateText  = true
            };

            List <SueetieForumMessage> _sueetieForumMessages = SueetieForums.GetSueetieForumMessageList(contentQuery);

            foreach (SueetieForumMessage msg in _sueetieForumMessages)
            {
                msg.Message = DataHelper.TruncateText(msg.Message, SueetieConfiguration.Get().Core.TruncateTextCount);
            }
            return(_sueetieForumMessages);
        }
Пример #2
0
        public string ForumFaveMessage(int userID, int messageID, int applicationID)
        {
            SueetieForumContent sueetieForumContent = new SueetieForumContent
            {
                MessageID     = messageID,
                ContentTypeID = (int)SueetieContentType.ForumMessage,
                ApplicationID = applicationID
            };

            SueetieForumMessage sueetieForumMessage = SueetieForums.GetSueetieForumMessage(sueetieForumContent);

            if (userID > 0)
            {
                if (sueetieForumMessage.ContentID > 0)
                {
                    string      result      = "You tagged this message by " + sueetieForumMessage.DisplayName + " as a favorite!";
                    UserContent userContent = new UserContent
                    {
                        ContentID = sueetieForumMessage.ContentID,
                        UserID    = userID
                    };

                    int favoriteID = SueetieUsers.CreateFavorite(userContent);
                    if (favoriteID < 0)
                    {
                        result = "You already tagged this forums message as a favorite.";
                    }

                    return(result);
                }
                else
                {
                    return("Dang it. This forums message cannot be tagged as a favorite for some reason.  Sorry.");
                }
            }
            else
            {
                return("Please login or become a member to tag this forums message as a favorite");
            }
        }