Exemplo n.º 1
0
    protected void Button_login_Click(object sender, EventArgs e)
    {
        UsFuns uf   = new UsFuns();
        User   lgre = uf.UserLogin(this.TextBox_account.Text, this.TextBox_passwd.Text);

        if (lgre != null)
        {
            Session["login"] = lgre.Username;
            if (lgre.Admin == '0')
            {
                Response.Write("<script language='javascript'>alert('Welcome System Manager'); location.href='manager.aspx'</script>");
            }
            else if (lgre.Admin == '2')
            {
                Response.Write("<script language='javascript'>alert('Welcome " + lgre.Name + "'); location.href='employee.aspx'</script>");
            }
            else
            {
                Response.Write("<script language='javascript'>alert('Login Success!'); location.href='petnote.aspx'</script>");
            }
        }
        else
        {
            Session["login"] = null;
            Response.Write("<script language='javascript'>alert('Login Faild, Please Try Again.'); location.href='login.aspx'</script>");
        }
    }
Exemplo n.º 2
0
    protected void Button_login_Click(object sender, EventArgs e)
    {
        SqlFuns sf    = new SqlFuns();
        UsFuns  uf    = new UsFuns();
        Member  login = uf.UserLogin(TextBox_usr.Text, TextBox_pwd.Text);

        if (login != null)
        {
            Response.Write("<script language='javascript'>alert('Login Succed.'); location.href='Manage.aspx'</script>");
        }
        else
        {
            Response.Write("<script language='javascript'>alert('Failed!!! Please login again.')</script>");
        }
    }