ST_kuserleft.ascx.cs
上传用户:wyx_1982
上传日期:2020-04-18
资源大小:699k
文件大小:2k
- namespace ST_GROUP.EnterpriseOnlineInfoManage
- {
- using System;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- /// <summary>
- /// ST_kuserleft 的摘要说明。
- /// </summary>
- public partial class ST_kuserleft : System.Web.UI.UserControl
- {
- ST_DataBase ST_database = new ST_DataBase();
- protected void Page_Load(object sender, System.EventArgs e)
- {
- // 在此处放置用户代码以初始化页面
- Panel1.Visible = false;
- Panel2.Visible = false;
- if (Session["name"] != null)
- {
- Label1.Text = Session["name"].ToString();
- Panel2.Visible = true;
- }
- else
- {
- Panel1.Visible = true;
- }
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
-
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器
- /// 修改此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- }
- #endregion
- protected void Button1_Click(object sender, System.EventArgs e)
- {
- string ST_strsql;
- ST_strsql = "select * from ST_tUser where ST_username ='" + username.Text + "' and ST_userpassword = '" + userpass.Text + "'";
- DataSet dataSet = new DataSet();
- dataSet=ST_database.GetDataSet(ST_strsql,"usernamelist");
- if(dataSet.Tables["usernamelist"].Rows.Count == 0)
- {
- Response.Write("<script>alert("用户名不存在或密码错误,请确认后再登录!");</script>");
- }
- else
- {
- Session["name"] = username.Text;
- Response.Write("<script>alert("登录成功!");</script>");
- Label1.Text = "<b>" + Session["name"].ToString() + "</b>";
- Panel1.Visible = false;
- Panel2.Visible = true;
- }
- }
- protected void Button2_Click(object sender, System.EventArgs e)
- {
- Response.Redirect("ST_userreg.aspx");
- }
- }
- }