1
I am making a page to generate a report. In this I make 3 selects different, putting the result of each query in a list:
public IEnumerable<RelatorioVencerVencidos> ObterRelatorioVencerVencidos(ParametrosVencerVencidos filtro)
{
var hash = new Dictionary<int, RelatorioVencerVencidos>();
CarregarListVencerVencidos(hash,filtro);
CombinarComDadosDeRendaFixa(hash);
CombinarComDadosDeClubes(hash);
return hash.Values.ToArray();
}
private void CombinarComDadosDeClubes(Dictionary<int, RelatorioVencerVencidos> hash)
{
foreach (var clubes in Instance.ObterClubesVirtual())
{
if (hash.ContainsKey(clubes.CodCotista))
hash[clubes.CodCotista].Clubes = clubes.SaldoBruto;
}
}
private void CombinarComDadosDeRendaFixa(Dictionary<int, RelatorioVencerVencidos> hash)
{
foreach (var renda in Instance.ObterRendaFixaVirtual())
{
var codCliente = default(int);
if (int.TryParse(renda.CodCliente, out codCliente))
if (hash.ContainsKey(codCliente))
hash[codCliente].RendaFixa = renda.ValorBruto;
}
}
public void CarregarListVencerVencidos(Dictionary<int, RelatorioVencerVencidos> hash, ParametrosVencerVencidos filtros)
{
foreach (var i in Instance.ObterDadosVencerVencidos(filtro))
{
if (!hash.ContainsKey(i.CodigoBovespa))
hash.Add(i.CodigoBovespa, i);
}
}
I am editing the question, due to I have done as above, using Dictionary, where I load the lists into a Dictionary using the account code as the key and take the account balance as Dictionary value. Only one thing that is not working very well is due to my method Obtainingswinning that this in the last foreach that receives some parameters and the parameters end up coming zeroed being that in the Get methodwinning method the Parameters are with values, however when you enter the Load methodwinning the parameters are null and I am not able to know the correct way to get the information of the parameters in the Obtainingwinning method.
And what’s the mistake?
– Jéf Bueno
The error is this one below in the two lines that I highlighted as an error in the question: The best Overload method match for 'System.Colections.Generic.list<Reportwinexpired>. Addrange(System.collections. Generic.Ienumerable<Reportwinnowers>)' has some invalid Arguments
– Renan Carvalho