protected void BtnLogin_Click(object sender, EventArgs e) { this.Session.RemoveAll(); ManagerBll managerBll = new ManagerBll(); ManagerEnitity managerEntity = new ManagerEnitity(); UserEntity uen = new UserEntity(); UserBll ubll = new UserBll(); ClientEntity clientEntity = new ClientEntity(); ClientBll clientBll = new ClientBll(); // StudentBll sbll = new StudentBll(); // StudentEntity sen = new StudentEntity(); if (RBtnUser.Checked) { uen.UserID = TxtID.Text.Trim(); uen.UserPwd = MD5(TxtPwd.Text.Trim()); //if (ubll.IsOverDate(uen)) //{ if (ubll.Validate_Login(uen)) { Session.RemoveAll(); Session["UserID"] = uen.UserID;//建议存放数据表中的主键值 Response.Redirect("Users/UserIndex.aspx"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('密码错误!')</script>"); } } if (this.RBtnManager.Checked) { managerEntity.ManagerID = this.TxtID.Text.Trim(); managerEntity.ManagerPwd = this.MD5(this.TxtPwd.Text.Trim()); // Response.Write(teacherEntity.ManagerPwd); if (managerBll.Validate_Login(managerEntity)) { this.Session.RemoveAll(); this.Session["ManagerID"] = managerEntity.ManagerID; base.Response.Redirect("default.aspx"); } } if (RBtnContact.Checked) { clientEntity.ClientID = this.TxtID.Text.Trim(); clientEntity.ClientPwd = this.MD5(this.TxtPwd.Text.Trim()); // Response.Write(teacherEntity.ManagerPwd); if (clientBll.Validate_Login(clientEntity)) { this.Session.RemoveAll(); this.Session["ClientID"] = clientEntity.ClientID; base.Response.Redirect("Contact/default.aspx"); } } }
protected void BtnLogin_Click(object sender, EventArgs e) { this.Session.RemoveAll(); ManagerBll managerBll = new ManagerBll(); ManagerEnitity managerEntity = new ManagerEnitity(); // UserEntity userEntity = new UserEntity(); // UserBll userBll = new UserBll(); // StudentBll studentBll = new StudentBll(); // StudentEntity studentEntity = new StudentEntity(); if (this.RBtnAdmin.Checked) { // userEntity.UserID = this.TxtID.Text.Trim(); // userEntity.UserPwd = this.MD5(this.TxtPwd.Text.Trim()); // if (userBll.Validate_Login(userEntity)) // { // this.Session.RemoveAll(); // this.Session["UserID"] = userEntity.UserID; // base.Response.Redirect("Users/UserIndex.aspx"); // } // else // { // this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('密码错误!')</script>"); // } } if (this.RBtnTeacher.Checked) { managerEntity.ManagerID = this.TxtID.Text.Trim(); managerEntity.ManagerPwd = this.MD5(this.TxtPwd.Text.Trim()); // Response.Write(teacherEntity.ManagerPwd); if (managerBll.Validate_Login(managerEntity)) { this.Session.RemoveAll(); this.Session["ManagerID"] = managerEntity.ManagerID; base.Response.Redirect("default.aspx"); } } // if (this.RBtnStudent.Checked) // { // studentEntity.StudentID = this.TxtID.Text.Trim(); // studentEntity.StudentPwd = this.MD5(this.TxtPwd.Text.Trim()); // if (studentBll.Validate_Login(studentEntity)) // { // this.Session.RemoveAll(); // this.Session["StudentID"] = studentEntity.StudentID; // base.Response.Redirect("Student.aspx"); // return; // } this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('密码错误')</script>"); // } }