private void LlenarCosas() { cmbAddProBusi.DataSource = null; cmbAddProBusi.ValueMember = "idbusiness"; cmbAddProBusi.DisplayMember = "name"; cmbAddProBusi.DataSource = BusinessDao.GetLista(); cmbDelProd.DataSource = null; cmbDelProd.ValueMember = "idproduct"; cmbDelProd.DisplayMember = "name"; cmbDelProd.DataSource = ProductDao.GetLista((Business)cmbAddProBusi.SelectedItem); dgvOrdenes.DataSource = null; dgvOrdenes.DataSource = OrderDao.GetLista(); dgvUser.DataSource = null; dgvUser.DataSource = UserDao.GetLista(); }
private void cmbAddProBusi_SelectedIndexChanged(object sender, EventArgs e) { List <Product> productos = new List <Product>(); foreach (var prod in ProductDao.GetLista()) { if (prod.idBusiness == cmbAddProBusi.SelectedIndex) { productos.Add(prod); } } cmbDelProd.DataSource = null; cmbDelProd.ValueMember = "idproduct"; cmbDelProd.DisplayMember = "name"; cmbDelProd.DataSource = productos; }
private void cmbBusiOrder_SelectedIndexChanged(object sender, EventArgs e) { List <Product> productos = new List <Product>(); var unbi = (Business)cmbBusiOrder.SelectedItem; foreach (var prod in ProductDao.GetLista()) { if (prod.idBusiness == unbi.idBusiness) { productos.Add(prod); } } cmbProOrder.DataSource = null; cmbProOrder.ValueMember = "idProduct"; cmbProOrder.DisplayMember = "name"; cmbProOrder.DataSource = productos; }
private void btnAddOrder_Click(object sender, EventArgs e) { Order orden = new Order(); var pedido = (Product)cmbProOrder.SelectedItem; var lugar = (Address)cmbAddressOrder.SelectedItem; orden.idProduct = pedido.idProduct; orden.idAddress = lugar.idAddress; OrderDao.AddOrden(orden); MessageBox.Show("La direccion fue agregada."); cmbAddressOrder.DataSource = null; cmbAddressOrder.ValueMember = "idaddress"; cmbAddressOrder.DisplayMember = "address"; cmbAddressOrder.DataSource = AddressDao.GetLista(currentUser.idUser); cmbBusiOrder.DataSource = null; cmbBusiOrder.ValueMember = "idbusiness"; cmbBusiOrder.DisplayMember = "name"; cmbBusiOrder.DataSource = BusinessDao.GetLista(); cmbProOrder.DataSource = null; cmbProOrder.ValueMember = "idproduct"; cmbProOrder.DisplayMember = "name"; cmbProOrder.DataSource = ProductDao.GetLista((Business)cmbBusiOrder.SelectedItem); List <int> ids = new List <int>(); foreach (var place in AddressDao.GetLista()) { if (place.idUser == currentUser.idUser) { ids.Add(place.idAddress); } } foreach (var i in ids) { dgvMisOrdenes.DataSource = OrderDao.GetLista(i); } }