Exemplo n.º 1
0
    public string BlogCommenterFollow(int userID, string postGuid)
    {
        SueetieBlogComment sueetieBlogComment = SueetieBlogs.GetSueetieBlogComment(postGuid);

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

                if (sueetieBlogComment.UserID > 0)
                {
                    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 " + sueetieBlogComment.DisplayName;
                        }
                        else
                        {
                            SueetieLogs.LogUserEntry(UserLogCategoryType.Following, sueetieBlogComment.UserID, userID);
                        }
                    }
                }
                else
                {
                    result = "Sorry, " + sueetieBlogComment.Author + " is not a member and thus cannot be followed.";
                }
                return(result);
            }
            else
            {
                return("Sorry, we added following after this comment was posted. Please use a more current comment to follow this member.");
            }
        }
        else
        {
            return("Please login or become a member to follow this person.");
        }
    }
Exemplo n.º 2
0
    public List <Pair> ProfileUserFollow(int userID, int profileUserID, bool stopFollowing)
    {
        if (userID > 0)
        {
            SueetieUser   sueetieFollowingUser = SueetieUsers.GetUser(profileUserID);
            string        result        = "You are now following " + sueetieFollowingUser.DisplayName;
            SueetieFollow sueetieFollow = new SueetieFollow
            {
                FollowerUserID    = userID,
                FollowingUserID   = profileUserID,
                ContentIDFollowed = -1
            };

            if (sueetieFollow.FollowerUserID == sueetieFollow.FollowingUserID)
            {
                result = "Sorry, you cannot follow yourself...";
            }
            else
            {
                if (!stopFollowing)
                {
                    int followID = SueetieUsers.FollowUser(sueetieFollow);
                }
                else
                {
                    SueetieUsers.UnFollowUser(sueetieFollow);
                    result = "You are no longer following " + sueetieFollowingUser.DisplayName;
                }
            }
            List <Pair> followResult = new List <Pair>();
            followResult.Add(new Pair(stopFollowing, result));

            return(followResult);
        }
        else
        {
            List <Pair> followResult = new List <Pair>();
            followResult.Add(new Pair(stopFollowing, "Please login or become a member to follow this person."));

            return(followResult);
        }
    }