/// <summary> /// Get income and expense details for each service (see expenseGroups). /// </summary> /// <returns>Dictionary of name => IncomeExpense.</returns> public Dictionary <String, IncomeExpense> GetIncomesAndExpenses() { //LogMessage("Getting Income/Expense info."); Dictionary <String, IncomeExpense> incomeExpenses = new Dictionary <String, IncomeExpense>(); foreach (IncomeExpenseGroup group in expenseGroups) { if (group.Levels > 0) { for (int i = 1; i <= group.Levels; i++) { economyManager.GetIncomeAndExpenses( group.Service, group.SubService, (ItemClass.Level)(i - 1), out long income, out long expense); incomeExpenses[$"{group.Name}_Lv{i}"] = new IncomeExpense { Income = income, Expense = expense, Level = i, }; } } else //This group doesn't have levels { economyManager.GetIncomeAndExpenses( group.Service, group.SubService, ItemClass.Level.None, out long income, out long expense); incomeExpenses[group.Name] = new IncomeExpense { Income = income, Expense = expense, Level = 0, }; } } //These aren't considered services incomeExpenses["LoanPayments"] = new IncomeExpense { Income = 0, Expense = economyManager.GetLoanExpenses(), Level = 0, }; incomeExpenses["Policies"] = new IncomeExpense { Income = 0, Expense = economyManager.GetPolicyExpenses(), Level = 0, }; return(incomeExpenses); }