示例#1
0
        private static SueetieSearchDoc ConvertBlogPostToSearchDoc(SueetieBlogPost post)
        {
            string _tags        = !string.IsNullOrEmpty(post.Tags) ? post.Tags.Replace('|', ' ') : string.Empty;
            string _displayTags = !string.IsNullOrEmpty(post.Tags) ? SueetieTags.TagUrls(post.Tags) : string.Empty;
            string _categories  = !string.IsNullOrEmpty(post.Categories) ? post.Categories.Replace('|', ' ') : string.Empty;
            var    doc          = new SueetieSearchDoc()
            {
                App               = "Blogs",
                AppID             = post.ApplicationID,
                ContainerName     = post.BlogTitle,
                GroupID           = post.GroupID,
                GroupKey          = string.IsNullOrEmpty(post.GroupKey) ? "na" : post.GroupKey,
                IsRestricted      = post.IsRestricted,
                ContentID         = post.ContentID,
                PublishDate       = post.DateCreated,
                Tags              = _tags,
                DisplayTags       = _displayTags,
                Categories        = _categories,
                Title             = post.Title,
                ContentTypeID     = post.ContentTypeID,
                ApplicationTypeID = post.ApplicationTypeID,
                Author            = post.DisplayName,
                PermaLink         = post.Permalink,
                ApplicationKey    = post.ApplicationKey,
                Username          = post.Author,
                Body              = DataHelper.CleanSearchBodyContent(post.PostContent) + RaquoIt(post.BlogTitle) + RaquoIt(post.Author) + RaquoIt(post.Title) + RaquoIt(_tags) + RaquoIt(_categories)
            };

            return(doc);
        }
