コード例 #1
0
        public double GetOwnPensionSavings(MonthAndYear monthAndYear)
        {
            TryGetValue(monthAndYear, out var categories);
            double currentMonthsOwnPension = 0;

            categories?.TryGetValue(Pension, out currentMonthsOwnPension);

            TryGetValue(monthAndYear.PreviousMonth(), out var lastMonthCategories);
            double previousMonthsOwnPension = 0;

            lastMonthCategories?.TryGetValue(Pension, out previousMonthsOwnPension);

            return(currentMonthsOwnPension - previousMonthsOwnPension);
        }
コード例 #2
0
        public double GetFortune(MonthAndYear monthAndYear)
        {
            TryGetValue(monthAndYear, out var categories);
            double currentMonthsFortune = 0;

            categories?.TryGetValue(Fortune, out currentMonthsFortune);

            TryGetValue(monthAndYear.PreviousMonth(), out var lastMonthCategories);
            double previousMonthsFortune = 0;

            lastMonthCategories?.TryGetValue(Fortune, out previousMonthsFortune);

            return(currentMonthsFortune - previousMonthsFortune);
        }
コード例 #3
0
        public double GetInvestment(MonthAndYear monthAndYear)
        {
            TryGetValue(monthAndYear, out var categories);
            double currentMonthsInvestment = 0;

            categories?.TryGetValue(Investment, out currentMonthsInvestment);

            TryGetValue(monthAndYear.PreviousMonth(), out var lastMonthCategories);
            double previousMonthsInvestment = 0;

            lastMonthCategories?.TryGetValue(Investment, out previousMonthsInvestment);

            return(currentMonthsInvestment - previousMonthsInvestment);
        }
コード例 #4
0
        public double GetFortunesWithoutPension(MonthAndYear monthAndYear)
        {
            TryGetValue(monthAndYear, out var categories);

            return(categories?.Where(pair => pair.Key != Pension).Select(pair => pair.Value).Sum() ?? 0);
        }