Пример #1
0
    protected void btnlogin_Click(object sender, EventArgs e)
    {
        if (txtEmail.Text.Trim() == "") {
            Alert.Show("กรุณากรอก Email ด้วย !!!");
            txtEmail.Focus();
            return;
        }
        if (txtPassword.Text.Trim() == "") {
            Alert.Show("กรุณากรอก รหัสผ่าน ด้วย !!!");
            txtPassword.Focus();
            return;
        }

        FruitService service = new FruitService();
        MemberFruit  user = service.CheckLogin(txtEmail.Text.Trim() , txtPassword.Text.Trim());
        if (user != null)
        {
            Session[SessionKey.USERLOGIN] = user;
            Response.Redirect("index.aspx");

        }
        else
        {
            Session[SessionKey.USERLOGIN] = null;
            Response.Redirect("index.aspx");
        }
    }