예제 #1
0
        private void Button1_Click_1(object sender, EventArgs e)
        {
            Elegir ToElegir = new Elegir();

            this.Hide();
            ToElegir.Show();
        }
예제 #2
0
        private void Button2_Click(object sender, EventArgs e)
        {
            Elegir ToMenu = new Elegir();

            this.Hide();
            ToMenu.Show();
        }
예제 #3
0
        private void Label2_Click(object sender, EventArgs e)
        {
            Elegir ToElegir = new Elegir();

            this.Hide();
            ToElegir.Show();
        }
예제 #4
0
        private void login_button_Click(object sender, EventArgs e)
        {
            string user     = user_textbox.Text;
            string password = password_textbox.Text;

            MySqlConnection conexion = Connection.GetConnection();

            MySqlCommand login = new MySqlCommand();

            login.CommandText = "SELECT * FROM user WHERE account_user = @user AND password_user = @password";
            login.Parameters.AddWithValue("@user", user);
            login.Parameters.AddWithValue("@password", password);
            login.Connection = conexion;

            if (string.IsNullOrEmpty(user_textbox.Text) || string.IsNullOrEmpty(password_textbox.Text))
            {
                MessageBox.Show("Los campos no pueden quedar vacios", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MySqlDataReader leer = login.ExecuteReader();
                if (leer.Read())
                {
                    MessageBox.Show("Bienvenido", "Log In", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Elegir ToMenu = new Elegir();
                    this.Hide();
                    ToMenu.Show();
                    conexion.Close();
                }
                else
                {
                    MessageBox.Show("Usuario o Contraseña incorrectos", "Log In", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    conexion.Close();
                }
            }
        }