Beispiel #1
0
        private bool login()
        {
            AdminBusiness adminBusiness = new AdminBusiness();

            if (Session["adminmail"] == null || Session["adminpass"] == null)
            {
                return(false);
            }
            if (adminBusiness.checkAdmin((string)Session["adminmail"], (string)Session["adminpass"]) == 0)
            {
                return(false);
            }
            return(true);
        }
 protected void ButtonLogin_Click(object sender, EventArgs e)
 {
     if (adminBusiness.checkAdmin(TextUser.Text, TextPass.Text) != 0)
     {
         Admin admin = new Admin();
         admin = adminBusiness.login(TextUser.Text, TextPass.Text);
         Session["adminmail"] = admin.mail;
         Session["adminpass"] = admin.pass;
         Response.Redirect("TiendaAdmin.aspx");
     }
     else if (usuarioBusiness.CheckAlta(TextUser.Text, TextPass.Text) != 0)
     {
         Usuario usuario = new Usuario();
         usuario             = usuarioBusiness.login(TextUser.Text, TextPass.Text);
         Session["usermail"] = usuario.mail;
         Session["userpass"] = usuario.pass;
         Response.Redirect("Tienda.aspx");
     }
     else
     {
         Response.Redirect("MainPage.aspx?error=404");
     }
 }