namespace SK.MemberWeb.Templates.Default
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using SK.MemberBLL;

	/// <summary>
	///		cu_MemberInfo 的摘要说明。
	/// </summary>
	public class cu_MessageInfo : BaseControl
	{
		protected SK.MemberWeb.Controls.ControlHolder ControlHolder4;
		protected SK.MemberWeb.Controls.ControlHolder ControlHolder5;
		protected SK.MemberWeb.Controls.ControlHolder ControlHolder2;
		protected SK.MemberWeb.Controls.ControlHolder ControlHolder3;
		MessageSystem msg = new MessageSystem();

		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if(!IsPostBack)
			{
				ViewState["MessageID"] = Request.QueryString["id"];
				BindData();
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
		string _MessageSubject;
		public string MessageSubject
		{
			get{return _MessageSubject;}
			set{_MessageSubject=value;}
		}
		string _MessageBody;
		public string MessageBody
		{
			get{return _MessageBody;}
			set{_MessageBody=value;}
		}
		string _SendMemberName;
		public string SendMemberName
		{
			get{return _SendMemberName;}
			set{_SendMemberName=value;}
		}
		DateTime _SendTime;
		public DateTime SendTime
		{
			get{return _SendTime;}
			set{_SendTime=value;}
		}
		private void BindData()
		{
			DataRow dr = msg.Info(ViewState["MessageID"]);
			
			if(dr!=null)
			{
				msg.Read(ViewState["MessageID"]);
				_MessageSubject = dr["Subject"].ToString();
				_MessageBody = dr["Body"].ToString();
				_SendMemberName = dr["SendMemberName"].ToString();
				_SendTime = Convert.ToDateTime(dr["SendTime"]);
			}
			else
				Response.Redirect("MemberMsg.aspx?msg="+Server.UrlEncode("请求的短信不存在"));
		}
	}
}
