コード例 #1
0
    protected void btnListar_Click(object sender, EventArgs e)
    {
        List <Compra> ocompra = LogicaCompra.ListadoComprasXCliente(Convert.ToInt32(ddlClientes.Text));

        GVCompras.DataSource = ocompra;
        GVCompras.DataBind();
    }
コード例 #2
0
        private void CarregarListaCompra()
        {
            Aula5Entities context = new Aula5Entities();

            var dados = (
                from compra in context.COMPRA
                from m in context.MATERIAL.Where(x => x.id == compra.id_material)
                from f in context.FORNECEDOR.Where(x => x.id == compra.id_fornecedor)
                from cliente in context.CLIENTE.Where(x => x.id == compra.id_cliente)
                select new
            {
                Id = compra.id,
                Id_fornecedor = f.nome,
                Id_cliente = cliente.nome,
                Id_material = m.descricao,
                Datavenda = compra.datavenda,
            }).ToList();

            GVCompras.DataSource = dados;
            GVCompras.DataBind();
        }