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

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

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

                    return(result);
                }
                else
                {
                    return("Sorry, we added favorites after this comment was written. Please consider tagging more recent comments as favorites.");
                }
            }
            else
            {
                return("Please login or become a member to tag this comment as a favorite");
            }
        }
Exemplo n.º 2
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");
            }
        }
Exemplo n.º 3
0
        public static SueetieUser GetSueetieUserFromForumId(int forumUserId)
        {
            var sueetieUser = SueetieUsers.GetSueetieUserList(SueetieUserType.RegisteredUser).Find(u => u.ForumUserID == forumUserId);

            if (sueetieUser == null)
            {
                var provider = SueetieDataProvider.LoadProvider();
                sueetieUser = provider.GetSueetieUserFromForumID(forumUserId);
            }
            return(sueetieUser);
        }
Exemplo n.º 4
0
        public static bool IsAFave(UserContent userContent)
        {
            var _isFave    = false;
            var favoriteID = SueetieUsers.GetFavoriteID(userContent);

            if (favoriteID > 0)
            {
                _isFave = true;
            }
            return(_isFave);
        }
Exemplo n.º 5
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.º 6
0
        public List <Triplet> GetFollowList(int userid, int followTypeID)
        {
            // 0 - following, 1 - followers, 2 - friends
            List <Triplet> followList = new List <Triplet>();

            if (userid == -2)
            {
                userid = SueetieContext.Current.User.UserID;
            }

            var q = from c in SueetieUsers.GetSueetieFollowList(userid, followTypeID)
                    select new Triplet(c.UserID, c.DisplayName, c.ThumbnailFilename);

            followList.AddRange(q.ToList());
            return(followList);
        }
Exemplo n.º 7
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);
            }
        }
Exemplo n.º 8
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");
            }
        }
Exemplo n.º 9
0
        public List <FavoriteContent> GetFavoriteContent(int userID, int contentTypeID, int groupID, bool isRestricted)
        {
            int _userID = SueetieContext.Current.User.UserID;

            if (userID == -2)
            {
                userID = _userID;
            }

            var favorites = from f in SueetieUsers.GetFavoriteContentList(userID)
                            orderby f.Title
                            where f.ContentTypeID == contentTypeID && f.GroupID == groupID
                            select f;

            if (isRestricted)
            {
                return(favorites.Where(f => f.IsRestricted == false).ToList());
            }
            else
            {
                return(favorites.ToList());
            }
        }
