Ejemplo n.º 1
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");
            }
        }
Ejemplo n.º 2
0
        public static int CreateUpdateSueetieBlogPost(SueetieBlogPost sueetieBlogPost)
        {
            var provider  = SueetieDataProvider.LoadProvider();
            var contentId = provider.CreateUpdateSueetieBlogPost(sueetieBlogPost);

            ClearBlogPostListCache(sueetieBlogPost);
            return(contentId);
        }
Ejemplo n.º 3
0
        private static void ClearBlogPostListCache(SueetieBlogPost sueetieBlogPost)
        {
            var contentQuery = new ContentQuery
            {
                GroupID       = sueetieBlogPost.GroupID,
                UserID        = sueetieBlogPost.UserID,
                ApplicationID = sueetieBlogPost.ApplicationID,
                IsRestricted  = sueetieBlogPost.IsRestricted
            };

            ClearBlogPostListCache(contentQuery);
        }
Ejemplo n.º 4
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.");
            }
        }
Ejemplo n.º 5
0
        public static string CategoryUrls(SueetieBlogPost post)
        {
            if (string.IsNullOrEmpty(post.Categories))
            {
                return(SueetieLocalizer.GetString("no_categories"));
            }

            var sb        = new StringBuilder();
            var firstItem = true;

            foreach (var category in post.Categories.Split('|'))
            {
                if (!firstItem)
                {
                    sb.Append(", ");
                }
                sb.Append(string.Format("<a href=\"/{0}/category/{1}.aspx\">{2}</a>", post.ApplicationKey, DataHelper.PrepCategoryLink(category), category));
                firstItem = false;
            }
            return(sb.ToString());
        }