public List <AssetBase> getCashAssetForAdviser(string clientGroupId) { List <AssetBase> assets = new List <AssetBase>(); if (string.IsNullOrEmpty(clientGroupId)) { List <GroupAccount> groupAccounts = edisRepo.getAllClientGroupAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); List <ClientAccount> clientAccounts = edisRepo.getAllClientAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); groupAccounts.ForEach(a => assets.AddRange(a.GetAssetsSync().OfType <Cash>().Cast <AssetBase>().ToList())); clientAccounts.ForEach(a => assets.AddRange(a.GetAssetsSync().OfType <Cash>().Cast <AssetBase>().ToList())); return(assets); } else { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(clientGroupId); List <GroupAccount> accounts = clientGroup.GetAccountsSync(DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); accounts.ForEach(a => assets.AddRange(a.GetAssetsSync().OfType <Cash>().Cast <AssetBase>().ToList())); clientAccounts.ForEach(a => assets.AddRange(a.GetAssetsSync().OfType <Cash>().Cast <AssetBase>().ToList())); return(assets); } }
public List <LiabilityBase> getMortgageLiabilitiesForAdviser(string clientGroupId) { List <LiabilityBase> liabilities = new List <LiabilityBase>(); if (string.IsNullOrEmpty(clientGroupId)) { List <GroupAccount> groupAccounts = edisRepo.getAllClientGroupAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); List <ClientAccount> clientAccounts = edisRepo.getAllClientAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); groupAccounts.ForEach(a => liabilities.AddRange(a.GetLiabilitiesSync().OfType <MortgageAndHomeLiability>().Cast <LiabilityBase>().ToList())); clientAccounts.ForEach(a => liabilities.AddRange(a.GetLiabilitiesSync().OfType <MortgageAndHomeLiability>().Cast <LiabilityBase>().ToList())); } else { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(clientGroupId); List <GroupAccount> accounts = clientGroup.GetAccountsSync(DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); accounts.ForEach(a => liabilities.AddRange(a.GetLiabilitiesSync().OfType <MortgageAndHomeLiability>().Cast <LiabilityBase>().ToList())); clientAccounts.ForEach(a => liabilities.AddRange(a.GetLiabilitiesSync().OfType <MortgageAndHomeLiability>().Cast <LiabilityBase>().ToList())); } return(liabilities); }
public List <ClientView> GetClientAccountsForGroup(string clientGroupId = null) { List <ClientView> views = new List <ClientView>(); if (string.IsNullOrEmpty(clientGroupId)) { } else { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(clientGroupId); List <GroupAccount> accounts = clientGroup.GetAccountsSync(DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); accounts.ForEach(a => views.Add(new ClientView { id = a.Id, name = a.AccountNameOrInfo, accountCatergory = AccountCatergories.GroupAccount.ToString() })); clientAccounts.ForEach(a => views.Add(new ClientView { id = a.Id, name = a.AccountNameOrInfo, accountCatergory = AccountCatergories.ClientAccount.ToString() })); } return(views); }
public AssetsAndLiabilites getAssetsAndLiabilitiesForAdviser(string clientGroupId) { List <AssetBase> assets = new List <AssetBase>(); List <LiabilityBase> liabilities = new List <LiabilityBase>(); if (string.IsNullOrEmpty(clientGroupId)) { List <GroupAccount> groupAccounts = edisRepo.getAllClientGroupAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); List <ClientAccount> clientAccounts = edisRepo.getAllClientAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); groupAccounts.ForEach(a => { assets.AddRange(a.GetAssetsSync()); liabilities.AddRange(a.GetLiabilitiesSync()); }); clientAccounts.ForEach(a => { assets.AddRange(a.GetAssetsSync()); liabilities.AddRange(a.GetLiabilitiesSync()); }); } else { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(clientGroupId); List <GroupAccount> accounts = clientGroup.GetAccountsSync(DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); accounts.ForEach(a => { assets.AddRange(a.GetAssetsSync()); liabilities.AddRange(a.GetLiabilitiesSync()); }); clientAccounts.ForEach(a => { assets.AddRange(a.GetAssetsSync()); liabilities.AddRange(a.GetLiabilitiesSync()); }); } return(new AssetsAndLiabilites { assets = assets, liabilities = liabilities }); }