private void ActualizaControles() { List <Business> listaB = BusinessQuery.getLista(); dataGridView3.DataSource = null; dataGridView3.DataSource = listaB; cmbNegocio.DataSource = null; cmbNegocio.ValueMember = "idBusiness"; cmbNegocio.DisplayMember = "name"; cmbNegocio.DataSource = listaB; cmbNegocio2.DataSource = null; cmbNegocio2.ValueMember = "idBusiness"; cmbNegocio2.DisplayMember = "name"; cmbNegocio2.DataSource = listaB; cmbNegocioP.DataSource = null; cmbNegocioP.ValueMember = "idBusiness"; cmbNegocioP.DisplayMember = "name"; cmbNegocioP.DataSource = listaB; cmbNegocioEP.DataSource = null; cmbNegocioEP.ValueMember = "idBusiness"; cmbNegocioEP.DisplayMember = "name"; cmbNegocioEP.DataSource = listaB; cmbProducto.DataSource = null; cmbProducto.ValueMember = "idProduct"; cmbProducto.DisplayMember = "name"; cmbProducto.DataSource = ProductQuery.getLista(); }
private void btnAgregarN_Click(object sender, EventArgs e) { List <Business> lista = BusinessQuery.getLista(); bool flag = true; foreach (var bu in lista) { if (txtNegocio.Text.Equals(bu.name)) { flag = false; break; } } if (flag) { try { BusinessQuery.newBusiness(txtNegocio.Text, textBox1.Text); MessageBox.Show("Negocio agregado"); ActualizaControles(); textBox1.Clear(); txtNegocio.Clear(); } catch (Exception ex) { MessageBox.Show("Ocurrió un error"); } } else { MessageBox.Show("Ya hay un negocio con ese nombre"); } }
private void ActualizaControles() { List <Business> listaB = BusinessQuery.getLista(); cmbNegocio.DataSource = null; cmbNegocio.ValueMember = "idBusiness"; cmbNegocio.DisplayMember = "name"; cmbNegocio.DataSource = listaB; }
private bool ComprobarListas() { List <Business> listaB = BusinessQuery.getLista(); List <Address> listaA = AddressQuery.getLista(); if (listaA.Any() && listaB.Any()) { return(true); } else { return(false); } }
private void ActualizaControles(int idUser) { List <Business> listaB = BusinessQuery.getLista(); cmbNegocio.DataSource = null; cmbNegocio.ValueMember = "idBusiness"; cmbNegocio.DisplayMember = "name"; cmbNegocio.DataSource = listaB; cmbDireccion.DataSource = null; cmbDireccion.ValueMember = "idAddress"; cmbDireccion.DisplayMember = "address"; cmbDireccion.DataSource = Connection.ExecuteQuery($"SELECT ad.idAddress, ad.address " + $"FROM ADDRESS ad " + $"WHERE idUser = {idUser};"); Business bu = (Business)cmbNegocio.SelectedItem; ActualizarProducto(bu); }