示例#1
0
        protected void btnAcceder_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtUsuario.Text == "" || txtContrasena.Text == "")
                {
                    _kernel.MessageBox("Es necesario que proporcione todos sus datos.", this, this);
                }

                else
                {
                    string[] datos = _bridge.ObtenerAcceso(new DatosClientes {
                        Usuario = txtUsuario.Text, Contrasena = _secret.Cifrar(txtContrasena.Text)
                    });

                    if (datos != null)
                    {
                        Session["IdUsuario"]  = Convert.ToInt32(datos[0]);
                        Session["Usuario"]    = datos[1];
                        Session["Privilegio"] = datos[2];

                        Thread.Sleep(2000);

                        Response.Redirect("~/Default.aspx");
                    }

                    else
                    {
                        _kernel.MessageBox("Datos incorrectos, verifique por favor", this, this);
                    }
                }
            }
            catch (Exception ex)
            {
                _kernel.MessageBox(ex.ToString(), this, this);
            }
        }
示例#2
0
        protected void btnRegistrarte_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNombre.Text == "" || txtApellidos.Text == "" || txtDomicilio.Text == "" || txtCorreo.Text == "" || txtTelefono.Text == "" || txtUsuario.Text == "" || txtPassword.Text == "")
                {
                    _kernel.MessageBox("Todos los datos son necesarios para realizar el registro", this, this);
                }

                else
                {
                    if (_bridge.AltaCliente(new DatosClientes {
                        Nombre = txtNombre.Text, Apellidos = txtApellidos.Text, Domicilio = txtDomicilio.Text, Correo = txtCorreo.Text, Tarjeta = 1, Ano = 2017, Contrasena = _secret.Cifrar(txtPassword.Text), CVV = 1, Mes = 1, Foto = new byte[0], Telefono = txtTelefono.Text, Privilegio = "Cliente", Usuario = txtUsuario.Text
                    }))
                    {
                        Response.Redirect("~/Default.aspx");
                    }

                    else
                    {
                        _kernel.MessageBox("Ocurrio un error al registrarte, verifica los datos", this, this);
                    }
                }
            }
            catch (Exception ex)
            {
                _kernel.MessageBox(ex.ToString(), this, this);
            }
        }