/// <summary> /// Renders the Most Active Users Card. /// </summary> /// <param name="writer"> /// The writer. /// </param> protected override void Render([NotNull] HtmlTextWriter writer) { var rankDt = this.Get <IDataCache>().GetOrSet( Constants.Cache.MostActiveUsers, () => this.GetRepository <User>().ActivityRankAsDataTable( this.PageContext.PageBoardID, DateTime.UtcNow.AddDays(-this.LastNumOfDays), this.DisplayNumber), TimeSpan.FromMinutes(5)); if (!rankDt.HasRows()) { return; } writer.BeginRender(); writer.Write(@"<div class=""card mb-3"">"); writer.Write(@"<div class=""card-header""><span class=""fa-stack"">"); writer.Write( @"<i class=""fas fa-chart-line fa-2x fa-fw text-secondary""></i></span> {0}</div>", this.GetTextFormatted("MOST_ACTIVE", this.LastNumOfDays)); writer.Write(@"<div class=""card-body"">"); writer.Write(@"<ol class=""mb-0"">"); rankDt.AsEnumerable().ForEach( row => { writer.Write("<li>"); // render UserLink... var userLink = new UserLink { UserID = row.Field <int>("ID"), }; userLink.RenderControl(writer); writer.Write(" "); writer.Write($@"({row.Field<int>("NumOfPosts")})"); writer.Write("</li>"); }); writer.Write("</ol>"); writer.Write("</div></div>"); writer.EndRender(); }
/// <summary> /// The attach. /// </summary> /// <param name="userLinkControl"> /// The user link control. /// </param> public void Attach([NotNull] UserLink userLinkControl) { this.ButtonId = userLinkControl.ClientID; }