Пример #1
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        user          = new UsrInfo();
        user.UsrName  = txtUsername.Text;
        user.UsrPwd   = txtPwd.Text;
        user.UsrEmail = txtEmail.Text;

        bool result = UsrInfoBLL.login(txtUsername.Text, txtPwd.Text);

        if (result)
        {
            Response.Write("<script type='text/javascript'>alert('错误,已存在同样名称');</script>");
        }
        else
        {
            result = UsrInfoBLL.AddUser(user);
            if (result)
            {
                Response.Write("<script type='text/javascript'>alert('注册成功');</script>");
                Server.Transfer("Default.aspx");
            }
            else
            {
                Response.Write("<script type='text/javascript'>alert('注册失败');</script>");
            }
        }
    }
Пример #2
0
 protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
 {
     bool result=UsrInfoBLL.login(username.Text, password.Text);
     if (result)
     {
         Session["usrName"] = username.Text;
         Session.Timeout = 2;
         Response.Redirect("./home_page.aspx");
         Response.Write("<script type='text/javascript'>alert('登录成功');</script>");
     }
     else
     {
         Response.Write("<script type='text/javascript'>alert('登录失败');</script>");
     }
 }