/// <summary> /// Binds the data. /// </summary> private void BindData() { var unverifiedUsers = LegacyDb.user_list(this.PageContext.PageBoardID, null, false); YafContext.Current.PageElements.RegisterJsBlock( "tablesorterLoadJs", JavaScriptBlocks.LoadTableSorter( ".sortable", unverifiedUsers.Rows.Count > 0 ? "headers: { 4: { sorter: false }},sortList: [[3,1],[0,0]]" : null)); // bind list this.UserList.DataSource = unverifiedUsers; this.UserList.DataBind(); // get stats for current board, selected board or all boards (see function) DataRow row = this.GetRepository<Board>().Stats(this.GetSelectedBoardID()); this.NumPosts.Text = "{0:N0}".FormatWith(row["NumPosts"]); this.NumTopics.Text = "{0:N0}".FormatWith(row["NumTopics"]); this.NumUsers.Text = "{0:N0}".FormatWith(row["NumUsers"]); TimeSpan span = DateTime.UtcNow - (DateTime)row["BoardStart"]; double days = span.Days; this.BoardStart.Text = this.GetText("ADMIN_ADMIN", "DAYS_AGO").FormatWith( this.Get<YafBoardSettings>().UseFarsiCalender ? PersianDateConverter.ToPersianDate((DateTime)row["BoardStart"]) : row["BoardStart"], days); if (days < 1) { days = 1; } this.DayPosts.Text = "{0:N2}".FormatWith(row["NumPosts"].ToType<int>() / days); this.DayTopics.Text = "{0:N2}".FormatWith(row["NumTopics"].ToType<int>() / days); this.DayUsers.Text = "{0:N2}".FormatWith(row["NumUsers"].ToType<int>() / days); try { this.DBSize.Text = "{0} MB".FormatWith(LegacyDb.GetDBSize()); } catch (SqlException) { this.DBSize.Text = this.GetText("ADMIN_ADMIN", "ERROR_DATABASESIZE"); } this.BindActiveUserData(); this.DataBind(); }
/// <summary> /// Mod By Touradg (herman_herman) 2009/10/19 /// Shrinking Database /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void btnShrink_Click([NotNull] object sender, [NotNull] EventArgs e) { try { this.txtIndexStatistics.Text = LegacyDb.db_shrink_warning() + @"\r\n\{0}\r\n\".FormatWith(LegacyDb.db_shrink_new()); this.txtIndexStatistics.Text = this.GetText("ADMIN_REINDEX", "INDEX_SHRINK").FormatWith(LegacyDb.GetDBSize()); } catch (Exception error) { this.txtIndexStatistics.Text += this.GetText("ADMIN_REINDEX", "INDEX_STATS_FAIL").FormatWith(error.Message); } }