headlogin.ascx.cs

来自「这是一个编好的网上书店系统」· CS 代码 · 共 85 行

CS
85
字号
namespace BookStore.Inc
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		HeadLogin 的摘要说明。
	/// </summary>
	public class HeadLogin : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.HyperLink hlLogin;
		protected System.Web.UI.WebControls.HyperLink hlForgetpass;
		protected System.Web.UI.WebControls.HyperLink hlRegister;
		protected System.Web.UI.WebControls.Label lbWelcome;
		protected System.Web.UI.WebControls.HyperLink hlLogout;
		protected System.Web.UI.WebControls.HyperLink hlManage;
		protected System.Web.UI.WebControls.HyperLink hlMyInfo;

		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack)
			{
				if(Session["UserName"] != null)
				{
					if(!RobertSoft.BookStore.User.IsSupervisor(Session["UserName"].ToString()))
					{
						this.hlForgetpass.Visible = false;
						this.hlLogin.Visible = false;
						this.hlRegister.Visible = false;
						this.lbWelcome.Visible = true;
						this.lbWelcome.Text = "欢迎您:" + Session["UserName"].ToString() +"!";
						this.hlLogout.Visible = true;
						this.hlManage.Visible = false;
					}
					else
					{
						this.hlForgetpass.Visible = false;
						this.hlLogin.Visible = false;
						this.hlRegister.Visible = false;
						this.lbWelcome.Visible = true;
						this.lbWelcome.Text = "欢迎您:" + Session["UserName"].ToString() +"!";
						this.hlLogout.Visible = true;
						this.hlManage.Visible = true;
					}
					
				}
				else
				{
					this.hlForgetpass.Visible = true;
					this.hlLogin.Visible = true;
					this.lbWelcome.Visible = false;			
					this.hlRegister.Visible = true;
					this.hlLogout.Visible = false;
					this.hlManage.Visible = false;
				}
			}
		}

		#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
	}
}

⌨️ 快捷键说明

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