default.aspx.cs

来自「明日Asp.net销售管理系统明日Asp.net销售管理系统」· CS 代码 · 共 48 行

CS
48
字号
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 BLL;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ibtLogin_Click(object sender, ImageClickEventArgs e)
    {
        User u = new User();
        u.UserName = tbUserName.Text.Trim();
        u.Password = tbPassword.Text.Trim();
        if(rblUserRole.SelectedValue =="一般用户"){
            u.UserRole = "Normal";
        }
        if (rblUserRole.SelectedValue == "管理人员")
        {
            u.UserRole = "Admin";
        }
        if(u.IsValidUser ()&&u.UserRole =="Admin"){
            Session["UserName"] = u.UserName;
            Session["UserRole"] = u.UserRole;
            Response.Redirect("Admin/AdminCenter.aspx");
        }
        else if (u.IsValidUser() && u.UserRole == "Normal")
        {
            Session["UserName"] = u.UserName;
            Session["UserRole"] = u.UserRole;
            Response.Redirect("ChaXun.aspx");
        }
        else {
            string JS;
            JS = "<script type='text/javascript'>window.alert('用户名或者密码错误!')</script>";
            this.ClientScript.RegisterStartupScript(this.GetType(), "WR", JS);
        }
    }
}

⌨️ 快捷键说明

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