Пример #1
0
        private void btnOrdenar_Click(object sender, EventArgs e)
        {
            AppOrder o = new AppOrder();

            o.createDate = dateTimePicker1.Value;
            o.idAddress  = (int)cmbAiD.SelectedValue;
            o.idProduct  = (int)cmbPiD.SelectedValue;

            try
            {
                AppOrderDAO.addOrder(o);

                MessageBox.Show($"Orden agregada exitosamente.",
                                "HugoApp - Food Delivery",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                btnClearProduct_Click(sender, e);
                actualizarControlesCommon();
                actualizarTablasCommon();
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error: " + exception.Message, "Error dialog",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void frmUsuario_Load(object sender, EventArgs e)
        {
            cmbAddress.DataSource    = null;
            cmbAddress.ValueMember   = "idAddress";
            cmbAddress.DisplayMember = "address";
            cmbAddress.DataSource    = AddressDAO.GetLista();

            dgAddress.DataSource       = null;
            dgAddress.DataSource       = AddressDAO.GetLista();
            cmbProductos.DataSource    = null;
            cmbProductos.ValueMember   = "idProduct";
            cmbProductos.DisplayMember = "name";
            cmbProductos.DataSource    = ProducDAO.GetLista();

            cmbDirecciones.DataSource    = null;
            cmbDirecciones.ValueMember   = "idAddress";
            cmbDirecciones.DisplayMember = "address";
            cmbDirecciones.DataSource    = AddressDAO.GetLista();

            dgOrders.DataSource = null;
            dgOrders.DataSource = AppOrderDAO.GetLista();

            cmbOrders.DataSource    = null;
            cmbOrders.ValueMember   = "idOrder";
            cmbOrders.DisplayMember = "product";
            cmbOrders.DataSource    = AppOrderDAO.GetLista();
        }
Пример #3
0
        private void actualizarControlesCommon()
        {
            List <Address> listaA = AddressDAO.getLista(user.id_User);

            cmbAddressId.DataSource    = null;
            cmbAddressId.DisplayMember = "idAddress";
            cmbAddressId.ValueMember   = "idAddress";
            cmbAddressId.DataSource    = listaA;

            cmbAiD.DataSource    = null;
            cmbAiD.DisplayMember = "idAddress";
            cmbAiD.ValueMember   = "idAddress";
            cmbAiD.DataSource    = listaA;

            List <Business> listaB = BusinessDAO.getLista();

            cmbBiD2.DataSource    = null;
            cmbBiD2.DisplayMember = "idBusiness";
            cmbBiD2.ValueMember   = "idBusiness";
            cmbBiD2.DataSource    = listaB;

            List <Product> listaP = ProductDAO.getLista();

            cmbPiD.DataSource    = null;
            cmbPiD.DisplayMember = "idProduct";
            cmbPiD.ValueMember   = "idProduct";
            cmbPiD.DataSource    = listaP;

            List <AppOrder> listaO = AppOrderDAO.getListaUser(user.id_User);

            cmbOrderiD.DataSource    = null;
            cmbOrderiD.DisplayMember = "idOrder";
            cmbOrderiD.ValueMember   = "idOrder";
            cmbOrderiD.DataSource    = listaO;
        }
Пример #4
0
        private void actualizarTablasCommon()
        {
            dGAdress.DataSource = null;
            dGAdress.DataSource = AddressDAO.getLista(user.id_User);

            dGUserOrders.DataSource = null;
            dGUserOrders.DataSource = AppOrderDAO.getListaUser(user.id_User);
        }
Пример #5
0
        private void cmbDelateOrder_Click(object sender, EventArgs e)
        {
            AppOrderDAO.delateOrder(Convert.ToInt32(cmbOrder.SelectedValue.ToString()));
            MessageBox.Show("¡Order has been deleted!",
                            "Hugo", MessageBoxButtons.OK, MessageBoxIcon.Information);

            UpdateControls();
        }
Пример #6
0
 void actualizarDatos()
 {
     cmbAddress.DataSource     = AddressDAO.GetLista();
     dgAddress.DataSource      = AddressDAO.GetLista();
     cmbProductos.DataSource   = ProducDAO.GetLista();
     cmbDirecciones.DataSource = AddressDAO.GetLista();
     dgOrders.DataSource       = AppOrderDAO.GetLista();
     cmbOrders.DataSource      = AppOrderDAO.GetLista();
 }
Пример #7
0
        private void actualizarDatagrid()
        {
            var dt = AppuserDAO.allusers();

            dtvusers.DataSource = dt;
            var dtTable = AppOrderDAO.ordertable();

            dtvOrders.DataSource = dtTable;
        }
Пример #8
0
        private void btnAddOrder_Click(object sender, EventArgs e)
        {
            DateTime date   = DateTime.Now;
            int      idprod = Convert.ToInt32(cmbProductos.SelectedValue.ToString());
            int      iddir  = Convert.ToInt32(cmbAddress.SelectedValue.ToString());

            AppOrderDAO.AgregarOrden(date, idprod, iddir);
            actualizarDatos();
        }
Пример #9
0
        private void actualizarDatagrid()
        {
            var dt = Address_DAO.addressUser(user.idUser);

            dtvAddress.DataSource = dt;
            var dt1 = AppOrderDAO.orderuser(user.idUser);

            dtvOrders.DataSource = dt1;
        }
Пример #10
0
        private void btnOrder_Click(object sender, EventArgs e)
        {
            AppOrderDAO.Order(Convert.ToInt32(cmbProduct.SelectedValue.ToString()),
                              Convert.ToInt32(cmbAddressOrder.SelectedValue.ToString()));
            MessageBox.Show("¡Order has been added!",
                            "Hugo", MessageBoxButtons.OK, MessageBoxIcon.Information);

            UpdateControls();
        }
Пример #11
0
 void actualizarDatos()
 {
     cmbUsuarios.DataSource     = AppUserDAO.GetLista();
     dgUsuarios.DataSource      = AppUserDAO.GetLista();
     cmbNegociosProd.DataSource = BusinessDAO.GetLista();
     dgNegocios.DataSource      = BusinessDAO.GetLista();
     cmbNegocios.DataSource     = BusinessDAO.GetLista();
     dgOrdenes.DataSource       = AppOrderDAO.GetLista();
     cmbProds.DataSource        = ProducDAO.GetProdsNeg();
 }
        private void button10_Click(object sender, EventArgs e)
        {
            AppOrderDAO.crearNuevo(((DateTime.Now)).ToString(@"yyyy-MM-dd"), comboBox7.Text, comboBox5.Text);

            MessageBox.Show("¡Pedido realizado exitosamente!",
                            "SourceCode", MessageBoxButtons.OK, MessageBoxIcon.Information);


            actualizarControles();
        }
        private void button13_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Seguro que desea eliminar el pedido " + comboBox8.Text + "?",
                                "SourceCode", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                AppOrderDAO.eliminar(comboBox8.Text);

                MessageBox.Show("¡Pedido eliminado exitosamente!",
                                "SourceCode", MessageBoxButtons.OK, MessageBoxIcon.Information);

                actualizarControles();
            }
        }
Пример #14
0
        private void actualizarTablasAdmin()
        {
            dGUser.DataSource = null;
            dGUser.DataSource = AppUserDAO.getLista();

            dGBusiness.DataSource = null;
            dGBusiness.DataSource = BusinessDAO.getLista();

            dGProduct.DataSource = null;
            dGProduct.DataSource = ProductDAO.getLista();

            dGTotalOrders.DataSource = null;
            dGTotalOrders.DataSource = AppOrderDAO.getLista();
        }
Пример #15
0
 private void btnEliminarOrder_Click(object sender, EventArgs e)
 {
     try
     {
         AppOrderDAO.removeOrder((int)cmbOrderiD.SelectedValue);
         MessageBox.Show("Producto eliminado exitosamente", "HugoApp - Food Delivery",
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
         actualizarControlesAdmin();
         actualizarTablasAdmin();
     }
     catch (Exception exception)
     {
         MessageBox.Show("Error: " + exception.Message, "Error dialog",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #16
0
 private void actualizarControlesUsuario()
 {
     // cmbUsOrderBussines
     cmbUsOrderBussines.DataSource    = null;
     cmbUsOrderBussines.ValueMember   = "IdBusiness";
     cmbUsOrderBussines.DisplayMember = "Name";
     cmbUsOrderBussines.DataSource    = BusinessDAO.getLista();
     // cmbUsOrderProduct
     cmbUsOrderProduct.DataSource    = null;
     cmbUsOrderProduct.ValueMember   = "IdProduct";
     cmbUsOrderProduct.DisplayMember = "Name";
     cmbUsOrderProduct.DataSource    = ProductDAO.getLista();
     // cmbUsOrderAddr
     cmbUsOrderAddr.DataSource    = null;
     cmbUsOrderAddr.ValueMember   = "IdAddress";
     cmbUsOrderAddr.DisplayMember = "Addr";
     cmbUsOrderAddr.DataSource    = AddressDAO.getLista(user);
     //tabla
     dgvUserOrders.DataSource = null;
     dgvUserOrders.DataSource = AppOrderDAO.getLista(user);
 }
Пример #17
0
        private void btnPlaceOrder_Click(object sender, EventArgs e)
        {
            try
            {
                Address a = (Address)cmbUsOrderAddr.SelectedItem;
                Product p = (Product)cmbUsOrderProduct.SelectedItem;

                AppOrderDAO.addOrder(DateTime.Now, p.IdProduct, a.IdAddress);

                MessageBox.Show("Pedido agregado exitosamente", "Hugo App",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                // Actualizar el data grid view (la tabla)
                actualizarControlesUsuario();
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error: " + exception.Message, "Hugo App",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #18
0
 private void btnDeleteOrder_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("¿Seguro que desea eliminar la orden?",
                             "Hugo App", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             ;
         }
         {
             int ido = Convert.ToInt32(cmbOrders.SelectedValue.ToString());
             AppOrderDAO.EliminarOrden(ido);
             MessageBox.Show("Se eliminó la orden",
                             "Hugo App", MessageBoxButtons.OK, MessageBoxIcon.Information);
             actualizarDatos();
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
         throw;
     }
 }
Пример #19
0
 private void UpdateControls()
 {
     txtAddressa.Clear();
     cmbaddressModificate.DataSource    = null;
     cmbaddressModificate.ValueMember   = "idAddress";
     cmbaddressModificate.DisplayMember = "address";
     cmbaddressModificate.DataSource    = Address_DAO.getListaforUser(user.idUser);
     txtAddressModification.Clear();
     txtdeleteaddress.Clear();
     cmbPlace.DataSource           = null;
     cmbPlace.ValueMember          = "idBusiness";
     cmbPlace.DisplayMember        = "name";
     cmbPlace.DataSource           = BussinessDAO.getLista();
     cmbAddressOrder.DataSource    = null;
     cmbAddressOrder.ValueMember   = "idAddress";
     cmbAddressOrder.DisplayMember = "address";
     cmbAddressOrder.DataSource    = Address_DAO.getListaforUser(user.idUser);
     cmbOrder.DataSource           = null;
     cmbOrder.ValueMember          = "idOrder";
     cmbOrder.DisplayMember        = "productname";
     cmbOrder.DataSource           = AppOrderDAO.getListaforUser(user.idUser);
     cmbProduct.DataSource         = null;
     actualizarDatagrid();
 }
        private void actualizarControles()
        {
            List <AppUser> lista = AppUserDAO.getLista();


            dataGridView1.DataSource = null;
            dataGridView1.DataSource = lista;

            comboBox1.DataSource    = null;
            comboBox1.DisplayMember = "iduser";
            comboBox1.DataSource    = lista;

            List <Business> list = BusinessDAO.getLista();

            comboBox2.DataSource    = null;
            comboBox2.DisplayMember = "idbusiness";
            comboBox2.DataSource    = list;

            List <Product> lis = ProductDAO.getLista();

            comboBox3.DataSource    = null;
            comboBox3.DisplayMember = "idbusiness";
            comboBox3.DataSource    = list;



            comboBox4.DataSource    = null;
            comboBox4.DisplayMember = "idbusiness";
            comboBox4.DataSource    = list;

            List <Adress> listAdress = AdressDAO.getLista();


            comboBox6.DataSource    = null;
            comboBox6.DisplayMember = "idbusiness";
            comboBox6.DataSource    = list;

            List <AppOrder> listOrders = AppOrderDAO.getLista();

            comboBox8.DataSource    = null;
            comboBox8.DisplayMember = "idorder";
            comboBox8.DataSource    = listOrders;

            dataGridView2.DataSource = null;
            dataGridView2.DataSource = listOrders;

            comboBox7.DataSource    = null;
            comboBox7.DisplayMember = "idproduct";
            comboBox7.DataSource    = lis;

            comboBox5.DataSource    = null;
            comboBox5.DisplayMember = "idadress";
            comboBox5.DataSource    = listAdress;

            List <Adress> listaAdress = AdressDAO.getListaAdress(appuser.iduser);

            dataGridView3.DataSource = null;
            dataGridView3.DataSource = listaAdress;

            List <AppOrder> listaAppOrders = AppOrderDAO.getListaAppOrder(appuser.iduser);

            dataGridView5.DataSource = null;
            dataGridView5.DataSource = listaAppOrders;
        }
Пример #21
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public AppOrderBLL(BasicUserInfo pUserInfo)
 {
     this._currentDAO = new AppOrderDAO(pUserInfo);
 }