Example #1
0
File: Pret.cs Project: kwentinn/teg
        private void UpdateEcheancier()
        {
            var montantRemboursé = 0.0;

            _mensualitée = CalculRemboursementMensuel(MontantAEmprunter, TauxNominal, GetDureeEnMois());

            var echeances = new List <Echeance>();

            foreach (var t in Enumerable.Range(1, GetDureeEnMois()))
            {
                var echeance = new Echeance(DebutPret.AddMonths(t), _mensualitée);
                var interets = (1.85 / 12) / 100 * (MontantAEmprunter - montantRemboursé);
                echeance.MensualitéDontInterets = interets;
                echeances.Add(echeance);
                montantRemboursé += echeance.MensualitéDontCapital;
            }
            _echeances = new SortedSet <Echeance>(echeances);
            return;
        }
Example #2
0
        private void UpdateEcheancier()
        {
            var debutPret = _prets.Min(e => e.DebutPret);
            var finPret   = _prets.Max(e => e.GetFinPret());

            var unionEcheances = _prets.SelectMany(e => e.GetEcheances()).ToList();

            var echeances        = new List <Echeance>();
            var t                = debutPret;
            var montantRemboursé = 0d;

            while (t <= finPret)
            {
                var echeance      = new Echeance(t, _prets.Sum(e => e.GetMensualitée()));
                var echeancesDate = unionEcheances.Where(e => e.Date == t).ToList();
                echeance.MensualitéDontInterets = echeancesDate.Sum(e => e.MensualitéDontInterets);
                echeances.Add(echeance);
                montantRemboursé += echeancesDate.Sum(e => e.MensualitéDontCapital);
                t = t.AddMonths(1);
            }
            _echeances = new SortedSet <Echeance>(echeances);
            return;
        }