Beispiel #1
0
        private void ComputeNpvExecute(object param)
        {
            NetPresentValues.Clear();
            var rateLevels = npvCalculator.GetRateLevels(NpvParameter.LowerBoundDiscountRate,
                                                         NpvParameter.UpperBoundDiscountRate,
                                                         NpvParameter.DiscountRateIncrement);

            for (var i = 0; i < rateLevels.Count; i++)
            {
                NetPresentValues.Add(new NetPresentValue {
                    Index = i + 1, DiscountRateLevel = rateLevels[i]
                });
            }

            for (var i = 0; i < NetPresentValues.Count; i++)
            {
                var discountRateLevel = NetPresentValues[i].DiscountRateLevel;
                var j = 0;
                var totalPresentValue = CashFlows.ToList().Sum(c =>
                {
                    j++;
                    var presentValue = CalculatePresentValue(c.Cash, discountRateLevel, j);
                    return(presentValue);
                });

                NetPresentValues[i].Value = totalPresentValue + NpvParameter.InitialInvestment;
            }

            HasItems = true;
        }
Beispiel #2
0
        private void SetCashFlowsExecute(object param)
        {
            int i = 0;

            if (!int.TryParse(param.ToString(), out i))
            {
                return;
            }

            NetPresentValues.Clear();
            HasItems = false;
            SetCashFlows(i);
        }