public List <Home> GetAccountsSubtypeWise()
        {
            List <Home>              homes    = new List <Home>();
            List <Account>           accounts = accountVM.AccountList();
            double                   balance  = 0.0;
            Dictionary <int, double> subtype  = new Dictionary <int, double>();

            foreach (Account account in accounts)
            {
                balance = accountVM.GetBalance(account.id);
                try
                {
                    subtype[account.subtype] += balance;
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.ToString());
                    subtype.Add(account.subtype, balance);
                }
            }
            foreach (KeyValuePair <int, double> pair in subtype)
            {
                string name = subtypeVM.Get(pair.Key).name;
                homes.Add(new Home()
                {
                    name   = name,
                    amount = int.Parse(pair.Value.ToString())
                });
            }
            return(homes);
        }
Example #2
0
        public AccountSubtype GetSubtype(int subtype_id)
        {
            AccountSubtypeViewModel subtypevM = new AccountSubtypeViewModel();

            return(subtypevM.Get(subtype_id));
        }