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_ChangeMemberType 的摘要说明。
	/// </summary>
	public class cu_ChangeMemberType : BaseControl
	{
		protected SK.MemberWeb.Controls.ControlHolder ControlHolder3;
		protected SK.MemberWeb.Controls.ControlHolder ControlHolder2;
		protected System.Web.UI.WebControls.RadioButton rbtnCompany;
		protected System.Web.UI.WebControls.RadioButton rbtnMember;
		protected System.Web.UI.WebControls.Button btnSave;
		protected SK.MemberWeb.Controls.ControlHolder ControlHolder1;
		MemberSystem member = new MemberSystem();

		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if(!IsPostBack)
			{
				if(member.MemberHasCompany(this.CurrentMemberID))
					Response.Redirect(this.Root+"Users/Default.aspx");
			}
		}

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

		}
		#endregion

		private void btnSave_Click(object sender, System.EventArgs e)
		{
			member.UpdateCompany(this.CurrentMemberID,rbtnCompany.Checked);
			this.AlertAndRedir("设置成功！",this.Root +"users/ProfileEdit.aspx");
		}
	}
}
