Beispiel #1
0
        public void registrarOrdenCompra(OrdenCompraModel ordenCompra)
        {
            dataBaseMySQL.OpenBD();

            commandDatabase             = new MySqlCommand();
            commandDatabase.Connection  = dataBaseMySQL.GetConnection();
            commandDatabase.CommandType = CommandType.StoredProcedure;
            commandDatabase.CommandText = "registrarOrdenCompra";
            commandDatabase.Parameters.Add(new MySqlParameter("d1", ordenCompra.sRucCliente));
            commandDatabase.Parameters.Add(new MySqlParameter("d2", ordenCompra.nPrecioTotal));
            commandDatabase.Parameters.Add(new MySqlParameter("d3", ordenCompra.dFechaCompra));
            commandDatabase.Parameters.Add(new MySqlParameter("d4", ordenCompra.sEstado));

            commandDatabase.ExecuteNonQuery();

            dataBaseMySQL.CloseBD();

            ordenCompra.nCodigoOrden = retornarCodigoOrdenCompra();

            registrarDetalleOrdenCompra(ordenCompra.lDetalleCompra, ordenCompra.nCodigoOrden);
        }
        public void actualizarStock(List <OrdenCompraDetalleModel> lDetalleCompra)
        {
            foreach (OrdenCompraDetalleModel auxiliar in lDetalleCompra)
            {
                dataBaseMySQL.OpenBD();

                commandDatabase             = new MySqlCommand();
                commandDatabase.Connection  = dataBaseMySQL.GetConnection();
                commandDatabase.CommandType = CommandType.StoredProcedure;
                commandDatabase.CommandText = "actualizarStock";
                commandDatabase.Parameters.Add(new MySqlParameter("d1", auxiliar.nCodigoProducto));
                commandDatabase.Parameters.Add(new MySqlParameter("d2", auxiliar.nCantidadProducto));

                commandDatabase.ExecuteNonQuery();

                dataBaseMySQL.CloseBD();
            }
        }