示例#1
0
        private static SueetieSearchDoc ConvertSueetieForumMessageToSearchDoc(SueetieForumMessage sueetieForumMessage)
        {
            string _body        = DataHelper.CleanSearchBodyContent(sueetieForumMessage.Message);
            string _tags        = !string.IsNullOrEmpty(sueetieForumMessage.Tags) ? sueetieForumMessage.Tags.Replace('|', ' ') : string.Empty;
            string _displayTags = !string.IsNullOrEmpty(sueetieForumMessage.Tags) ? SueetieTags.TagUrls(sueetieForumMessage.Tags) : string.Empty;

            SueetieSearchDoc doc = new SueetieSearchDoc()
            {
                App               = "Forums",
                ContentID         = sueetieForumMessage.ContentID,
                Title             = sueetieForumMessage.Topic,
                Tags              = _tags,
                DisplayTags       = _displayTags,
                AppID             = sueetieForumMessage.ApplicationID,
                IsRestricted      = sueetieForumMessage.IsRestricted,
                PublishDate       = sueetieForumMessage.DateTimeCreated,
                ContainerName     = sueetieForumMessage.Forum,
                GroupID           = sueetieForumMessage.GroupID,
                GroupKey          = string.IsNullOrEmpty(sueetieForumMessage.GroupKey) ? "na" : sueetieForumMessage.GroupKey,
                ContentTypeID     = sueetieForumMessage.ContentTypeID,
                Categories        = string.Empty,
                ApplicationTypeID = sueetieForumMessage.ApplicationTypeID,
                ApplicationKey    = sueetieForumMessage.ApplicationKey,
                PermaLink         = sueetieForumMessage.Permalink,
                Author            = sueetieForumMessage.DisplayName,
                Username          = sueetieForumMessage.UserName,
                Body              = _body + RaquoIt(sueetieForumMessage.Topic) + RaquoIt(_tags) + RaquoIt(sueetieForumMessage.UserName)
            };

            return(doc);
        }
 public static void PopulateSueetieForumMessageList(IDataReader dr, SueetieForumMessage _sueetieForumMessage)
 {
     _sueetieForumMessage.MessageID              = (int)dr["messageid"];
     _sueetieForumMessage.TopicID                = (int)dr["topicid"];
     _sueetieForumMessage.UserID                 = (int)dr["userid"];
     _sueetieForumMessage.Message                = dr["message"] as string;
     _sueetieForumMessage.SueetieUserID          = (int)dr["sueetieuserid"];
     _sueetieForumMessage.ContentID              = (int)dr["contentid"];
     _sueetieForumMessage.ContentTypeID          = (int)dr["contenttypeid"];
     _sueetieForumMessage.ApplicationID          = (int)dr["applicationid"];
     _sueetieForumMessage.IsRestricted           = (bool)dr["isrestricted"];
     _sueetieForumMessage.Permalink              = dr["permalink"] as string;
     _sueetieForumMessage.DateTimeCreated        = (DateTime)dr["datetimecreated"];
     _sueetieForumMessage.SourceID               = (int)dr["sourceid"];
     _sueetieForumMessage.Topic                  = dr["topic"] as string;
     _sueetieForumMessage.DisplayName            = dr["displayname"] as string;
     _sueetieForumMessage.Email                  = dr["email"] as string;
     _sueetieForumMessage.ApplicationDescription = dr["applicationdescription"] as string;
     _sueetieForumMessage.GroupID                = (int)dr["groupid"];
     _sueetieForumMessage.GroupName              = dr["groupname"] as string;
     _sueetieForumMessage.TopicSueetieUserID     = (int)dr["topicsueetieuserid"];
     _sueetieForumMessage.TopicDisplayName       = dr["topicdisplayname"] as string;
     _sueetieForumMessage.UserName               = dr["username"] as string;
     _sueetieForumMessage.ApplicationTypeID      = (int)dr["applicationtypeid"];
     _sueetieForumMessage.ApplicationKey         = dr["applicationkey"] as string;
     _sueetieForumMessage.Forum                  = dr["forum"] as string;
     _sueetieForumMessage.ForumID                = (int)dr["forumid"];
     _sueetieForumMessage.GroupKey               = dr["groupkey"] as string;
     _sueetieForumMessage.Edited                 = (DateTime)DataHelper.DateOrNull(dr["edited"].ToString());
     _sueetieForumMessage.Tags = dr["tags"] as string;
 }
示例#3
0
        public override List <SueetieForumMessage> GetSueetieForumMessagesToIndex(int contenttypeID, DateTime pubDate)
        {
            List <SueetieForumMessage> sueetieForumMessages = new List <SueetieForumMessage>();

            using (SqlConnection cn = GetSqlConnection())
            {
                using (SqlCommand cmd = new SqlCommand("Sueetie_Search_ForumMessages_Get", cn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@contenttypeID", SqlDbType.Int, 4).Value = contenttypeID;
                    cmd.Parameters.Add("@pubDate", SqlDbType.DateTime, 8).Value  = pubDate == DateTime.MinValue
                        ? new DateTime(1900, 1, 1)
                        : pubDate;
                    cn.Open();
                    using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        SueetieForumMessage _SueetieForumMessage = null;
                        while (dr.Read())
                        {
                            _SueetieForumMessage = new SueetieForumMessage();
                            PopulateSueetieForumMessageList(dr, _SueetieForumMessage);
                            sueetieForumMessages.Add(_SueetieForumMessage);
                        }

                        dr.Close();
                        cn.Close();
                    }
                }
            }
            return(sueetieForumMessages);
        }
示例#4
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");
        }
    }