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

📄 logi.ascx.cs

📁 个人作品
💻 CS
字号:
namespace webjiuye
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;

	/// <summary>
	///		login 的摘要说明。
	/// </summary>
	public class login : System.Web.UI.UserControl
	{
		protected System.Web.UI.WebControls.LinkButton benke;
		protected System.Web.UI.WebControls.LinkButton yanjiu;
		protected System.Web.UI.WebControls.Panel Panel1;
		protected System.Web.UI.WebControls.Panel Panel2;
		protected System.Web.UI.WebControls.Panel Panel3;
		protected System.Web.UI.WebControls.Button log;
		protected System.Web.UI.WebControls.TextBox pwdtxt;
		protected System.Web.UI.WebControls.TextBox useridtxt;
		protected System.Web.UI.WebControls.LinkButton logout1;
		protected System.Web.UI.WebControls.LinkButton logout2;
		protected System.Web.UI.WebControls.LinkButton gaozhi;

		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			try
			{
				if(Session["userin"].ToString()=="yes")
				{
					if(Session["role"].ToString()=="")
					{
						this.Panel1.Visible=true;
						this.Panel3.Visible=false;
					}
					else
					{
						this.Panel2.Visible=true;
						this.Panel3.Visible=false;
					}
				}
				else
				{
					this.Panel3.Visible=true;
					this.Panel1.Visible=false;
					this.Panel2.Visible=false;
				}
			}
			catch
			{}
		}

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

		}
		#endregion

		private void log_Click(object sender, System.EventArgs e)
		{
			if ((this.useridtxt.Text=="")||(this.pwdtxt.Text=="")) 
			{
				Response.Write("<script>alert('学号、密码不能有为空!')</script>");
				return;
			}
			else
			{
				loginDB login = new loginDB();
				DataSet ds = new DataSet();
				ds = login.GetUser(this.useridtxt.Text);
				if(this.pwdtxt.Text==ds.Tables[0].Rows[0]["pwd"].ToString().Trim())
				{
					Session["userin"]="yes";
					Session["role"]=ds.Tables[0].Rows[0]["role"].ToString().Trim();
					Session["xydm"]=ds.Tables[0].Rows[0]["xydm"].ToString().Trim();
				}
				else
					Response.Write("<script>alert('用户名或密码错误!')</script>");
				try
				{
					if(Session["userin"].ToString()=="yes")
					{
						if(Session["role"].ToString()=="")
						{
							this.Panel1.Visible=true;
							this.Panel3.Visible=false;
						}
						else
						{
							this.Panel2.Visible=true;
							this.Panel3.Visible=false;
						}
					}
					else
					{
						this.Panel3.Visible=true;
						this.Panel1.Visible=false;
						this.Panel2.Visible=false;
					}
				}
				catch
				{}
			}
		
		}

		private void logout1_Click(object sender, System.EventArgs e)
		{
			Session["userin"]="no";
			Session["role"]=null;
			Response.Redirect("login.aspx");
		}

		private void logout2_Click(object sender, System.EventArgs e)
		{
			Session["userin"]="no";
			Session["role"]=null;
			Response.Redirect("login.aspx");
		}

		private void benke_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("stuinfocontrol.aspx");
		}
	}
}

⌨️ 快捷键说明

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