Beispiel #1
0
        private void SetupTabs()
        {
            _editmode = _editmode || IsMyProfile;

            SetControlStatus();

            tbxName.Text = _user.Username;
            tbxRealName.Text = String.Format("{0} {1}", _user.Firstname, _user.Lastname);
            tbxAge.Text = Common.TranslateNumerals(Common.GetAgeFromDOB(_user.DateOfBirth));
            if (_profile.HideAge && !IsMyProfile)
                tbxAge.Text = @"Mind your own business";
            if (!String.IsNullOrEmpty(_user.MaritalStatus.Trim()))
                ddlMarStatus.SelectedValue = _user.MaritalStatus;
            if (!String.IsNullOrEmpty(_user.Gender.Trim()))
                ddlGender.SelectedValue = _user.Gender;
            tbxState.Text = _user.State;
            tbxCity.Text = _user.City;
            tbxCountry.Text = _user.Country;
            tbxOccupation.Text = _user.Occupation;
            string title = "";
            var rInf = new RankInfo(_user.Username, ref title, _user.PostCount, SnitzCachedLists.GetRankings());
            tbxForumTitle.Text = title;
            if(_user.DateOfBirth.Trim() != "")
            {
                var dateTime = _user.DateOfBirth.ToDateTime();
                if (dateTime != null) DobPicker.SetDOB(dateTime.Value);
            }
            cbxDaylightSaving.Checked = _user.UseDaylightSaving;
            ddlTimeZone.SelectedValue = !String.IsNullOrEmpty(_user.TimeZone) ? _user.TimeZone : Config.TimeZoneString;
            ddTheme.SelectedValue = Config.UserTheme;
            if (_profile.Gravatar)
            {
                var grav = new Gravatar
                {
                    ID = "imgAvatar",
                    Email = _user.Email,

                    DefaultImageBehavior = GravatarDefaultImageBehavior.Default,
                    Rating = GravatarRating.Default
                };
                if(_user.AvatarUrl != "")
                    grav.DefaultImage = _user.AvatarUrl;
                phAvatar.Controls.Add(grav);
            }else
            {
                var img = new Literal {Text = _user.AvatarImg};
                phAvatar.Controls.Add(img);
            }

            cbxReceiveEmail.Checked = _user.ReceiveEmails;
            cbxHideEmail.Checked = _user.HideEmail;
            cbxUseSig.Checked = _user.UseSignature;
            cbxViewSig.Checked = _user.ViewSignatures;
            cbxHideAge.Checked = _profile.HideAge;
            cbxGravatar.Checked = _profile.Gravatar;

            tbxSkype.Text = _profile.Skype;
            tbxYAHOO.Text = _user.Yahoo;
            tbxAIM.Text = _user.AIM;
            tbxSkype.Text = _user.Skype;
            tbxICQ.Text = _user.ICQ;

            repBookMarks.DataSource = _profile.BookMarks;
            repBookMarks.DataBind();

            rptRecentTopics.DataSource = Members.GetRecentTopics(_user.Id,Member);
            rptRecentTopics.DataBind();

            string[] roles = Roles.GetRolesForUser(_profileUser);
            LitRoles.Text = String.Join("<br/>",roles);
            lblUserId.Text += @" : " + _user.Id;
            lblPosts.Text += @" : " + _user.PostCount;
            lblSince.Text += @" : " + Members.MemberSinceTimeAgo(_user);
            lblVisit.Text += @" : " + Members.LastVisitTimeAgo(_user);

            cbxPublic.Checked = _profile.PublicGallery;
            grdSubs.DataSource = Subscriptions.GetMemberSubscriptions(_user.Id);
            grdSubs.DataBind();
        }
Beispiel #2
0
        protected void RptItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;

            AuthorInfo author;
            if (Cache["M" + UserId] == null)
            {
                author = Members.GetAuthor(UserId);
                Cache.Insert("M" + UserId, author, null, DateTime.Now.AddMinutes(10d),
                                System.Web.Caching.Cache.NoSlidingExpiration);
            }
            else
            {
                author = (AuthorInfo)Cache["M" + UserId];
            }
            if ((item.ItemType == ListItemType.Item) || (item.ItemType == ListItemType.AlternatingItem))
            {
                if (author != null)
                {
                    Label litRank = (Label)item.FindControl("MemberTitleLabel");
                    if (litRank != null)
                    {
                        string title = "";
                        RankInfo rInf = new RankInfo(author.Username, ref title, author.PostCount, SnitzCachedLists.GetRankings());
                        if (Config.ShowRankTitle)
                            litRank.Text = title;

                    }
                    ProfileCommon prof = ProfileCommon.GetUserProfile(author.Username);
                    if (prof.Gravatar)
                    {
                        var avatar = (Literal)item.FindControl("AvatarLabel");
                        avatar.Visible = false;
                        var ph = (PlaceHolder) item.FindControl("phAvatar");
                        ph.Visible = true;
                        var grav = new Gravatar {Email = author.Email};
                        if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:"))
                            grav.DefaultImage = author.AvatarUrl;
                        ph.Controls.Add(grav);

                    }
                    else
                    {
                        var avatar = (Literal)item.FindControl("AvatarLabel");
                        var ph = (PlaceHolder)item.FindControl("phAvatar");
                        avatar.Text = author.AvatarImg;
                        avatar.Visible = true;
                        ph.Visible = false;
                    }
                }
            }
        }