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); } }
private void btnDelPro_Click(object sender, EventArgs e) { ProductDao.DelProd(cmbDelProd.Text); MessageBox.Show("Producto eliminado."); LlenarCosas(); }