Example #1
0
        private void preparePage()
        {
            #region Load Photo

            Photo primaryPhoto = null;
            try
            {
                primaryPhoto = CurrentUserSession.GetPrimaryPhoto();
            }
            catch (NotFoundException)
            {
            }
            catch (Exception err)
            {
                Log(err);
            }

            #region Check CurrentUserSession.Gender and set photoId

            int photoId;

            if (primaryPhoto == null || !primaryPhoto.Approved)
            {
                photoId = ImageHandler.GetPhotoIdByGender(CurrentUserSession.Gender);
            }
            else
            {
                photoId = primaryPhoto.Id;
            }

            #endregion

            if (Config.Photos.EnablePhotoStack)
            {
                imgPhoto.ImageUrl = ImageHandler.CreateImageStackUrl(CurrentUserSession.Username, 200, 150);
            }
            else
            {
                imgPhoto.ImageUrl = String.Format("~/Image.ashx?id={0}&width=90&height=90&diskCache=1&findFace=1",
                                          photoId);
            }

            #endregion

            #region Show Profile Views

            if (Config.Users.EnableWhoViewedMyProfile)
            {
                lblProfileViews.Text = CurrentUserSession.ProfileViews.ToString();
                if (CurrentUserSession.ProfileViews == 0)
                {
                    lnkViewProfileViewers.Enabled = false;
                }
                liWhoViewedMyProfile.Visible = true;
            }
            else
            {
                liWhoViewedMyProfile.Visible = false;
            }

            #endregion

            #region Show Rating

            if (Config.Ratings.EnableProfileRatings)
            {
                pnlRating.Visible = true;
                try
                {
                    UserRating userRating = UserRating.FetchRating(CurrentUserSession.Username);

                    lblRating.Text = String.Format(
                        Lang.Trans("{0} ({1} votes)"),
                        userRating.AverageVote.ToString("0.00"), userRating.Votes);
                }
                catch (NotFoundException)
                {
                    lblRating.Text = Lang.Trans("no rating");
                }
            }
            else pnlRating.Visible = false;

            #endregion

            #region Show Votes

            if (Config.Ratings.EnableProfileVoting)
            {
                int score = UserVotes.FetchVotesScore(CurrentUserSession.Username);
                if (score > 0)
                {
                    pnlVotes.Visible = true;
                    lblVotes.Text = score.ToString();
                }
                else
                {
                    pnlVotes.Visible = false;
                }
            }
            else
            {
                pnlVotes.Visible = false;
            }

            #endregion

            #region Load New Users

            var nuSearch = new NewUsersSearch
                               {
                                   PhotoReq = Config.Users.RequirePhotoToShowInNewUsers,
                                   ProfileReq = Config.Users.RequireProfileToShowInNewUsers,
                                   UsersSince = CurrentUserSession.PrevLogin
                               };
            UserSearchResults nuResults = nuSearch.GetResults(true);
            if (nuResults == null)
            {
                pnlNewUsers.Visible = false;
            }
            else
            {
                lnkNewUsers.Text = nuResults.Usernames.Length == 1 ?
                    Lang.Trans("There is one new user since your last visit!") :
                    String.Format(Lang.Trans("There are <b>{0}</b> new users since your last visit!"), nuResults.Usernames.Length);

                pnlNewUsers.Visible = true;
            }

            #endregion

            #region Load Online Users

            var oSearch = new OnlineSearch();
            UserSearchResults oResults = oSearch.GetResults();

            if (oResults == null)
            {
                pnlUsersOnline.Visible = false;
            }
            else
            {
                lblUsersOnline.Text = oResults.Usernames.Length == 1 ?
                    Lang.Trans("There is one online user!") :
                    String.Format(Lang.Trans("There are <b>{0}</b> online users!"), oResults.Usernames.Length);

                pnlUsersOnline.Visible = true;
            }

            #endregion

            #region Show users broadcasting video

            if (Config.Misc.EnableProfileVideoBroadcast)
            {
                var vbSearch = new VideoBroadcastingSearch();
                UserSearchResults vbResults = vbSearch.GetResults();

                if (vbResults == null)
                {
                    pnlUsersBroadcasting.Visible = false;
                }
                else
                {
                    lblUsersBroadcasting.Text = vbResults.Usernames.Length == 1
                        ? Lang.Trans("There is one user broadcasting video!")
                        : String.Format(Lang.Trans("There are <b>{0}</b> users broadcasting video!"), vbResults.Usernames.Length);

                    pnlUsersBroadcasting.Visible = true;
                }
            }
            else
            {
                pnlUsersBroadcasting.Visible = false;
            }

            #endregion

            #region Load Blocked Users

            int blockedUsers = Data.User.FetchBlockedUsers(CurrentUserSession.Username).Count;

            if (blockedUsers == 0)
            {
                pnlBlockedUsers.Visible = false;
            }
            else
            {
                lblBlockedUsers.Text = blockedUsers == 1
                                           ? Lang.Trans("There is one blocked user!")
                                           : String.Format(Lang.Trans("There are <b>{0}</b> blocked users!"),
                                                           blockedUsers);

                pnlBlockedUsers.Visible = true;
            }

            #endregion

            #region Show Unread Messages

            int unreadMsgCount = Message.SearchUnread(CurrentUserSession.Username).Length;
            if (unreadMsgCount > 0)
            {
                pnlNewMessages.Visible = true;

                if (unreadMsgCount == 1)
                {
                    if (lblNewMessages != null)
                    {
                        lblNewMessages.Text = Lang.Trans("You have <b>1</b> unread message!");
                        lnkNewMessages.Text = Lang.Trans("View");
                    }
                    else
                    {
                        lnkNewMessages.Text = Lang.Trans("You have <b>1</b> unread message!");
                    }
                }
                else
                {
                    if (lblNewMessages != null)
                    {
                        lblNewMessages.Text = String.Format(
                            Lang.Trans("You have <b>{0}</b> unread messages!"), unreadMsgCount);
                        lnkNewMessages.Text = Lang.Trans("View");
                    }
                    else
                    {
                        lnkNewMessages.Text = String.Format(
                            Lang.Trans("You have <b>{0}</b> unread messages!"), unreadMsgCount);
                    }
                }
            }
            else
            {
                pnlNewMessages.Visible = false;
            }

            #endregion

            #region Show Relationship Requests

            if (Config.Users.EnableRelationshipStatus)
            {
                int relationshipRequests = Relationship.FetchRequests(CurrentUserSession.Username).Length;
                if (relationshipRequests > 0)
                {
                    pnlRelationshipRequests.Visible = true;

                    if (relationshipRequests == 1)
                    {
                        if (lblRelationshipRequests != null)
                        {
                            lblRelationshipRequests.Text = Lang.Trans("You have <b>1</b> relationship request!");
                            lnkRelationshipRequests.Text = Lang.Trans("View");
                        }
                        else
                        {
                            lnkRelationshipRequests.Text = Lang.Trans("You have <b>1</b> relationship request!");
                        }
                    }
                    else
                    {
                        if (lblRelationshipRequests != null)
                        {
                            lblRelationshipRequests.Text = String.Format(
                                Lang.Trans("You have <b>{0}</b> relationship requests!"), relationshipRequests);
                            lnkRelationshipRequests.Text = Lang.Trans("View");
                        }
                        else
                        {
                            lnkRelationshipRequests.Text = String.Format(
                                Lang.Trans("You have <b>{0}</b> relationship requests!"), relationshipRequests);
                        }
                    }
                }
                else
                {
                    pnlRelationshipRequests.Visible = false;
                }
            }
            else pnlRelationshipRequests.Visible = false;

            #endregion

            #region Show Friend Requests

            int friendRequests = Data.User.FetchFriendsRequests(CurrentUserSession.Username).Length;
            if (friendRequests > 0)
            {
                pnlFriendsRequests.Visible = true;

                if (friendRequests == 1)
                {
                    if (lblFriendsRequests != null)
                    {
                        lblFriendsRequests.Text = Lang.Trans("You have <b>1</b> friend request!");
                        lnkFriendsRequests.Text = Lang.Trans("View");
                    }
                    else
                    {
                        lnkFriendsRequests.Text = Lang.Trans("You have <b>1</b> friend request!");
                    }
                }
                else
                {
                    if (lblFriendsRequests != null)
                    {
                        lblFriendsRequests.Text = String.Format(
                            Lang.Trans("You have <b>{0}</b> friend requests!"), friendRequests);
                        lnkFriendsRequests.Text = Lang.Trans("View");
                    }
                    else
                    {
                        lnkFriendsRequests.Text = String.Format(
                            Lang.Trans("You have <b>{0}</b> friend requests!"), friendRequests);
                    }
                }
            }
            else
            {
                pnlFriendsRequests.Visible = false;
            }

            #endregion

            #region Show New Ecards

            if (CurrentUserSession.CanSendEcards() != PermissionCheckResult.No)
            {
                int unreadEcardsCount = Ecard.FetchUnread(CurrentUserSession.Username).Length;
                if (unreadEcardsCount > 0)
                {
                    pnlNewEcards.Visible = true;

                    if (unreadEcardsCount == 1)
                    {
                        if (lblNewEcards != null)
                        {
                            lblNewEcards.Text = Lang.Trans("You have <b>1</b> unread e-card!");
                            lnkNewEcards.Text = Lang.Trans("View");
                        }
                        else
                        {
                            lnkNewEcards.Text = Lang.Trans("You have <b>1</b> unread e-card!");
                        }
                    }
                    else
                    {
                        if (lblNewEcards != null)
                        {
                            lblNewEcards.Text = String.Format(
                                Lang.Trans("You have <b>{0}</b> unread e-cards!"), unreadEcardsCount);
                            lnkNewEcards.Text = Lang.Trans("View");
                        }
                        else
                        {
                            lnkNewEcards.Text = String.Format(
                                Lang.Trans("You have <b>{0}</b> unread e-cards!"), unreadEcardsCount);
                        }
                    }
                }
                else
                {
                    pnlNewEcards.Visible = false;
                }
            }
            else pnlNewEcards.Visible = false;
            

            #endregion

            #region Add Initial Web Parts

            bool firstTime = CurrentUserSession.PersonalizationInfo == null;
            bool isDirty = firstTime;

            if (firstTime)
            {
                WebPartInfo[] infos = Config.WebParts.GetAvailableWebParts(WebPartZone.HomePageRightZone, true);

                for (int i = 0; i < infos.Length; ++i)
                    WebPartManager1.AddWebPartUserControl(infos[i], wpzHomePageRightZone, i);

                infos = Config.WebParts.GetAvailableWebParts(WebPartZone.HomePageLeftZone, true);

                for (int i = 0; i < infos.Length; ++i)
                    WebPartManager1.AddWebPartUserControl(infos[i], wpzHomePageLeftZone, i);
            }

            if (!Config.Groups.EnableGroups)
            {
                foreach (WebPart part in WebPartManager1.WebParts)
                {
                    if (part.Controls[0] is NewGroupsWebPart)
                    {
                        WebPartManager1.DeleteWebPart(part);
                        isDirty = true;
                    }
                }
            }

            if (isDirty)
            {
                WebPartManager1.SetDirty();
                // ReSharper disable RedundantAssignment
                isDirty = false;
                // ReSharper restore RedundantAssignment
            }

            #endregion

            #region Show contest rankings

            if (Config.Ratings.EnablePhotoContests)
            {
                PhotoContestEntry[] entries = PhotoContestEntry.Load(null, null, CurrentUserSession.Username, null);
                if (entries != null && entries.Length > 0)
                {
                    var dtRanks = new DataTable();
                    dtRanks.Columns.Add("Rank", typeof(int));
                    dtRanks.Columns.Add("ContestName", typeof(string));

                    foreach (PhotoContestEntry entry in entries)
                    {
                        int rank = PhotoContestEntry.FindRank(entry.ContestId, entry.Id);
                        if (rank > 0)
                        {
                            PhotoContest contest = PhotoContest.Load(entry.ContestId);
                            if (contest.DateEnds.HasValue && contest.DateEnds < DateTime.Now) continue;

                            dtRanks.Rows.Add(new object[] { rank, contest.Name });
                        }
                    }

                    if (dtRanks.Rows.Count > 0)
                    {
                        rptContestsRanks.DataSource = dtRanks;
                        rptContestsRanks.DataBind();
                        rptContestsRanks.Visible = true;
                    }
                }
            }

            #endregion

            #region Show Pending Invitations

            if (Config.Groups.EnableGroups)
            {
                int pendingInvitations = Group.FetchPendingInvitations(CurrentUserSession.Username);

                if (pendingInvitations > 0)
                {
                    pnlPendingInvitations.Visible = true;

                    if (pendingInvitations == 1)
                    {
                        if (lblPendingInvitatinos != null)
                        {
                            lblPendingInvitatinos.Text = Lang.Trans("You have <b>1</b> pending invitation!");
                            lnkPendingInvitations.Text = Lang.Trans("View");
                        }
                        else
                        {
                            lnkPendingInvitations.Text = Lang.Trans("You have <b>1</b> pending invitation!");
                        }
                    }
                    else
                    {
                        if (lblPendingInvitatinos != null)
                        {
                            lblPendingInvitatinos.Text = String.Format(
                                Lang.Trans("You have <b>{0}</b> pending invitations!"), pendingInvitations);
                            lnkPendingInvitations.Text = Lang.Trans("View");
                        }
                        else
                        {
                            lnkPendingInvitations.Text = String.Format(
                                Lang.Trans("You have <b>{0}</b> pending invitations!"), pendingInvitations);
                        }
                    }
                }
            }

            #endregion

            #region Show group topic subscriptions

            if (Config.Groups.EnableGroups)
            {
                DataTable dtGroupTopicSubscriptions = new DataTable("GroupTopicSubscriptions");

                dtGroupTopicSubscriptions.Columns.Add("GroupTopicID");
                dtGroupTopicSubscriptions.Columns.Add("GroupTopicName");
                dtGroupTopicSubscriptions.Columns.Add("GroupID");
                dtGroupTopicSubscriptions.Columns.Add("GroupName");

                GroupTopic[] groupTopics =
                    GroupTopic.FetchUpdatedGroupTopicsUserHasSubscribedTo(CurrentUserSession.Username);

                foreach (GroupTopic groupTopic in groupTopics)
                {
                    Group group = Group.Fetch(groupTopic.GroupID);

                    if (group != null)
                    {
                        dtGroupTopicSubscriptions.Rows.Add(new object[]
                                                           {
                                                               groupTopic.ID, groupTopic.Name, group.ID, group.Name
                                                           });
                    }
                }

                rptGroupTopicSubscriptions.DataSource = dtGroupTopicSubscriptions;
                rptGroupTopicSubscriptions.DataBind();
                rptGroupTopicSubscriptions.Visible = dtGroupTopicSubscriptions.Rows.Count > 0;
            }

            #endregion

            #region Show Status text

            if (Config.Users.EnableUserStatusText)
            {
                pnlStatusText.Visible = !Config.Misc.SiteIsPaid || Data.User.IsPaidMember(CurrentUserSession.Username);
                lblStatusText.Text = Server.HtmlEncode(CurrentUserSession.StatusText) ?? "Not set".Translate();    
            }

            #endregion

            #region Notify Facebook for the changed status

            long? facebookID = CurrentUserSession.FacebookID;
            if (Config.Misc.EnableFacebookIntegration && facebookID.HasValue && facebookID > 0)
            {
                divFaceBookStatusUpdate.Visible = true;
                pnlInviteFriendsFromFacebook.Visible = true;
            }

            #endregion
        }
        private void preparePage()
        {
            string youHaveStrTrans = Lang.Trans("You have");
            string thereAreTrans = Lang.Trans("There are");

            #region Load Photo

            Photo primaryPhoto = null;
            bool hasPhoto = false;
            try
            {
                primaryPhoto = _currentUserSession.GetPrimaryPhoto();
                hasPhoto = primaryPhoto != null && primaryPhoto.Approved ? true : false;
            }
            catch (NotFoundException)
            {
            }
            catch (Exception err)
            {
                if (Page is PageBase)
                    ((PageBase)Page).Log(err);
            }

            #region Check _currentUserSession.Gender and set photoId

            int photoId = hasPhoto ? primaryPhoto.Id : ImageHandler.GetPhotoIdByGender(_currentUserSession.Gender);

            #endregion

            if (false) //Config.Photos.EnablePhotoStack)
            {
                imgPhoto.ImageUrl = ImageHandler.CreateImageStackUrl(_currentUserSession.Username, 200, 150);
            }
            else
            {
                if (!hasPhoto && _currentUserSession.FacebookID.HasValue && _currentUserSession.FacebookID.Value > 0)
                {
                    imgPhoto.ImageUrl = ImageHandler.CreateFacebookImageUrl(_currentUserSession.FacebookID.Value,
                                                                            ImageHandler.eFacebookImageType.Normal);
                    
                }
                else
                {
                    imgPhoto.ImageUrl = ImageHandler.CreateImageUrl(photoId, 90, 90,
                                                            photoId <= 0, true, true);
                }
            }

            #endregion

            #region Show Profile Views

            bool isShowProfileViews = Config.Users.EnableWhoViewedMyProfile && _currentUserSession.ProfileViews > 0;
            lblProfileViews.Text = isShowProfileViews ? _currentUserSession.ProfileViews.ToString() : "";
            lnkViewProfileViewers.Visible = isShowProfileViews;
            liWhoViewedMyProfile.Visible = isShowProfileViews;
            
            #endregion

            #region Show Rating

            if (Config.Ratings.EnableProfileRatings)
            {
                pnlRating.Visible = true;
                try
                {
                    UserRating userRating = UserRating.FetchRating(_currentUserSession.Username);

                    lblRating.Text = String.Format(
                        Lang.Trans("{0} ({1} votes)"),
                        userRating.AverageVote.ToString("0.00"), userRating.Votes);
                }
                catch (NotFoundException)
                {
                    lblRating.Text = Lang.Trans("no rating");
                }
            }
            else pnlRating.Visible = false;

            #endregion

            #region Show Votes

            if (Config.Ratings.EnableProfileVoting)
            {
                int score = UserVotes.FetchVotesScore(_currentUserSession.Username);
                pnlVotes.Visible = (score > 0);
                lblVotes.Text = score.ToString();
            }
            else
            {
                pnlVotes.Visible = false;
            }

            #endregion

            #region Load New Users

            var nuSearch = new NewUsersSearch
                               {
                                   PhotoReq = Config.Users.RequirePhotoToShowInNewUsers,
                                   ProfileReq = Config.Users.RequireProfileToShowInNewUsers,
                                   UsersSince = _currentUserSession.PrevLogin,
                                   LoginCountThreshold = 1
                               };
            UserSearchResults nuResults = nuSearch.GetResultsFromCache(true);
            pnlNewUsers.Visible = (nuResults != null);
            if (pnlNewUsers.Visible)
            {
                lnkNewUsers.Text = nuResults.Usernames.Length == 1
                                       ? Lang.Trans("There is one new user since your last visit!")
                                       : thereAreTrans + AsBoldHtmlStr(nuResults.Usernames.Length) +
                                           Lang.Trans("new users since your last visit!");
            }
            #endregion

            #region Load Online Users

            var oSearch = new OnlineSearch();
            UserSearchResults oResults = oSearch.GetResults();
            pnlUsersOnline.Visible = (oResults != null);

            if (pnlUsersOnline.Visible)
            {
                lblUsersOnline.Text = oResults.Usernames.Length == 1
                                          ? Lang.Trans("There is one online registered user!")
                                          : thereAreTrans + AsBoldHtmlStr(oResults.Usernames.Length) + Lang.Trans("online registered users!");
            }
            #endregion

            #region Show users broadcasting video

            if (Config.Misc.EnableProfileVideoBroadcast)
            {
                var vbSearch = new VideoBroadcastingSearch();
                UserSearchResults vbResults = vbSearch.GetResults();

                bool hasResults = (vbResults != null);
                pnlUsersBroadcasting.Visible = hasResults;
                if (hasResults)
                {
                    lblUsersBroadcasting.Text = vbResults.Usernames.Length == 1
                                                    ? Lang.Trans("There is one user broadcasting video!")
                                                    : thereAreTrans + AsBoldHtmlStr(vbResults.Usernames.Length)+ Lang.Trans("users broadcasting video!");
                }
            }
            else
            {
                pnlUsersBroadcasting.Visible = false;
            }
            #endregion
            /*
            #region Load Blocked Users

            int blockedUsers = Classes.User.FetchBlockedUsers(_currentUserSession.Username).Count;
            bool hasBlockedUsers = blockedUsers != 0;
            pnlBlockedUsers.Visible = hasBlockedUsers;
            if (hasBlockedUsers)
            {
                lblBlockedUsers.Text = blockedUsers == 1
                                           ? Lang.Trans("There is one blocked user!")
                                           : thereAreTrans + AsBoldHtmlStr(blockedUsers)+Lang.Trans("blocked users!");
            }
            #endregion
            */
            #region Show Unread Messages

            bool hasUnreadMsgs = Message.SearchUnread(_currentUserSession.Username) != null;
            pnlNewMessages.Visible = hasUnreadMsgs;
            if (hasUnreadMsgs)
            {
                int unreadMsgCount = Message.SearchUnread(_currentUserSession.Username).Length;
                lnkNewMessages.Text = Lang.Trans("View");
                lblNewMessages.Text = unreadMsgCount == 1
                                          ? Lang.Trans("You have <b>1</b> unread message!")
                                          : youHaveStrTrans + AsBoldHtmlStr(unreadMsgCount) + Lang.Trans("unread messages!");
            }

            #endregion

            #region Show Relationship Requests

            if (Config.Users.EnableRelationshipStatus)
            {
                int relationshipRequests = Relationship.FetchRequests(_currentUserSession.Username).Length;
                bool hasRelReq = relationshipRequests > 0;
                pnlRelationshipRequests.Visible = hasRelReq;
                if (hasRelReq)
                {
                    lnkRelationshipRequests.Text = Lang.Trans("View");
                    lblRelationshipRequests.Text = relationshipRequests == 1
                                               ? Lang.Trans("You have <b>1</b> relationship request!")
                                               : youHaveStrTrans+ AsBoldHtmlStr(relationshipRequests)+ Lang.Trans("relationship requests!");
                }
            }
            else pnlRelationshipRequests.Visible = false;

            #endregion

            #region Show Friend Requests

            int friendRequests = Classes.User.FetchOpenFriendshipRequestsToUsernme(_currentUserSession.Username).Length;
            if (friendRequests > 0)
            {
                pnlFriendsRequests.Visible = true;

                if (friendRequests == 1)
                {
                    if (lblFriendsRequests != null)
                    {
                        lblFriendsRequests.Text = Lang.Trans("You have <b>1</b> friend request!");
                        lnkFriendsRequests.Text = Lang.Trans("View");
                    }
                    else
                    {
                        lnkFriendsRequests.Text = Lang.Trans("You have <b>1</b> friend request!");
                    }
                }
                else
                {
                    if (lblFriendsRequests != null)
                    {
                        lblFriendsRequests.Text = String.Format(
                            Lang.Trans("You have <b>{0}</b> friend requests!"), friendRequests);
                        lnkFriendsRequests.Text = Lang.Trans("View");
                    }
                    else
                    {
                        lnkFriendsRequests.Text = String.Format(
                            Lang.Trans("You have <b>{0}</b> friend requests!"), friendRequests);
                    }
                }
            }
            else
            {
                pnlFriendsRequests.Visible = false;
            }

            #endregion

            #region Show contest rankings

            if (Config.Ratings.EnablePhotoContests)
            {
                PhotoContestEntry[] entries = PhotoContestEntry.Load(null, null, _currentUserSession.Username, null);
                if (entries != null && entries.Length > 0)
                {
                    var dtRanks = new DataTable();
                    dtRanks.Columns.Add("Rank", typeof(int));
                    dtRanks.Columns.Add("ContestName", typeof(string));

                    foreach (PhotoContestEntry entry in entries)
                    {
                        int rank = PhotoContestEntry.FindRank(entry.ContestId, entry.Id);
                        if (rank > 0)
                        {
                            PhotoContest contest = PhotoContest.Load(entry.ContestId);
                            if (contest.DateEnds.HasValue && contest.DateEnds < DateTime.Now) continue;

                            dtRanks.Rows.Add(new object[] { rank, contest.Name });
                        }
                    }

                    if (dtRanks.Rows.Count > 0)
                    {
                        rptContestsRanks.DataSource = dtRanks;
                        rptContestsRanks.DataBind();
                        rptContestsRanks.Visible = true;
                    }
                }
            }

            #endregion

            #region Show Pending Invitations

            if (Config.Groups.EnableGroups)
            {
                int pendingInvitations = Group.FetchPendingInvitations(_currentUserSession.Username);
                bool hasPendingInv = (pendingInvitations > 0);
                pnlPendingInvitations.Visible = hasPendingInv;
                if (hasPendingInv)
                {
                    lnkPendingInvitations.Text = Lang.Trans("View");
                    lblPendingInvitatinos.Text = (pendingInvitations == 1)
                        ? Lang.Trans("You have <b>1</b> pending invitation!")    
                        : youHaveStrTrans + String.Format(" <b>{0}</b> ", pendingInvitations)+Lang.Trans("pending invitations!");
                }
            }
            #endregion

            #region Show group topic subscriptions

            if (Config.Groups.EnableGroups)
            {
                DataTable dtGroupTopicSubscriptions = new DataTable("GroupTopicSubscriptions");

                dtGroupTopicSubscriptions.Columns.Add("GroupTopicID");
                dtGroupTopicSubscriptions.Columns.Add("GroupTopicName");
                dtGroupTopicSubscriptions.Columns.Add("GroupID");
                dtGroupTopicSubscriptions.Columns.Add("GroupName");

                GroupTopic[] groupTopics =
                    GroupTopic.FetchUpdatedGroupTopicsUserHasSubscribedTo(_currentUserSession.Username);

                foreach (GroupTopic groupTopic in groupTopics)
                {
                    Group group = Group.Fetch(groupTopic.GroupID);

                    if (group != null)
                    {
                        dtGroupTopicSubscriptions.Rows.Add(new object[]
                                                           {
                                                               groupTopic.ID, groupTopic.Name, group.ID, group.Name
                                                           });
                    }
                }

                rptGroupTopicSubscriptions.DataSource = dtGroupTopicSubscriptions;
                rptGroupTopicSubscriptions.DataBind();
                rptGroupTopicSubscriptions.Visible = dtGroupTopicSubscriptions.Rows.Count > 0;
            }

            #endregion

            #region Show Status text

            if (Config.Users.EnableUserStatusText)
            {
                pnlStatusText.Visible = !Config.Misc.SiteIsPaid || Classes.User.IsPaidMember(_currentUserSession.Username);
                lblStatusText.Text = Server.HtmlEncode(_currentUserSession.StatusText) ?? "Not set".Translate();
            }

            #endregion

            #region Notify Facebook for the changed status

            //long? facebookID = _currentUserSession.FacebookID;
            //if (Config.Misc.EnableFacebookIntegration && facebookID.HasValue && facebookID > 0)
            //{
            //    divFaceBookStatusUpdate.Visible = true;
            //    pnlInviteFriendsFromFacebook.Visible = true;
            //}

            #endregion
        }
Example #3
0
        private void BroadcastingUsersSearch()
        {
            pnlQuickSearch.Visible = false;
            pnlCustomSearch.Visible = false;
            pnlSearchResults.Visible = true;
            pnlDistanceSearch.Visible = false;

            VideoBroadcastingSearch search = new VideoBroadcastingSearch();

            UserSearchResults results = search.GetResults();
            SearchResults.ShowLastOnline = true;
            SearchResults.ShowViewedOn = false;
            SearchResults.ShowDistance = true;

            SearchResults.Results = results;
            pnlFilterOnline.Visible = false;
        }
Example #4
0
        private void ProcessBroadcastingUsersSearchRequest()
        {
            VideoBroadcastingSearch search = new VideoBroadcastingSearch();

            UserSearchResults results = search.GetResults();
            SearchResults.ShowLastOnline = true;
            SearchResults.ShowViewedOn = false;
            SearchResults.ShowDistance = true;

            SearchResults.Results = results;
        }