Exemplo n.º 1
0
        private void LlenarCmbs()
        {
            List <Address> direcciones = new List <Address>();

            foreach (var unaDire in AddressDao.GetLista())
            {
                if (unaDire.idUser == currentUser.idUser)
                {
                    direcciones.Add(unaDire);
                }
            }
            cmbDelAddress.DataSource      = null;
            cmbDelAddress.ValueMember     = "idaddress";
            cmbDelAddress.DisplayMember   = "address";
            cmbDelAddress.DataSource      = direcciones;
            cmbAddressOrder.DataSource    = null;
            cmbAddressOrder.ValueMember   = "idaddress";
            cmbAddressOrder.DisplayMember = "address";
            cmbAddressOrder.DataSource    = direcciones;
            cmbBusiOrder.DataSource       = null;
            cmbBusiOrder.ValueMember      = "idbusiness";
            cmbBusiOrder.DisplayMember    = "name";
            cmbBusiOrder.DataSource       = BusinessDao.GetLista();
            cmbAddresses.DataSource       = null;
            cmbAddresses.ValueMember      = "idaddress";
            cmbAddresses.DisplayMember    = "address";
            cmbAddresses.DataSource       = direcciones;
            cmbDelAddress.DataSource      = null;
            cmbDelAddress.ValueMember     = "idaddress";
            cmbDelAddress.DisplayMember   = "address";
            cmbDelAddress.DataSource      = direcciones;
            dgvMisOrdenes.DataSource      = OrderDao.GetLista(currentUser.idUser);
        }
Exemplo n.º 2
0
 private void updateAddresses()
 {
     cmbAddresses.DataSource       = null;
     cmbAddresses.ValueMember      = "idaddress";
     cmbAddresses.DisplayMember    = "address";
     cmbAddresses.DataSource       = AddressDao.GetLista(currentUser.idUser);
     cmbDelAddress.DataSource      = null;
     cmbDelAddress.ValueMember     = "idaddress";
     cmbDelAddress.DisplayMember   = "address";
     cmbDelAddress.DataSource      = AddressDao.GetLista(currentUser.idUser);
     cmbAddressOrder.DataSource    = null;
     cmbAddressOrder.ValueMember   = "idaddress";
     cmbAddressOrder.DisplayMember = "address";
     cmbAddressOrder.DataSource    = AddressDao.GetLista(currentUser.idUser);
 }
Exemplo n.º 3
0
        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);
            }
        }