public void insertarBodegaCentral(Bodega_Central cli)
 {
     this.configConex();
     this.cnn._esSelect     = true;
     this.cnn._sentenciaSQL = "insert into " + this.cnn._nombreTabla + " values(" +
                              cli._ID_BodegaCentral + "," +
                              cli._ingrediente + "," +
                              cli._cantidad + ")";
     this.cnn.conectar();
     this.cnn.cerrarConexion();
 }
 public void modificarBodegaCentral(Bodega_Central cli)
 {
     this.configConex();
     this.cnn._sentenciaSQL = "update " + cnn._nombreTabla +
                              " set ID_Bodega_Central=" + cli._ID_BodegaCentral + "," +
                              "Ingrediente=" + cli._ingrediente + "," +
                              "Cantidad=" + cli._cantidad +
                              " where ID_Bodega_Central=" + cli._ID_BodegaCentral;
     this.cnn._esSelect = false;
     this.cnn.conectar();
     this.cnn.cerrarConexion();
 }
        public System.Collections.ArrayList getBodegaCentral()
        {
            System.Collections.ArrayList lista = new System.Collections.ArrayList();

            this.configConex();
            this.cnn._sentenciaSQL = "Select * from " + cnn._nombreTabla;
            this.cnn._esSelect     = true;
            this.cnn.conectar();
            foreach (System.Data.DataRow dr in
                     this.cnn._dbDataSet.Tables[this.cnn._nombreTabla].Rows)
            {
                Bodega_Central ca = new Bodega_Central();
                ca._ID_BodegaCentral = int.Parse(dr["ID_Bodega_Central"].ToString());
                ca._ingrediente      = int.Parse(dr["Ingrediente"].ToString());
                ca._cantidad         = int.Parse(dr["Cantidad"].ToString());
                lista.Add(ca);
            }
            this.cnn.cerrarConexion();
            return(lista);
        }
        public Bodega_Central buscarBodegaCentralxIngrediente(int ingrediente)
        {
            Bodega_Central cli = new Bodega_Central();

            this.configConex();
            this.cnn._sentenciaSQL = "Select * from " + cnn._nombreTabla + " where Ingrediente = " + ingrediente;
            this.cnn._esSelect     = true;
            this.cnn.conectar();
            System.Data.DataTable dt = new System.Data.DataTable();
            dt = cnn._dbDataSet.Tables[0];
            try
            {
                cli._ID_BodegaCentral = int.Parse(dt.Rows[0][0].ToString());
                cli._ingrediente      = int.Parse(dt.Rows[0][1].ToString());
                cli._cantidad         = int.Parse(dt.Rows[0][2].ToString());
            }
            catch (Exception e)
            {
                cli._ID_BodegaCentral = 0;
            }
            this.cnn.cerrarConexion();
            return(cli);
        }
Esempio n. 5
0
        private void ImprimirComanda()
        {
            NegocioComanda            negco    = new NegocioComanda();
            NegocioCuenta             negcu    = new NegocioCuenta();
            NegocioCuenta_Producto    negcupro = new NegocioCuenta_Producto();
            NegocioProducto           negpro   = new NegocioProducto();
            NegocioPedido             negpe    = new NegocioPedido();
            NegocioMesa               negme    = new NegocioMesa();
            NegocioIngredientes       negIng   = new NegocioIngredientes();
            NegocioLista_Ingredientes negLista = new NegocioLista_Ingredientes();
            NegocioBodegaCentral      negBod   = new NegocioBodegaCentral();



            ArrayList cuentas = negcu.getCuentaxMesa(int.Parse(e));

            foreach (Cuenta item in cuentas)
            {
                ArrayList cuenta_productos = negcupro.getCuenta_ProductoxCuenta1(item._ID_Cuenta);

                Pedido pe = negpe.buscarPedidoxMesa(int.Parse(e));

                Comanda co = new Comanda();
                co._ID_Comanda = we;
                co._Pedido     = pe._ID_Pedido;
                int empezar = 0;
                foreach (Cuenta_Producto item2 in cuenta_productos)
                {
                    Producto pro = negpro.buscarProducto(item2._producto);
                    if (empezar == 0)
                    {
                        co._detalle += " Nom Cuenta | producto | observacion | cantidad \n ";
                        empezar++;
                    }
                    co._detalle += " " + item._nombre + " | " + pro._nombre + " | " + item2._observacion + " | " + item2._cantidad + "\n ";

                    item2._expirada = 2;
                    negcupro.modificarCuenta_Producto(item2);

                    ArrayList listaingredientes = negLista.getLista_IngredientesxProducto(pro._ID_Producto);

                    foreach (Lista_Ingredientes lis in listaingredientes)
                    {
                        Bodega_Central bodega = negBod.buscarBodegaCentralxIngrediente(lis._ingrediente);

                        bodega._cantidad -= lis._cantidad;

                        negBod.modificarBodegaCentral(bodega);
                    }
                }

                co._expirada = 1;
                negco.insertarComanda(co);
            }



            Pedido pde = negpe.buscarPedidoxMesa(int.Parse(e));

            ArrayList coma = negco.getComandaxpedido(pde._ID_Pedido);

            if (coma.Count != 0)
            {
                string detailsamostrar = "";

                foreach (Comanda it in coma)
                {
                    detailsamostrar += it._detalle + "\n";
                    it._expirada     = 2;
                    negco.modificarComanda(it);
                }
                ArrayList aimp = new ArrayList();
                aimp.Add(detailsamostrar);
                MessageBox.Show(detailsamostrar);
                Pagar.Imprimir(aimp);
            }
        }