Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            frmMenuUsuario ventana = new frmMenuUsuario();

            ventana.Show();
            this.Close();
        }
Esempio n. 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            DataTable Datos = new DataTable();
            Boolean   boo   = true;

            if (txtUsuario.Text == "" || txtContra.Text == "")
            {
                MessageBox.Show("Ingrese un usuario y/o una contraseña");
            }
            else
            {
                if (Information.IsNumeric(txtUsuario.Text.Trim()))
                {
                    boo = false;
                    sql = string.Format("select pin, pass from usuarios where pin = '{0}' and pass = '******'", Convert.ToString(txtUsuario.Text.Trim()), Convert.ToString(txtContra.Text.Trim()));
                    data.listaTabla(sql);

                    if (boo == false)
                    {
                        userLogin = txtUsuario.Text.Trim();
                        frmMenuUsuario ventana = new frmMenuUsuario();
                        ventana.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Nombre de usuario y/o contraseña no valida", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtUsuario.Text = "";
                        txtContra.Text  = "";
                    }
                }
                else
                {
                    sql   = string.Format("select usuario, pass from admins where usuario = '{0}' and pass = '******'", Convert.ToString(txtUsuario.Text.Trim()), txtContra.Text.Trim());
                    Datos = data.listaTabla(sql);

                    if (Datos.Rows.Count == 0)
                    {
                        MessageBox.Show("Nombre de usuario y/o contraseña no valida", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtUsuario.Text = "";
                        txtContra.Text  = "";
                    }
                    else
                    {
                        frmMenu ventana = new frmMenu();
                        ventana.Show();
                        this.Hide();
                    }
                }
            }
        }