📄 overviewactivityreport.aspx.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.ControlPanel.UI;
using CommunityServer.Controls;
using CommunityServer.Reporting;
using CA = ComponentArt.Web.UI;
using ResourceLinkButton = CommunityServer.ControlPanel.Controls.ResourceLinkButton;
using ResourceManager = CommunityServer.ControlPanel.Components.ResourceManager;
namespace CommunityServer.ControlPanel.Tools.Reports
{
/// <summary>
/// Summary description for BlogActivityReport.
/// </summary>
public class OverviewActivityReport : BaseToolsPage
{
#region Members
protected ResourceLinkButton FilterButton;
protected Modal Modal1;
protected ActivityQueryControl ForumActivityQueryControl1;
protected Label lblUserCount;
protected Label lblThreadCount;
protected Label lblPostCount;
string BegReportDate;
string EndReportDate;
protected CommunityServer.ControlPanel.Controls.ControlPanelSelectedNavigation SelectedNavigation1;
protected CommunityServer.ControlPanel.Controls.ResourceControl RegionTitle;
protected CommunityServer.Controls.MPContent DescriptionRegion;
protected CommunityServer.ControlPanel.Controls.ResourceControl UniqueCount;
protected CommunityServer.Controls.MPContent TaskRegion;
protected CommunityServer.Controls.MPContainer MPContainer;
protected CommunityServer.ControlPanel.Controls.ResourceControl Summary;
protected CommunityServer.Controls.StatusMessage Status;
#endregion
override protected void OnInit(EventArgs e)
{
if (Telligent.Registration.CommunityServer.IsStandard)
{
this.Load += new EventHandler(this.Page_Load);
}
else
{
Status.Success = false;
Status.IsLicenseMessage = true;
Status.Text = CommunityServer.ControlPanel.Components.ResourceManager.GetString("CP_Tools_OverviewActivityReport_LicenseNotAvailable");
Status.Visible = true;
}
base.OnInit(e);
}
private void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack && !this.IsCallBack)
{
CSContext context = CSContext.Current;
if(context.QueryString["csv"] != null && context.QueryString["csv"].ToString() == "1")
BuildExcelDoc();
else
Bind();
}
}
private void Bind()
{
OverviewActivityResultSet resultSet = BuildReportData();
lblUserCount.Text = resultSet.NewUsers.ToString();
lblThreadCount.Text = resultSet.NewThreads.ToString();
lblPostCount.Text = resultSet.NewPosts.ToString();
}
private OverviewActivityResultSet BuildReportData()
{
CSContext context = CSContext.Current;
BegReportDate = "1/1/1900";
EndReportDate = "1/1/1900";
if (Globals.IsDate(context.QueryString["brd"]))
{
BegReportDate = context.QueryString["brd"];
ForumActivityQueryControl1.BegSearchReportDatePicker = DateTime.Parse(BegReportDate);
ForumActivityQueryControl1.BegSearchReportDateCalendar = DateTime.Parse(BegReportDate);
}
if (Globals.IsDate(context.QueryString["erd"]))
{
EndReportDate = context.QueryString["erd"];
ForumActivityQueryControl1.EndSearchReportDatePicker = DateTime.Parse(EndReportDate);
ForumActivityQueryControl1.BegSearchReportDateCalendar = DateTime.Parse(EndReportDate);
}
return ReportingSqlDataProvider.GetOverviewActivityResults(BegReportDate, EndReportDate);
}
#region Events
#endregion
private void InitializeComponent()
{
}
private void BuildExcelDoc()
{
CSContext context = CSContext.Current;
BegReportDate = "1/1/1900";
EndReportDate = "1/1/1900";
if (Globals.IsDate(context.QueryString["brd"]))
BegReportDate = context.QueryString["brd"];
if (Globals.IsDate(context.QueryString["erd"]))
EndReportDate = context.QueryString["erd"];
string CSV = ReportingSqlDataProvider.GetForumPostActivityResultsCSV(BegReportDate, EndReportDate);
Response.ContentType = "Application/x-msexcel";
Response.AddHeader("content-disposition", "attachment; filename=\"ForumPostActivityReport.csv\"");
Response.Write(CSV);
Response.End();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -