Exemple #1
0
        public async Task <ExtratoInvestimentos> ConsolidarExtratoInvestimentos(CancellationToken cancellationToken)
        {
            var extratoInvestimento = new ExtratoInvestimentos();
            var tesouroDireto       = await ObterInvestimentosTesouroDireto(cancellationToken);

            if (tesouroDireto.Where(x => !x.IsValid).Any())
            {
                Notificar("As informações de tesouro direto estão inconsistentes");
                return(null);
            }
            ConsolidarExtratoTesouroDireto(extratoInvestimento, tesouroDireto);

            var rendaFixa = await ObterInvestimentosRendaFixa(cancellationToken);

            if (rendaFixa.Where(x => !x.IsValid).Any())
            {
                Notificar("As informações de renda fixa estão inconsistentes");
                return(null);
            }
            ConsolidarExtratoRendaFixa(extratoInvestimento, rendaFixa);

            var fundos = await ObterInvestimentosFundos(cancellationToken);

            if (fundos.Where(x => !x.IsValid).Any())
            {
                Notificar("As informações de invesimento em fundos estão inconsistentes");
                return(null);
            }

            ConsolidarExtratoFundo(extratoInvestimento, fundos);

            return(extratoInvestimento);
        }
Exemple #2
0
        private ExtratoInvestimentos ConsolidarExtratoTesouroDireto(ExtratoInvestimentos extratoInvestimento, IEnumerable <TesouroDireto> investimentosTesouroDireto)
        {
            var listaInvestimentos = new List <Investimento>();

            investimentosTesouroDireto.ToList().ForEach(delegate(TesouroDireto tesouroDireto)
            {
                var investimento = new Investimento
                                   (
                    nome: tesouroDireto.Nome,
                    valorInvestido: tesouroDireto.ValorInvestido,
                    valorTotal: tesouroDireto.ValorTotal,
                    vencimento: tesouroDireto.DataVencimento,
                    ir: tesouroDireto.ValorIr,
                    valorResgate: tesouroDireto.ValorResgate
                                   );
                listaInvestimentos.Add(investimento);
            });
            extratoInvestimento.AdicionarRangeInvestimentos(listaInvestimentos);
            return(extratoInvestimento);
        }
Exemple #3
0
        private ExtratoInvestimentos ConsolidarExtratoFundo(ExtratoInvestimentos extratoInvestimento, IEnumerable <FundoInvestimento> fundosInvestimento)
        {
            var listaInvestimentos = new List <Investimento>();

            fundosInvestimento.ToList().ForEach(delegate(FundoInvestimento fundoInvestimento)
            {
                var investimento = new Investimento
                                   (
                    nome: fundoInvestimento.Nome,
                    valorInvestido: fundoInvestimento.ValorInvestido,
                    valorTotal: fundoInvestimento.ValorTotal,
                    vencimento: fundoInvestimento.DataVencimento,
                    ir: fundoInvestimento.ValorIr,
                    valorResgate: fundoInvestimento.ValorResgate
                                   );
                listaInvestimentos.Add(investimento);
            });
            extratoInvestimento.AdicionarRangeInvestimentos(listaInvestimentos);
            return(extratoInvestimento);
        }
Exemple #4
0
        private ExtratoInvestimentos ConsolidarExtratoRendaFixa(ExtratoInvestimentos extratoInvestimento, IEnumerable <RendaFixa> investimentosRendaFixa)
        {
            var listaInvestimentos = new List <Investimento>();

            investimentosRendaFixa.ToList().ForEach(delegate(RendaFixa rendaFixa)
            {
                var investimento = new Investimento
                                   (
                    nome: rendaFixa.Nome,
                    valorInvestido: rendaFixa.ValorInvestido,
                    valorTotal: rendaFixa.ValorTotal,
                    vencimento: rendaFixa.DataVencimento,
                    ir: rendaFixa.ValorIr,
                    valorResgate: rendaFixa.ValorResgate
                                   );
                listaInvestimentos.Add(investimento);
            });

            extratoInvestimento.AdicionarRangeInvestimentos(listaInvestimentos);
            return(extratoInvestimento);
        }