Exemple #1
0
        protected void btnadmin_Click(object sender, EventArgs e)
        {
            CatalogAdministrador catdmin = new CatalogAdministrador();
            Administrador        admin   = new Administrador();
            bool ok = catdmin.LoginAdmin(txtrut.Text, txtpass.Text);

            if (ok)
            {
                Session["ok"] = true;
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('LOGIN OK')", true);
                admin = catdmin.GetNameAdmin(txtrut.Text, txtpass.Text);
                Session["NOM_ADMIN"] = admin.Nom_admin.ToString();
                Response.Redirect("MainAdmin.aspx");
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('LOGIN IS WRONG')", true);
            }
        }
Exemple #2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (txtpassword.Text == txtpassword2.Text)
     {
         CatalogAdministrador catad = new CatalogAdministrador();
         Administrador        admin = new Administrador(txtrut.Text, txtnombre.Text, txtpassword.Text);
         catad.insertAdmin(admin);
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Administrador agregado correctamente')", true);
         txtrut.Text      = "";
         txtnombre.Text   = "";
         txtpassword.Text = "";
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Las contraseñas no coinciden')", true);
         txtpassword2.Text = "";
         txtpassword.Text  = "";
     }
 }
Exemple #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            CatalogAdministrador catad = new CatalogAdministrador();

            if (catad.ComprobarFormatoEmail(txtcorreo.Text) == false)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error en el formato del correo ingresado')", true);
            }
            else
            {
                if (txtpass.Text == txtpass2.Text)
                {
                    CatalogRestaurant catrest      = new CatalogRestaurant();
                    DateTime          dateatencion = Convert.ToDateTime(this.txtatencion.Text);
                    DateTime          datecierre   = Convert.ToDateTime(this.txtcierre.Text);
                    Restaurant        rest         = new Restaurant(this.txtpass.Text, this.txtnombre.Text, this.txtdir.Text, this.txtciudad.Text, dateatencion, datecierre, this.txtcorreo.Text, this.txttel.Text);
                    catrest.insertRest(rest);
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Restaurant agregado correctamente')", true);
                    txtpass.Text     = "";
                    txtnombre.Text   = "";
                    txtdir.Text      = "";
                    txtcierre.Text   = "";
                    txtatencion.Text = "";
                    txtcierre.Text   = "";
                    txtcorreo.Text   = "";
                    txttel.Text      = "";
                    txtpass2.Text    = "";
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error! Las contraseñas no coinciden.')", true);
                    txtpass.Text  = "";
                    txtpass2.Text = "";
                }
            }
        }
Exemple #4
0
        protected void Aceptar_Click(object sender, EventArgs e)
        {
            CatalogAdministrador catadmin = new CatalogAdministrador();

            if (catadmin.ValidaRut(txtrut.Text) == true && txtpass.Text == txtpass2.Text)
            {
                CatalogUsuario catusu = new CatalogUsuario();

                Usuario usu = new Usuario(this.txtrut.Text, this.txtnombre.Text, this.txtpass.Text);
                catusu.insertUsuario(usu);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Rut valido')", true);
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Usuario Registrado satisfactoriamente')", true);
                txtrut.Text    = "";
                txtpass.Text   = "";
                txtnombre.Text = "";
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Rut no valido')", true);
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error! las contraseñas no coinciden')", true);
                txtpass.Text  = "";
                txtpass2.Text = "";
            }
        }