📄 default.aspx.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 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -