示例#1
0
        public void agregarProducto(int idProducto, int idProveedor)
        {
            AccesoDatos       conexion            = new AccesoDatos();
            GestorProveedores unGestorProveedores = new GestorProveedores();

            conexion.setearConsulta("insert into PROVEEDORES_X_PRODUCTO values (@idProveedor,@idProducto)");
            conexion.Comando.Parameters.Clear();
            conexion.Comando.Parameters.AddWithValue("@idProveedor", idProveedor);
            conexion.Comando.Parameters.AddWithValue("@idProducto", idProducto);

            conexion.ejecutarAccion();
        }
示例#2
0
        public IList <RegistroCompra> listar()
        {
            AccesoDatos            conexion = new AccesoDatos();
            IList <RegistroCompra> lista    = new List <RegistroCompra>();
            RegistroCompra         aux;
            GestorProveedores      gp = new GestorProveedores();

            conexion.setearConsulta("SELECT idcompra,fecha,idproveedor,total FROM REGISTROCOMPRAS");
            conexion.leerConsulta();

            while (conexion.Lector.Read())
            {
                aux           = new RegistroCompra();
                aux.IdCompra  = conexion.Lector.GetInt32(0);
                aux.Fecha     = conexion.Lector.GetDateTime(1);
                aux.Proveedor = gp.buscarPorId(conexion.Lector.GetInt32(2));
                aux.Total     = conexion.Lector.GetDecimal(3);
                lista.Add(aux);
            }

            return(lista);
        }