public int Login() { string username = HttpContextHelper.InputText(Request.Form["username"], 100); string password = HttpContextHelper.InputText(Request.Form["password"], 100); BLL.Users bll = new BLL.Users(); if (bll.Login(username, password)) { return 1; } return 0; }
protected void Image1_ServerClick(object sender, ImageClickEventArgs e) { //userBll string loginName = this.TextBox1.Text.Trim(); string password = this.TextBox2.Text.Trim(); if (string.IsNullOrEmpty(loginName) || string.IsNullOrEmpty(password)) { lb_msg.Text = "用户名/密码不能为空"; } else { Model.Users user = userBll.Login(loginName, password); if (user == null) { lb_msg.Text = "用户名/密码错误"; } else { Session["SHUUser"] = user; //用户类型 99:管理员 0员工1管理 if (user.UserType == 99) { Response.Redirect("~/admin/index.aspx"); } if (user.UserType == 0) { Response.Redirect("~/Home.aspx"); } if (user.UserType == 1) { Response.Redirect("~/Manager.aspx"); } else { Jscript.AlertAndRedirect("用户信息错误", "/Login.aspx"); } } } }