Example #1
0
        private void btnSalir_Click(object sender, EventArgs e)
        {
            frmTransfer log = new frmTransfer(nombre);

            this.Hide();
            FrmUsuario log1 = new FrmUsuario(nombre);

            log1.Show();
        }
Example #2
0
        private void btnSalir_Click(object sender, EventArgs e)
        {
            Login log = new Login();

            log.Show();

            FrmUsuario log1 = new FrmUsuario(nombre);

            this.Hide();
        }
Example #3
0
        private void btnSalir_Click(object sender, EventArgs e)
        {
            FrmUsuario log = new FrmUsuario(nombre);

            log.Show();

            frmMovimientos log1 = new frmMovimientos(nombre);

            this.Hide();
        }
Example #4
0
        public void btnIngresar_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(a);
            String nombre = txbUsuario.Text;
            String clave  = txbContraseña.Text;
            String tipo   = "admin";


            string EspacioEnBlanco = "";

            if (txbUsuario.Text == EspacioEnBlanco || txbContraseña.Text == EspacioEnBlanco)
            {
                if (txbUsuario.Text == EspacioEnBlanco)
                {
                    MessageBox.Show("No Ingreso nada En El Campo Usuario");
                }
                if (txbContraseña.Text == EspacioEnBlanco)
                {
                    MessageBox.Show("No Ingreso nada En El Campo Contraseña");
                }
            }
            else
            {
                if (tipo == "admin")
                {
                    this.oleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM Usuarios WHERE Usuario = '" + nombre + "' and Contraseña ='" + clave + "' and TipoPersona ='" + tipo + "';";
                    this.oleDbConnection1.Open();

                    this.oleDbDataAdapter1.SelectCommand.Connection = oleDbConnection1;

                    OleDbDataReader reader = this.oleDbDataAdapter1.SelectCommand.ExecuteReader();

                    Boolean ExistenciaRegistro = reader.HasRows;


                    if (ExistenciaRegistro)
                    {
                        while (reader.Read())
                        {
                            FrmAdmin log = new FrmAdmin();
                            log.Show();
                            Login cerrar = new Login();
                            this.Hide();
                        }
                    }
                    else
                    {
                        this.oleDbConnection1.Close();
                        tipo = "user";
                    }
                }
                if (tipo == "user")
                {
                    this.oleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM Usuarios WHERE Usuario = '" + nombre + "' and Contraseña ='" + clave + "' and TipoPersona ='" + tipo + "';";
                    this.oleDbConnection1.Open();

                    this.oleDbDataAdapter1.SelectCommand.Connection = oleDbConnection1;

                    OleDbDataReader reader = this.oleDbDataAdapter1.SelectCommand.ExecuteReader();

                    Boolean ExistenciaRegistro = reader.HasRows;

                    if (ExistenciaRegistro)
                    {
                        while (reader.Read())
                        {
                            FrmUsuario log = new FrmUsuario(nombre);
                            log.Show();
                            Login cerrar = new Login();
                            this.Hide();
                        }
                    }
                    else
                    {
                        this.oleDbConnection1.Close();

                        this.oleDbDataAdapter1.SelectCommand.CommandText = "SELECT Contraseña FROM Usuarios WHERE Usuario = '" + nombre + "';";
                        this.oleDbConnection1.Open();

                        this.oleDbDataAdapter1.SelectCommand.Connection = oleDbConnection1;

                        OleDbDataReader reader1             = this.oleDbDataAdapter1.SelectCommand.ExecuteReader();
                        Boolean         ExistenciaRegistro1 = reader1.HasRows;
                        if (ExistenciaRegistro1)
                        {
                            while (reader1.Read())
                            {
                                MessageBox.Show("Contraseña Incorrecta.");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Usuario no Existe");
                        }
                        this.oleDbConnection1.Close();
                    }
                }
            }
        }