private void button1_Click(object sender, EventArgs e) { try { if (textBox2.Text.Length >= 7 && textBox1.Text.Length >= 16) { AppUserDAO.crearNuevo(textBox1.Text, textBox2.Text); MessageBox.Show("¡Usuario agregado exitosamente! Valores por defecto: " + "contrasena igual a usuario, no admin", "Clase GUI 06", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Clear(); textBox2.Clear(); actualizarControles(); } else { MessageBox.Show("Favor digite un usuario (longitud minima, 7 caracteres)", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception) { MessageBox.Show("El usuario que ha digitado, no se encuentra disponible.", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void actualizarControles() { List <AppUser> lista = AppUserDAO.getListaP(usuario.idUser); List <Order> listO = OrderDAO.getOListP(usuario.idUser); List <Address> listA = AddressDAO.getPList(usuario.idUser); List <Business> listaB = BusinessDAO.getBList(); List <Product> listaP = ProductDAO.getPList(Convert.ToInt32(comboBox2.SelectedValue)); comboBox3.DataSource = null; comboBox3.ValueMember = "idProduct"; comboBox3.DisplayMember = "name"; comboBox3.DataSource = listaP; comboBox1.DataSource = null; comboBox1.ValueMember = "idUser"; comboBox1.DisplayMember = "userName"; comboBox1.DataSource = lista; comboBox2.DataSource = null; comboBox2.ValueMember = "idBusiness"; comboBox2.DisplayMember = "name"; comboBox2.DataSource = listaB; comboBox5.DataSource = null; comboBox5.ValueMember = "idOrder"; comboBox5.DisplayMember = "idProduct"; comboBox5.DataSource = listO; dataGridView1.DataSource = null; dataGridView1.DataSource = listO; dataGridView2.DataSource = null; dataGridView2.DataSource = listA; }
private void button1_Click(object sender, EventArgs e) { bool actualIgual = Encriptador.CompararMD5(textBox1.Text, comboBox1.SelectedValue.ToString()); bool nuevaIgual = textBox2.Text.Equals(textBox3.Text); bool nuevaValida = textBox2.Text.Length > 0; if (actualIgual && nuevaIgual && nuevaValida) { try { AppUserDAO.actualizarContra(comboBox1.Text, Encriptador.CrearMD5(textBox2.Text)); MessageBox.Show("¡Contraseña actualizada exitosamente!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception) { MessageBox.Show("¡Contraseña no actualizada! Favor intente mas tarde.", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("¡¡Favor verifique que los datos sean correctos!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void ChangePassword_Load(object sender, EventArgs e) { comboBox1.DataSource = null; comboBox1.ValueMember = "password"; comboBox1.DisplayMember = "userName"; comboBox1.DataSource = AppUserDAO.getLista(); }
private void poblarControles() { // Actualizar ComboBox comboBox1.DataSource = null; comboBox1.ValueMember = "password"; comboBox1.DisplayMember = "userName"; comboBox1.DataSource = AppUserDAO.getLista(); }
private void button2_Click(object sender, EventArgs e) { if (MessageBox.Show("¿Seguro que desea eliminar al usuario " + comboBox1.Text + "?", "Hugo App", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { AppUserDAO.eliminar(comboBox1.Text); MessageBox.Show("¡Usuario eliminado exitosamente!", "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Information); actualizarControles(); } }
private void actualizarControles() { // Realizar consulta a la base de datos List <AppUser> lista = AppUserDAO.getLista(); List <Business> listaB = BusinessDAO.getBList(); List <Product> listaP = ProductDAO.getPList(Convert.ToInt32(comboBox3.SelectedValue)); List <Product> listaPP = ProductDAO.getPList(Convert.ToInt32(comboBox4.SelectedValue)); List <Order> listaO = OrderDAO.getOList(); // Tabla (data grid view) dataGridView1.DataSource = null; dataGridView1.DataSource = lista; // Menu desplegable (combo box) comboBox1.DataSource = null; comboBox1.ValueMember = "password"; comboBox1.DisplayMember = "userName"; comboBox1.DataSource = lista; comboBox2.DataSource = null; comboBox2.ValueMember = "name"; comboBox2.DisplayMember = "name"; comboBox2.DataSource = listaB; comboBox3.DataSource = null; comboBox3.ValueMember = "idBusiness"; comboBox3.DisplayMember = "name"; comboBox3.DataSource = listaB; comboBox4.DataSource = null; comboBox4.ValueMember = "idBusiness"; comboBox4.DisplayMember = "name"; comboBox4.DataSource = listaB; comboBox5.DataSource = null; comboBox5.ValueMember = "idProduct"; comboBox5.DisplayMember = "name"; comboBox5.DataSource = listaPP; dataGridView2.DataSource = null; dataGridView2.DataSource = listaB; dataGridView3.DataSource = null; dataGridView3.DataSource = listaP; dataGridView4.DataSource = null; dataGridView4.DataSource = listaO; }