private void button1_Click(object sender, EventArgs e)
        {
            Form1 obj = new Form1();

            if (string.IsNullOrWhiteSpace(txtUsuario.Text) || string.IsNullOrWhiteSpace(textBox1.Text) || string.IsNullOrWhiteSpace(textBox2.Text))
            {
                label4.Text = "Você precisa preencher todos os campos!";
                return;
            }


            string hashedPassword = obj.hashPassword(textBox1.Text);

            string query = $"INSERT INTO usuarios(username,password) VALUES (@username,@password);";

            MySqlParameter pam3 = new MySqlParameter("username", txtUsuario.Text);
            MySqlParameter pam4 = new MySqlParameter("password", hashedPassword);

            List <MySqlParameter> sqlParameters2 = new List <MySqlParameter> {
                pam3, pam4
            };

            obj.executarQuery(query, sqlParameters2);

            MessageBox.Show($"Usuário {txtUsuario.Text} registrado!");

            registrationForm registrationForm = this;

            registrationForm.Dispose(false);
        }
Exemple #2
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            registrationForm obj = new registrationForm();

            obj.Show();
        }