Exemplo n.º 10
0
        private static UserLogActivity FormatUserLogRow(UserLogActivity _u)
        {
            _u.ActivityClass = _u.ApplicationPath;

            var _profileUrl   = SueetieUrls.Instance.MyProfile(_u.UserID).Url;
            var _toProfileUrl = SueetieUrls.Instance.MasterProfile(SueetieUsers.GetThinSueetieUser(_u.ToUserID).ForumUserID).Url;

            if (SueetieConfiguration.Get().Core.UseForumProfile)
            {
                var thinUser = SueetieUsers.GetThinSueetieUser(_u.UserID);
                if (thinUser != null)
                {
                    var masterProfile = SueetieUrls.Instance.MasterProfile(thinUser.ForumUserID);
                    if (masterProfile != null)
                    {
                        _profileUrl = masterProfile.Url;
                    }
                }
            }
            var username   = string.Format("<a href='" + _profileUrl + "' class='ActivityUser'>{0}</a> ", _u.DisplayName);
            var toUsername = string.Format("<a href='" + _profileUrl + "' class='ActivityUser'>{0}</a> ", _u.ToUserDisplayName);

            _u.Activity = string.Empty;

            switch (_u.UserLogCategoryID)
            {
            case (int)UserLogCategoryType.Following:
                var _toUserProfileUrl = SueetieUrls.Instance.MyProfile(_u.ToUserID).Url;
                if (SueetieConfiguration.Get().Core.UseForumProfile)
                {
                    _toUserProfileUrl = SueetieUrls.Instance.MasterProfile(SueetieUsers.GetThinSueetieUser(_u.ToUserID).ForumUserID).Url;
                }
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_is_now_following"),
                    username,
                    string.Format(
                        "<a href='" + _toUserProfileUrl + "' class='ActivitySource'>{0}</a>",
                        _u.ToUserDisplayName));
                break;

            case (int)UserLogCategoryType.BlogPost:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_blogged"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));

                break;

            case (int)UserLogCategoryType.BlogComment:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_commented_on"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                _u.ActivityClass = "blogcomment";
                break;

            case (int)UserLogCategoryType.ForumTopic:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_posted"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.ForumMessage:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_replied_to"),
                    username,
                    string.Format(
                        "<a href='{0}'>{1}</a>", _u.Permalink, _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.ForumAnswer:
                var _answerBy = SueetieLocalizer.GetString("activity_by") + " " + toUsername;
                if (_u.UserID == _u.ToUserID)
                {
                    _answerBy = string.Empty;
                }
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_marked_as_answer"),
                    username,
                    string.Format(
                        "<a href='{0}'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    _answerBy,
                    SueetieLocalizer.GetString("activity_as_an_answer"),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                // {0} marked {1} {2} {3} {4} {5} {6}
                break;

            case (int)UserLogCategoryType.NewWikiPage:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_created"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.NewWikiMessage:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_new_wiki_message"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, SueetieLocalizer.GetString("activity_a_new_message")),
                    SueetieLocalizer.GetString("activity_to"),
                    string.Format(
                        "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                        _u.SourceParentPermalink,
                        _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format("<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                                  _u.ApplicationPath,
                                  _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.WikiPageUpdated:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_updated"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));

                break;

            case (int)UserLogCategoryType.DocumentAlbum:
            case (int)UserLogCategoryType.AudioAlbum:
            case (int)UserLogCategoryType.ImageAlbum:
            case (int)UserLogCategoryType.UserMediaAlbum:
            case (int)UserLogCategoryType.MultipurposeAlbum:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_created_a_new"),
                    username,
                    _u.SourceDescription.ToLower(),
                    SueetieLocalizer.GetString("activity_named"),
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                        _u.SourceParentPermalink,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.AudioUploaded:
            case (int)UserLogCategoryType.DocumentUploaded:
            case (int)UserLogCategoryType.ImageUploaded:
            case (int)UserLogCategoryType.OtherMediaUploaded:
            case (int)UserLogCategoryType.VideoUploaded:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_added_new"),
                    username,
                    _u.SourceDescription.ToLower(),
                    SueetieLocalizer.GetString("activity_to"),
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                        _u.SourceParentPermalink,
                        _u.ApplicationName));
                _u.ActivityClass = "mediaupload";
                break;

            case (int)UserLogCategoryType.MarketplaceProduct:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_added_a_new_product_item"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.CMSPageUpdated:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_updated_a_cms_page"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.CMSPageCreated:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_created_a_cms_page"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.CalendarEvent:
                if (_u.Permalink == "na")
                {
                    _u.Activity += string.Format(
                        SueetieLocalizer.GetString("activity_new_calendar_event"),
                        username,
                        string.Format("<span) class='ActivitySpan'>{0}</span>", _u.SourceDescription),
                        SueetieLocalizer.GetString("activity_in_the"),
                        string.Format(
                            "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                            _u.SourceParentPermalink,
                            _u.SourceParentDescription));
                }
                else
                {
                    _u.Activity += string.Format(
                        SueetieLocalizer.GetString("activity_new_calendar_event"),
                        username,
                        string.Format(
                            "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                        SueetieLocalizer.GetString("activity_in_the"),
                        string.Format(
                            "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                            _u.SourceParentPermalink,
                            _u.SourceParentDescription));
                }

                _u.ActivityClass = "calendarevent";
                break;

            case (int)UserLogCategoryType.JoinedCommunity:
                _u.Activity      = string.Format(SueetieLocalizer.GetString("activity_became_a_new_member"), username);
                _u.ActivityClass = "newuser";
                break;

            case (int)UserLogCategoryType.Registered:
                _u.Activity      = string.Format(SueetieLocalizer.GetString("activity_user_registered"), username);
                _u.ActivityClass = "newuser";
                break;

            case (int)UserLogCategoryType.LoggedIn:
                _u.Activity      = string.Format(SueetieLocalizer.GetString("activity_user_loggedin"), username);
                _u.ActivityClass = "newuser";
                break;

            default:
                _u.Activity = _u.UserLogCategoryID + " - " + _u.UserLogID + " - " + _u.ApplicationName;
                break;
            }
            return(_u);
        }
Exemplo n.º 11
0
        public UserContent DeleteFavorite(int favoriteID)
        {
            UserContent userContent = SueetieUsers.DeleteFavorite(favoriteID);

            return(userContent);
        }
Exemplo n.º 12
0
 public string GetDisplayName(int userid)
 {
     return(SueetieUsers.GetUser(userid).DisplayName);
 }