Exemple #1
0
        public Dictionary <string, decimal> GetTotalFlowPerCategoriesForMonth(DateTime month)
        {
            Dictionary <string, decimal> categoryTotals = new Dictionary <string, decimal>
            {
                { "Total Expenses", GetTotalExpenseForMonth(month) }
            };

            categoryTotals.AddRange(_expenseService.GetAllCategoryTotals(month));

            categoryTotals.Add("Total Income", GetTotalIncomeForMonth(month));
            foreach (var totalIncomeByCategory in _incomeService.GetTotalIncomeByCategories(month))
            {
                if (categoryTotals.ContainsKey(totalIncomeByCategory.Key))
                {
                    var placeholder = categoryTotals[totalIncomeByCategory.Key];
                    categoryTotals.Remove(totalIncomeByCategory.Key);
#warning Verify that part.. >.<
                    categoryTotals.Add(string.Format("{0} - Expense", totalIncomeByCategory.Key), placeholder);
                    categoryTotals.Add(string.Format("{0} - Income", totalIncomeByCategory.Key), placeholder);
                }
                else
                {
                    categoryTotals.Add(totalIncomeByCategory.Key, totalIncomeByCategory.Value);
                }
            }

            return(categoryTotals);
        }