private void button3_Click(object sender, EventArgs e) { //this.Hide(); this.Hide(); usuarios user1 = new usuarios(); user1.Show(); }
private void button3_Click(object sender, EventArgs e) {/* * string Prompt = "Ingrese Clave"; * string Titulo = "Acceso Restringuido"; * string texto = Microsoft.VisualBasic.Interaction.InputBox(Prompt, Titulo, "*", 150, 150);*/ usuarios frm = new usuarios(); frm.Show(); }
private void button8_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(nom.Text) == true || string.IsNullOrWhiteSpace(tel.Text) == true || string.IsNullOrWhiteSpace(comboBox1.Text) == true || string.IsNullOrWhiteSpace(user.Text) == true || string.IsNullOrWhiteSpace(clave.Text) == true) { MessageBox.Show("No se permiten campos vacios"); } else { string Query = "select *from USUARIO where USUARIO= '" + user.Text + "'"; contactos cl = new contactos(); if (cl.Buscar(Query) == true) { MessageBox.Show("USUARIO ya existe"); } else { users us = new users(); string login_pass = clave.Text; MD5 md5 = MD5.Create(); byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(login_pass); byte[] hash = md5.ComputeHash(inputBytes); login_pass = BitConverter.ToString(hash).Replace("-", ""); if (comboBox1.Text == "Administrador") { string cadenasql = "insert into USUARIO values ('" + nom.Text + "', '" + tel.Text + "', '" + user.Text + "', '" + login_pass + "'," + 8 + ", " + 0 + "," + 6 + ");"; users.insertarUser(cadenasql); } else { string cadenasql = "insert into USUARIO values ('" + nom.Text + "', '" + tel.Text + "', '" + user.Text + "', '" + login_pass + "'," + 8 + ", " + 0 + "," + 7 + ");"; users.insertarUser(cadenasql); } //string cadenasql = "insert into USUARIO values ('" + nom.Text + "', '" + tel.Text + "', '" + user.Text + "', '" + clave.Text + "'," + 5 + ", " + 0 + "," + comboBox1.Text + ");"; //users.insertarUser(cadenasql); nom.Clear(); tel.Clear(); user.Clear(); comboBox1.Text = " "; this.Hide(); usuarios user1 = new usuarios(); user1.Show(); } } }
private void button8_Click(object sender, EventArgs e) { users us = new users(); Conexion cone = new Conexion(); if (string.IsNullOrWhiteSpace(nom.Text) == true || string.IsNullOrWhiteSpace(comboBox1.Text) == true || string.IsNullOrWhiteSpace(user.Text) == true || string.IsNullOrWhiteSpace(clave.Text) == true || string.IsNullOrWhiteSpace(comboBox2.Text) == true) { MessageBox.Show("No se permiten campos vacios"); } else { //users us = new users(); //users us = new users(); string login_pass = clave.Text; MD5 md5 = MD5.Create(); byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(login_pass); byte[] hash = md5.ComputeHash(inputBytes); login_pass = BitConverter.ToString(hash).Replace("-", ""); /*if (comboBox1.Text == "Administrador") * MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 9, 6)); * else * MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 9, 7));*/ /*----------------------------------------------------*/ if (comboBox2.Text == "Activo") { if (comboBox1.Text == "Administrador") { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 5, 6)); } else { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 5, 7)); } } if (comboBox2.Text == "Inactivo") { if (comboBox1.Text == "Administrador") { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 6, 6)); } else { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 6, 7)); } } if (comboBox2.Text == "Bloqueado") { if (comboBox1.Text == "Administrador") { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 7, 6)); } else { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 7, 7)); } } if (comboBox2.Text == "NuevoUser") { if (comboBox1.Text == "Administrador") { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 8, 6)); } else { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 8, 7)); } } if (comboBox2.Text == "CambiarClave") { if (comboBox1.Text == "Administrador") { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 9, 6)); } else { MessageBox.Show(us.edit((Convert.ToInt32(txteid.Text)), nom.Text, user.Text, login_pass, 9, 7)); } } /*----------------------------------------------------*/ this.Hide(); usuarios user1 = new usuarios(); user1.Show(); } }