Esempio n. 1
0
        private void btnregresar_Click(object sender, EventArgs e)
        {
            frmMenuPrincipal U = new frmMenuPrincipal();
            U.Show();


            this.Close();
        }
Esempio n. 2
0
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            SqlConnection conexion = new SqlConnection("Server= (local); Database=TOTALGYM; integrated security = true");
            conexion.Open();
            string user = txtUsuario.Text;
            string pass = txtContraseña.Text;
            string tipo;
            string pass2;
           

           string cadena=("select ID_Cliente,Contraseña, Tipo from TIPO where ID_Cliente="+user);
            SqlCommand comando = new SqlCommand(cadena,conexion);
            SqlDataReader read = comando.ExecuteReader();

            if (read.Read()) {
               pass2 = read["Contraseña"].ToString();
               tipo= read["tipo"].ToString();
                if (pass2==txtContraseña.Text){
                    if(tipo=="administrador"){
                        frmMenuUsuario add = new frmMenuUsuario();
                        add.Show();
                        this.Hide();
                    }
                    if (tipo=="Usuario") {
                        frmMenuPrincipal add = new frmMenuPrincipal();
                        add.Show();
                        this.Hide();
                    }
                    if (tipo == "cliente")
                    {
                        frmMenuPrincipal prin = new frmMenuPrincipal();
                        prin.Show();
                        this.Hide();
                    }
                }
            }
            else {
                MessageBox.Show("!Usuario/Contraseña incorrectos,Verifique bien los datos¡");
            }



        }