示例#2
0
        public override List <SueetieBlogPost> GetSueetieBlogPostsToIndex(int contenttypeID, DateTime pubDate)
        {
            List <SueetieBlogPost> sueetieBlogPosts = new List <SueetieBlogPost>();

            using (SqlConnection cn = GetSqlConnection())
            {
                using (SqlCommand cmd = new SqlCommand("Sueetie_Search_BlogPosts_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))
                    {
                        SueetieBlogPost _SueetieBlogPost = null;
                        while (dr.Read())
                        {
                            _SueetieBlogPost = new SueetieBlogPost();
                            PopulateSueetieBlogPostList(dr, _SueetieBlogPost);
                            sueetieBlogPosts.Add(_SueetieBlogPost);
                        }

                        dr.Close();
                        cn.Close();
                    }
                }
            }
            return(sueetieBlogPosts);
        }
示例#3
0
    public string BlogFavePost(int userID, string postGuid)
    {
        SueetieBlogPost sueetieBlogPost = SueetieBlogs.GetSueetieBlogPost(postGuid);

        if (userID > 0)
        {
            if (sueetieBlogPost.SueetiePostID > 0)
            {
                string      result      = "You have tagged " + sueetieBlogPost.Title + " as a favorite!";
                UserContent userContent = new UserContent
                {
                    ContentID = sueetieBlogPost.ContentID,
                    UserID    = userID
                };

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

                return(result);
            }
            else
            {
                return("Sorry, we added favorites after this post was published. Please consider tagging more recent posts as favorites.");
            }
        }
        else
        {
            return("Please login or become a member to tag this post as a favorite");
        }
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Sueetie Modified - Add Calendar Control
        if (this.Post != null && this.Post.Id != null)
        {
            SueetieBlogPost sueetieBlogPost = SueetieBlogs.GetSueetieBlogPost(Post.Id.ToString());

            calendarControl = new CalendarControl();
            calendarControl.CalendarSueetieBlogPost = sueetieBlogPost;
            phCalendarControl.Controls.Add(calendarControl);
        }
    }
示例#5
0
    public string BlogAuthorFollow(int userID, string postGuid)
    {
        SueetieBlogPost sueetieBlogPost = SueetieBlogs.GetSueetieBlogPost(postGuid);

        if (userID > 0)
        {
            if (sueetieBlogPost.SueetiePostID > 0)
            {
                string        result        = "You are now following " + sueetieBlogPost.DisplayName;
                SueetieFollow sueetieFollow = new SueetieFollow
                {
                    FollowerUserID    = userID,
                    FollowingUserID   = sueetieBlogPost.UserID,
                    ContentIDFollowed = sueetieBlogPost.SueetiePostID
                };

                if (sueetieFollow.FollowerUserID == sueetieFollow.FollowingUserID)
                {
                    result = "Sorry, you cannot follow yourself...";
                }
                else
                {
                    int followID = SueetieUsers.FollowUser(sueetieFollow);
                    if (followID < 0)
                    {
                        result = "You are already following " + sueetieBlogPost.DisplayName;
                    }

                    SueetieLogs.LogUserEntry(UserLogCategoryType.Following, sueetieBlogPost.UserID, userID);
                }
                return(result);
            }
            else
            {
                return("Sorry, we added following after this post was written. Please use a more current post to follow this member.");
            }
        }
        else
        {
            return("Please login or become a member to follow this person.");
        }
    }
 public static void PopulateSueetieBlogPostList(IDataReader dr, SueetieBlogPost _sueetieBlogPost)
 {
     _sueetieBlogPost.SueetiePostID          = (int)dr["sueetiepostid"];
     _sueetieBlogPost.UserID                 = (int)dr["userid"];
     _sueetieBlogPost.PostID                 = DataHelper.GetGuid(dr, "postid");
     _sueetieBlogPost.Title                  = dr["title"] as string;
     _sueetieBlogPost.Description            = dr["description"] as string;
     _sueetieBlogPost.PostContent            = dr["postcontent"] as string;
     _sueetieBlogPost.DateCreated            = (DateTime)dr["datecreated"];
     _sueetieBlogPost.DateModified           = (DateTime)dr["datemodified"];
     _sueetieBlogPost.Author                 = dr["author"] as string;
     _sueetieBlogPost.IsPublished            = (bool)dr["ispublished"];
     _sueetieBlogPost.IsCommentEnabled       = (bool)dr["iscommentenabled"];
     _sueetieBlogPost.Raters                 = (int)dr["raters"];
     _sueetieBlogPost.Rating                 = DataHelper.GetFloat(dr, "rating");
     _sueetieBlogPost.Slug                   = dr["slug"] as string;
     _sueetieBlogPost.Email                  = dr["email"] as string;
     _sueetieBlogPost.DisplayName            = dr["displayname"] as string;
     _sueetieBlogPost.GroupID                = (int)dr["groupid"];
     _sueetieBlogPost.GroupKey               = dr["groupkey"] as string;
     _sueetieBlogPost.ApplicationID          = (int)dr["applicationid"];
     _sueetieBlogPost.ApplicationTypeID      = (int)dr["applicationtypeid"];
     _sueetieBlogPost.ApplicationKey         = dr["applicationkey"] as string;
     _sueetieBlogPost.ContentID              = (int)dr["contentid"];
     _sueetieBlogPost.ContentTypeID          = (int)dr["contenttypeid"];
     _sueetieBlogPost.Permalink              = dr["permalink"] as string;
     _sueetieBlogPost.IsRestricted           = (bool)dr["isrestricted"];
     _sueetieBlogPost.GroupName              = dr["groupname"] as string;
     _sueetieBlogPost.ApplicationName        = dr["applicationname"] as string;
     _sueetieBlogPost.BlogAccessRole         = dr["blogaccessrole"] as string;
     _sueetieBlogPost.BlogTitle              = dr["blogtitle"] as string;
     _sueetieBlogPost.IncludeInAggregateList = (bool)dr["includeinaggregatelist"];
     _sueetieBlogPost.IsActive               = (bool)dr["isactive"];
     _sueetieBlogPost.Categories             = dr["categories"] as string;
     _sueetieBlogPost.Tags                   = dr["tags"] as string;
 }