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("登录失败");
        }
Beispiel #2
0
 private void SetData()
 {
     IUserService userService = new UserService();
     string email = Session["user"].ToString();
     name = userService.GetUser(email).name;
     if (name == null)
     {
         name = email;
     }
 }