protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.TrophiesEnabled); achivsList = TableHelper.SelectRows <Achievement>(TableHelper.MakeDictionary("AchievementStatus", (int)AchievmentStatus.Visible)); allAchievementsEverPossible = TableHelper.SelectAllRows <Achievement>(); Member User = Member.Logged(Context); //Write data AchivCount.Text = (User.Achievements.Count - 1).ToString(); AchivTotalCount.Text = achivsList.Count.ToString(); //New achievements if (User.UnspottedAchievements > 0) { WarningPanel.Visible = true; WarningLiteral.Text = L1.NEWACHIEVEMENTS; User.UnspottedAchievements = 0; User.Save(); //Refresh notification NotificationManager.RefreshWithMember(NotificationType.NewAchievements, User); } //Display user achievements foreach (Achievement achiv in allAchievementsEverPossible) { if (achiv.AchievmentStatus == AchievmentStatus.Visible) { AllAchivsLiteral.Text += HtmlCreator.GenerateAllAcheivementHTML(achiv); } if (User.Achievements.Contains(achiv.Id)) { UserAchivsLiteral.Text += HtmlCreator.GenerateUserAcheivementHTML(achiv); } } //If no achivs write message if (User.Achievements.Count == 1) { UserAchivsLiteral.Text = L1.NOACHIVS; } }
public static string GenerateForumUserInfo(string username) { var sb = new System.Text.StringBuilder(); if (username != "Guest") //We display nothing for guest users { Member User = new Member(username); string avatarUrl = (HttpContext.Current.Handler as System.Web.UI.Page).ResolveClientUrl(User.AvatarUrl); sb.Append("<div class=\"section\"><img src=\"") .Append(avatarUrl) .Append("\" width=\"70px\" height=\"70px\" style=\"border: 1px solid #666\"/></div><br/>"); if (User.Achievements.Count > 1) { //We have some achievements sb.Append("<div class=\"section\">"); foreach (int achivId in User.Achievements) { //Empty list contains only -1 if (achivId != -1) { Achievement achiv = new Achievement(achivId); sb.Append(HtmlCreator.GenerateUserAcheivementHTML(achiv, true)); } } sb.Append("</div><br/>"); } sb.Append("<div class=\"section\">Membership: ") .Append(User.FormattedMembershipName) .Append("<br/><img src=\"Images/Flags/") .Append(User.CountryCode) .Append(".png\" class=\"imagemiddle\" /> ") .Append(User.Country) .Append("</div><br/>"); } return(sb.ToString()); }