Beispiel #1
0
        private void btnVolver_Click(object sender, EventArgs e)
        {
            this.Close();
            FormPrincipal abrir = new FormPrincipal();

            abrir.Show();
        }
Beispiel #2
0
        void acceso()
        {
            if (tbUser.Text.Length > 0 || tbPass.Text.Length > 0)
            {
                miconexion.Open();
                SqlCommand    consulta = new SqlCommand(" select * from tblUser where Usuario='" + tbUser.Text + "'and Password='******'", miconexion);
                SqlDataReader ejecuta  = consulta.ExecuteReader();
                if (ejecuta.Read() == true)
                {
                    MessageBox.Show("Bienvenido Admin");
                    this.Hide();
                    FormPrincipal abrir = new FormPrincipal();
                    abrir.Show();
                }

                else
                {
                    MessageBox.Show("Acceso Denegado");
                    tbUser.Clear();
                    tbPass.Clear();
                    tbUser.Focus();
                    miconexion.Close();
                }
            }
            else
            {
                MessageBox.Show("Por Favor rellene los campos para acceder",
                                "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #3
0
        void acceso()
        {
            if (tbUser.Text.Length > 0 || tbPass.Text.Length > 0)
            {
            miconexion.Open();
            SqlCommand consulta = new SqlCommand(" select * from tblUser where Usuario='" + tbUser.Text + "'and Password='******'", miconexion);
            SqlDataReader ejecuta = consulta.ExecuteReader();
            if (ejecuta.Read() == true)
            {
                MessageBox.Show("Bienvenido Admin");
                this.Hide();
                FormPrincipal abrir = new FormPrincipal();
                abrir.Show();
            }

            else
            {
                MessageBox.Show("Acceso Denegado");
                tbUser.Clear();
                tbPass.Clear();
                tbUser.Focus();
                miconexion.Close();
            }

            }
            else
            {
                MessageBox.Show("Por Favor rellene los campos para acceder",
                                "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #4
0
        void acceso()
        {
            try
            {
                if (tbUser.Text.Length < 16 || tbPass.Text.Length < 51)
                {
                    if (tbUser.Text.Length > 0 || tbPass.Text.Length > 0)
                    {
                        miconexion.Open();
                        SqlCommand consulta = new SqlCommand(" select * from tblUser where Usuario='" + tbUser.Text + "'and Pass='******'", miconexion);
                        SqlDataReader ejecuta = consulta.ExecuteReader();
                        if (ejecuta.Read() == true)
                        {
                            MessageBox.Show("Bienvenido Admin");
                            this.Hide();
                            FormPrincipal abrir = new FormPrincipal();
                            abrir.ShowDialog();
                            this.Show();
                        }

                        else
                        {
                            MessageBox.Show("Acceso Denegado");
                            tbUser.Clear();
                            tbPass.Clear();
                            tbUser.Focus();
                            miconexion.Close();
                        }
                    }

                    else
                    {
                        MessageBox.Show("Por Favor rellene los campos para acceder",
                             "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Largo exedido, Consulte el manual de usuario",
                             "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

            }

            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message,
                    "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                if (miconexion.State == ConnectionState.Open)
                {
                    miconexion.Close();
                }
            }
        }
Beispiel #5
0
        void acceso()
        {
            try
            {
                if (tbUser.Text.Length < 16 || tbPass.Text.Length < 51)
                {
                    if (tbUser.Text.Length > 0 || tbPass.Text.Length > 0)
                    {
                        miconexion.Open();
                        SqlCommand    consulta = new SqlCommand(" select * from tblUser where Usuario='" + tbUser.Text + "'and Pass='******'", miconexion);
                        SqlDataReader ejecuta  = consulta.ExecuteReader();
                        if (ejecuta.Read() == true)
                        {
                            MessageBox.Show("Bienvenido Admin");
                            this.Hide();
                            FormPrincipal abrir = new FormPrincipal();
                            abrir.ShowDialog();
                            this.Show();
                        }

                        else
                        {
                            MessageBox.Show("Acceso Denegado");
                            tbUser.Clear();
                            tbPass.Clear();
                            tbUser.Focus();
                            miconexion.Close();
                        }
                    }

                    else
                    {
                        MessageBox.Show("Por Favor rellene los campos para acceder",
                                        "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Largo exedido, Consulte el manual de usuario",
                                    "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message,
                                "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                if (miconexion.State == ConnectionState.Open)
                {
                    miconexion.Close();
                }
            }
        }
 private void btnVolver_Click(object sender, EventArgs e)
 {
     this.Close();
     FormPrincipal abrir = new FormPrincipal();
     abrir.Show();
 }