⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 activityquerycontrol.ascx.cs

📁 community server 源码
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CommunityServer.ControlPanel.UI;
using CommunityServer.ControlPanel.Controls;
using CommunityServer.Components;
using ResourceManager = CommunityServer.ControlPanel.Components.ResourceManager;

namespace CommunityServer.ControlPanel.Tools.Reports
{
	/// <summary>
	///		Summary description for BlogActivityQueryControl.
	/// </summary>
	public class ActivityQueryControl : BaseToolsControl
	{

		#region Members

		protected ComponentArt.Web.UI.Calendar BegReportDatePicker;
		protected ComponentArt.Web.UI.Calendar BegReportDateCalendar;
		protected ComponentArt.Web.UI.Calendar EndReportDatePicker;
		protected ComponentArt.Web.UI.Calendar EndReportDateCalendar;
		protected ResourceLinkButton ReportButton;
		protected CommunityServer.ControlPanel.Controls.ResourceControl Resourcecontrol1;
		protected CommunityServer.ControlPanel.Controls.ResourceLinkButton CSVButton;
		protected System.Web.UI.WebControls.HyperLink ImageButton1;
		protected CommunityServer.ControlPanel.Controls.ResourceControl Resourcecontrol8;

		#endregion

		#region Public Properties

		public virtual string DestinationURL 
		{
			get 
			{
				Object state = ViewState["DestinationURL"];
				if ( state != null ) 
				{
					return (String)state;
				}
				return Request.Path;
			}
			set 
			{
				ViewState["DestinationURL"] = value;
			}
		}

		public DateTime BegSearchReportDatePicker
		{
			get{return this.BegReportDatePicker.SelectedDate;}
			set{this.BegReportDatePicker.SelectedDate = value;}
		}

		public DateTime EndSearchReportDatePicker
		{
			get{return this.EndReportDatePicker.SelectedDate;}
			set{this.EndReportDatePicker.SelectedDate = value;}
		}

		public DateTime BegSearchReportDateCalendar
		{
			get{return this.BegReportDateCalendar.SelectedDate;}
			set{this.BegReportDateCalendar.SelectedDate = value;}
		}

		public DateTime EndSearchReportDateCalendar
		{
			get{return this.EndReportDateCalendar.SelectedDate;}
			set{this.EndReportDateCalendar.SelectedDate = value;}
		}

		#endregion

		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			System.Text.StringBuilder url = new System.Text.StringBuilder();
			if (this.DestinationURL.IndexOf("?") > -1)
				url.AppendFormat("{0}&brd={1}&erd={2}&csv=1", this.DestinationURL, HttpUtility.HtmlEncode(BegSearchReportDatePicker.ToShortDateString()), HttpUtility.HtmlEncode(EndSearchReportDatePicker.ToShortDateString()));
			else
				url.AppendFormat("{0}?brd={1}&erd={2}&csv=1", this.DestinationURL, HttpUtility.HtmlEncode(BegSearchReportDatePicker.ToShortDateString()), HttpUtility.HtmlEncode(EndSearchReportDatePicker.ToShortDateString()));
			this.ImageButton1.NavigateUrl = url.ToString(); 
			this.ImageButton1.Text = CommunityServer.ControlPanel.Components.ResourceManager.GetString("CP_Tools_BlogActivityReport_Export");
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.ReportButton.Click += new System.EventHandler(this.ReportButton_Click);
			this.Load += new System.EventHandler(this.Page_Load);

			int MonthDays = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
			int DaysUsed = DateTime.Now.Day;
			int DaysRemain = MonthDays - DaysUsed;

			this.BegSearchReportDatePicker = DateTime.Now.AddDays(-DaysUsed + 1); //DateTime.Now.Subtract(System.TimeSpan.FromDays(Convert.ToDouble(DateTime.Now.Day - 1)));
			this.BegSearchReportDateCalendar = DateTime.Now.AddDays(-DaysUsed + 1); //DateTime.Now.Subtract(System.TimeSpan.FromDays(Convert.ToDouble(DateTime.Now.Day - 1)));
			this.EndSearchReportDatePicker = DateTime.Now.AddDays(DaysRemain);
			this.EndSearchReportDateCalendar = DateTime.Now.AddDays(DaysRemain);
		}
		#endregion

		private void ReportButton_Click(object sender, EventArgs e)
		{
			System.Text.StringBuilder url = new System.Text.StringBuilder();
			if (this.DestinationURL.IndexOf("?") > -1)
				url.AppendFormat("{0}&brd={1}&erd={2}", this.DestinationURL, HttpUtility.HtmlEncode(BegSearchReportDatePicker.ToShortDateString()), HttpUtility.HtmlEncode(EndSearchReportDatePicker.ToShortDateString()));
			else
				url.AppendFormat("{0}?brd={1}&erd={2}", this.DestinationURL, HttpUtility.HtmlEncode(BegSearchReportDatePicker.ToShortDateString()), HttpUtility.HtmlEncode(EndSearchReportDatePicker.ToShortDateString()));

			Response.Redirect(url.ToString());
		}

//		private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
//		{
//			System.Text.StringBuilder url = new System.Text.StringBuilder();
//			url.AppendFormat("{0}?brd={1}&erd={2}&csv=1", this.DestinationURL, HttpUtility.HtmlEncode(BegSearchReportDatePicker.ToShortDateString()), HttpUtility.HtmlEncode(EndSearchReportDatePicker.ToShortDateString()));
//
//			Response.Redirect(url.ToString());
//		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -