Пример #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);
        }
Пример #2
0
 private void btnDelBusi_Click(object sender, EventArgs e)
 {
     if (txtDelBusi.Text.Equals(""))
     {
         MessageBox.Show("Escriba el nombre del negocio.");
     }
     else
     {
         BusinessDao.DelBusi(txtDelBusi.Text);
         MessageBox.Show("Negocio eliminado.");
         LlenarCosas();
     }
 }
Пример #3
0
 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();
 }
Пример #4
0
        private void btnAddBusi_Click(object sender, EventArgs e)
        {
            string businessName = txtAddBusi.Text;
            string businessDesc = txtDescBusi.Text;

            ;
            if (businessName.Equals(""))
            {
                MessageBox.Show("Escriba la informacion del negocio.");
            }
            else
            {
                Business nBusi = new Business(businessName, businessDesc);
                BusinessDao.AddBusi(nBusi);
                MessageBox.Show("Negocio agregado correctamente.");
                LlenarCosas();
            }
        }
Пример #5
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);
            }
        }