private void bntRegistrar_Click(object sender, EventArgs e) { if (txtPass.Text == txtPass2.Text) { database db = new database(); encriptar en = new encriptar(); int alta = 0; String pass = en.SHA256Encrypt(txtPass.Text.ToString()); alta = db.altaUser(txtUser.Text.ToString(), pass); if (alta > 0) { MessageBox.Show("Usuario dado de alta correctamente", "ROMY", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } } else { MessageBox.Show("Las contraseñas no coinciden", "ROMY", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnEntrar_Click(object sender, EventArgs e) { database db = new database(); encriptar en = new encriptar(); bool entro = false; String pass = en.SHA256Encrypt(textBox2.Text.ToString()); entro = db.login(textBox1.Text.ToString(), pass); if (entro) { this.Hide(); frmPrincipal prin = new frmPrincipal(); prin.user = textBox1.Text.ToString(); prin.Show(); } else { MessageBox.Show("Verifique sus datos", "ROMY", MessageBoxButtons.OK, MessageBoxIcon.Error); } db.closeConnection(); }