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

📄 login.aspx.cs

📁 oa办公系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        //{
        //    this.image.ImageUrl = "image.aspx";
        //}
    }
    protected void btn_login_Click(object sender, EventArgs e)
    {
        if (this.tpassagain.Text ==Session["image"].ToString())
        {
            int uname =Convert.ToInt32( this.tname.Text.Trim());
            string upass = FormsAuthentication.HashPasswordForStoringInConfigFile(this.tpass.Text.Trim().ToString(),"MD5");
            staff staff_login = new staff();
            SqlDataReader dr_staff = staff_login.login(uname, upass);
            if (dr_staff.Read())
            {
                string s_status = dr_staff["s_status"].ToString();
                string r_name = dr_staff["r_name"].ToString();
                if (s_status != "1")
                {
                    Response.Write("<script>alert('该员工已经离职,登录失败!')</script>");
                }
                else
                {
                    Session["uname"] = uname;
                    Session["role"] = r_name;
                    Response.Redirect("index.aspx");
                }
            }
            else
            {
                Response.Write("<script>alert('用户名或密码错误!')</script>");
            }   
        }
        else
        {
            Response.Write("<script>alert('验证码错误!')</script>");
        }   
    }
    protected void btn_cancel_Click(object sender, EventArgs e)
    {
        this.tname.Text = "";
        this.tpass.Text = "";
        this.tpassagain.Text = "";
    }
}

⌨️ 快捷键说明

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