/// <summary> /// Retorna um IBaseBD de Fornecedor especifico /// </summary> public override IBaseBD this[int indice] { get{ if (indice < 0 || indice >= lista.Count) { return(null); } else { int id = (int)lista[indice]; fornecedor.Ler(id); return(fornecedor); } } }
/// <summary> /// Obtem uma tabela de todos os campos de fornecedorproduto carregados na lista /// </summary> /// <returns></returns> public override DataTable Relatorio(){ DataTable tabela = new DataTable("FornecedorProduto"); try{ if (this.Primeiro()){ tabela.Columns.Add("Fornecedor", typeof(string)); tabela.Columns.Add("Produto", typeof(string)); do{ DataRow linha = tabela.NewRow(); Fornecedor f = new Fornecedor(); f.Ler(fornecedorProduto.FornecedorID.Valor); linha["Fornecedor"]= f.Nome.Valor; Produto p = new Produto(); p.Ler(fornecedorProduto.ProdutoID.Valor); linha["Produto"]= p.Nome.Valor; tabela.Rows.Add(linha); }while(this.Proximo()); }else{ //erro: nao carregou a lista tabela = null; } }catch{ tabela = null; } return tabela; }
/// <summary> /// Obtem uma tabela de todos os campos de estoquepedido carregados na lista /// </summary> /// <returns></returns> public override DataTable Relatorio() { DataTable tabela = new DataTable("EstoquePedido"); try{ if (this.Primeiro()) { tabela.Columns.Add("Ordem", typeof(string)); tabela.Columns.Add("Fornecedor", typeof(string)); tabela.Columns.Add("Responsavel", typeof(string)); tabela.Columns.Add("Data", typeof(DateTime)); tabela.Columns.Add("EntregaPrevista", typeof(DateTime)); tabela.Columns.Add("EntregaReal", typeof(DateTime)); do { DataRow linha = tabela.NewRow(); linha["Ordem"] = estoquePedido.Ordem.Valor; Fornecedor fornecedor = new Fornecedor(); fornecedor.Ler(estoquePedido.FornecedorID.Valor); linha["Fornecedor"] = fornecedor.Nome.Valor; Usuario usuario = new Usuario(); usuario.Ler(estoquePedido.ResponsavelID.Valor); linha["Responsavel"] = usuario.Nome.Valor; linha["Data"] = estoquePedido.Data.Valor; linha["EntregaPrevista"] = estoquePedido.EntregaPrevista.Valor; linha["EntregaReal"] = estoquePedido.EntregaReal.Valor; tabela.Rows.Add(linha); }while(this.Proximo()); } else //erro: nao carregou a lista { tabela = null; } }catch { tabela = null; } return(tabela); }