protected void Page_Load(object sender, EventArgs e) { IUserService userService = new UserService(); string email = Request.Params["email"]; string password = Request.Params["pwd"]; if (userService.CheckUserByEmailAndPassword(email, password)) { User user = userService.GetUser(email); int role = (int)user.role; Session["user"] = email; Session["uid"] = user.Id; if (role == 0) { //个人用户 Response.Redirect("user-index.aspx"); } else if (role == 1) { //企业用户,但是还没有激活 Response.Redirect("company-register.aspx"); } else if (role == 2) { //企业用户,已经激活 Response.Redirect("hr-recruit-list.aspx"); } //Response.Write("登录成功"+role); } else Response.Write("登录失败"); }
protected void Page_Load(object sender, EventArgs e) { String email = Request.Params["email"]; String pwd = Request.Params["pwd"]; int flag = Convert.ToInt32(Request.Params["regflag"]); //Response.Write(flag+" " + Request.Params["regflag"]); IUserService userService = new UserService(); int res = userService.Register(email,pwd,flag); if (res == 0) { //当登录成功时 Response.Write("恭喜,注册成功!"); } else if(res == 1) { Response.Write("用户已经存在!"); } else if (res == 2) { Response.Write("发送邮件失败!"); } else if (res == 3) { Response.Write("注册失败!"); } else { Response.Write("错误!"); } }
private void SetData() { IUserService userService = new UserService(); string email = Session["user"].ToString(); name = userService.GetUser(email).name; if (name == null) { name = email; } }