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 CashPriceChartModel GetPrice_Adviser(string clientGroupId = null) { if (string.IsNullOrEmpty(clientGroupId)) { List <GroupAccount> groupAccounts = edisRepo.getAllClientGroupAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); List <ClientAccount> clientAccounts = edisRepo.getAllClientAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); return(repo.FixedIncome_GetPriceData_Adviser(User.Identity.GetUserId())); } else { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(clientGroupId); List <GroupAccount> accounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); foreach (var account in accounts) { account.GetAssetsSync(); } return(repo.FixedIncome_GetPriceData_Client(clientGroupId)); } }
public List <ClientView> GetClientAccountsForClient() { List <ClientView> views = new List <ClientView>(); Client client = edisRepo.GetClientSync(User.Identity.GetUserId(), DateTime.Now); ClientGroup clientGroup = edisRepo.GetClientGroupSync(client.ClientGroupId, DateTime.Now); if (clientGroup.MainClientId == client.Id) { List <GroupAccount> groupAccounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(edisRepo.GetAccountsForClientSync(c.ClientNumber, DateTime.Now))); groupAccounts.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() })); } else { List <ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); accounts.ForEach(a => views.Add(new ClientView { id = a.Id, name = a.AccountNameOrInfo, accountCatergory = AccountCatergories.ClientAccount.ToString() })); } return(views); }
public RebalanceModel GetModelDetailForId(string modelId) { List <AssetBase> allAssets = new List <AssetBase>(); var savedModel = edisRepo.GetRebalanceModelByModelId(modelId); ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(savedModel.ClientGroupId); List <GroupAccount> accounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); accounts.ForEach(a => allAssets.AddRange(a.GetAssetsSync())); clientAccounts.ForEach(a => allAssets.AddRange(a.GetAssetsSync())); return(GetRebalanceModel(allAssets, savedModel, clientGroup)); }
public List <AccountView> getAllCertainGroupAllAssociatedAccount(ClientAccountCreationBindingModel ClientGroupID) { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(ClientGroupID.clientGroup); List <GroupAccount> accounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); List <AccountView> result = new List <AccountView>(); accounts.ForEach(a => result.Add(new AccountView { id = a.Id, name = a.AccountNameOrInfo, accountCatagory = AccountCatergories.GroupAccount.ToString() })); clientAccounts.ForEach(a => result.Add(new AccountView { id = a.Id, name = a.AccountNameOrInfo, accountCatagory = AccountCatergories.ClientAccount.ToString() })); //var ClientGroupId = ClientGroupID.clientGroup; ////Here we retrieve the group account then add to the result //List<GroupAccount> accounts = edisRepo.GetAccountsForClientGroupByIdSync(ClientGroupId, DateTime.Now); //foreach (var groupAccount in accounts) { // result.Add(new AccountView { // id = groupAccount.Id, // name = groupAccount.AccountNameOrInfo // }); //} ////then we get all the clients' accounts //ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(ClientGroupId); //List<ClientAccount> clientAccounts = new List<ClientAccount>(); //clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); ////add to the result //foreach (var clientAccount in clientAccounts) { // result.Add(new AccountView { // id = clientAccount.Id, // name = clientAccount.AccountNameOrInfo // }); //} return(result); }
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 <LiabilityBase> getMortgageLiabilitiesForClient() { List <LiabilityBase> liabilities = new List <LiabilityBase>(); Client client = edisRepo.GetClientSync(User.Identity.GetUserId(), DateTime.Now); ClientGroup clientGroup = edisRepo.GetClientGroupSync(client.ClientGroupId, DateTime.Now); if (clientGroup.MainClientId == client.Id) { List <GroupAccount> groupAccounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); 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 { List <ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); accounts.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 }); }
public List <AssetBase> getCashAssetForClient() { List <AssetBase> assets = new List <AssetBase>(); Client client = edisRepo.GetClientSync(User.Identity.GetUserId(), DateTime.Now); ClientGroup clientGroup = edisRepo.GetClientGroupSync(client.ClientGroupId, DateTime.Now); if (clientGroup.MainClientId == client.Id) { List <GroupAccount> groupAccounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(edisRepo.GetAccountsForClientSync(c.ClientNumber, 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())); } else { List <ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); accounts.ForEach(a => assets.AddRange(a.GetAssetsSync().OfType <Cash>().Cast <AssetBase>().ToList())); } return(assets); }
public List <InsuranceListItemModel> GetInsuranceList_Adviser(string clientGroupId = null) { if (string.IsNullOrEmpty(clientGroupId)) { List <GroupAccount> groupAccounts = edisRepo.getAllClientGroupAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); List <ClientAccount> clientAccounts = edisRepo.getAllClientAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); List <InsuranceListItemDetailModel> assetInsurance = new List <InsuranceListItemDetailModel>(); List <InsuranceListItemDetailModel> persoanlInsurance = new List <InsuranceListItemDetailModel>(); List <InsuranceListItemDetailModel> liabilityInsurance = new List <InsuranceListItemDetailModel>(); List <InsuranceListItemDetailModel> miscellaneousInsurance = new List <InsuranceListItemDetailModel>(); List <InsuranceListItemModel> model = new List <InsuranceListItemModel>(); model.Add(new InsuranceListItemModel { insuranceMetaType = InsuranceType.AssetInsurance.ToString(), data = assetInsurance, }); model.Add(new InsuranceListItemModel { insuranceMetaType = InsuranceType.LiabilityInsurance.ToString(), data = liabilityInsurance, }); model.Add(new InsuranceListItemModel { insuranceMetaType = InsuranceType.MiscellaneousInsurance.ToString(), data = miscellaneousInsurance, }); model.Add(new InsuranceListItemModel { insuranceMetaType = InsuranceType.PersoanlInsurance.ToString(), data = persoanlInsurance, }); List <LiabilityBase> liabilities = new List <LiabilityBase>(); foreach (var account in groupAccounts) { liabilities.AddRange(account.GetLiabilitiesSync()); } foreach (var account in clientAccounts) { liabilities.AddRange(account.GetLiabilitiesSync()); } var insurancesGroups = liabilities.OfType <Insurance>().GroupBy(i => i.InsuranceType); foreach (var insuranceMetaGroup in insurancesGroups) { var insurance = insuranceMetaGroup.FirstOrDefault(); switch (insuranceMetaGroup.Key) { case InsuranceType.None: model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.None.ToString()).data.Add(SetModelDetailsFromInsurance(new InsuranceListItemDetailModel(), insurance)); break; case InsuranceType.AssetInsurance: model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.AssetInsurance.ToString()).data.Add(SetModelDetailsFromInsurance(new InsuranceListItemDetailModel(), insurance)); break; case InsuranceType.MiscellaneousInsurance: model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.MiscellaneousInsurance.ToString()).data.Add(SetModelDetailsFromInsurance(new InsuranceListItemDetailModel(), insurance)); break; case InsuranceType.PersoanlInsurance: model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.PersoanlInsurance.ToString()).data.Add(SetModelDetailsFromInsurance(new InsuranceListItemDetailModel(), insurance)); break; } //switch (insuranceMetaGroup.Key) //{ // case InsuranceType.None: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.None.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.None.ToString()), insurance); // break; // case InsuranceType.AssetInsurance: // switch (insurance.PolicyType) // { // case PolicyType.Boat: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.AssetInsurance.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.Boat.ToString()), insurance); // break; // case PolicyType.Building: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.AssetInsurance.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.Building.ToString()), insurance); // break; // case PolicyType.Car: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.AssetInsurance.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.Car.ToString()), insurance); // break; // case PolicyType.MotorBike: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.AssetInsurance.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.MotorBike.ToString()), insurance); // break; // case PolicyType.Content: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.AssetInsurance.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.Content.ToString()), insurance); // break; // } // break; // case InsuranceType.MiscellaneousInsurance: // switch (insurance.PolicyType) // { // case PolicyType.IncomeProtection: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.MiscellaneousInsurance.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.IncomeProtection.ToString()), insurance); // break; // case PolicyType.RentalIncome: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.MiscellaneousInsurance.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.RentalIncome.ToString()), insurance); // break; // } // break; // case InsuranceType.PersoanlInsurance: // SetModelDetailsFromInsurance(model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.PersoanlInsurance.ToString()).data.SingleOrDefault(d => d.typeOfPolicy == PolicyType.Accident.ToString()), insurance); // break; //} } return(model); //return repo.Insurance_GetInsuranceList_Adviser(User.Identity.GetUserId()); } else { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(clientGroupId); List <GroupAccount> accounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); List <InsuranceListItemDetailModel> assetInsurance = new List <InsuranceListItemDetailModel>(); List <InsuranceListItemDetailModel> persoanlInsurance = new List <InsuranceListItemDetailModel>(); List <InsuranceListItemDetailModel> liabilityInsurance = new List <InsuranceListItemDetailModel>(); List <InsuranceListItemDetailModel> miscellaneousInsurance = new List <InsuranceListItemDetailModel>(); List <InsuranceListItemModel> model = new List <InsuranceListItemModel>(); //model.Add(new InsuranceListItemModel //{ // insuranceMetaType = InsuranceType.None.ToString(), // data = noneInsurance, //}); model.Add(new InsuranceListItemModel { insuranceMetaType = InsuranceType.AssetInsurance.ToString(), data = assetInsurance, }); model.Add(new InsuranceListItemModel { insuranceMetaType = InsuranceType.LiabilityInsurance.ToString(), data = liabilityInsurance, }); model.Add(new InsuranceListItemModel { insuranceMetaType = InsuranceType.MiscellaneousInsurance.ToString(), data = miscellaneousInsurance, }); model.Add(new InsuranceListItemModel { insuranceMetaType = InsuranceType.PersoanlInsurance.ToString(), data = persoanlInsurance, }); List <LiabilityBase> liabilities = new List <LiabilityBase>(); accounts.ForEach(a => liabilities.AddRange(a.GetLiabilitiesSync())); clientAccounts.ForEach(a => liabilities.AddRange(a.GetLiabilitiesSync())); var insurancesGroups = liabilities.OfType <Insurance>().GroupBy(i => i.InsuranceType); foreach (var insuranceMetaGroup in insurancesGroups) { var insurance = insuranceMetaGroup.FirstOrDefault(); switch (insuranceMetaGroup.Key) { case InsuranceType.None: model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.None.ToString()).data.Add(SetModelDetailsFromInsurance(new InsuranceListItemDetailModel(), insurance)); break; case InsuranceType.AssetInsurance: model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.AssetInsurance.ToString()).data.Add(SetModelDetailsFromInsurance(new InsuranceListItemDetailModel(), insurance)); break; case InsuranceType.MiscellaneousInsurance: model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.MiscellaneousInsurance.ToString()).data.Add(SetModelDetailsFromInsurance(new InsuranceListItemDetailModel(), insurance)); break; case InsuranceType.PersoanlInsurance: model.SingleOrDefault(i => i.insuranceMetaType == InsuranceType.PersoanlInsurance.ToString()).data.Add(SetModelDetailsFromInsurance(new InsuranceListItemDetailModel(), insurance)); break; } } return(model); //return repo.Insurance_GetInsuranceList_Client(clientGroupId); } }
public CashflowBriefModel GetCashflow_Adviser(string clientGroupId = null) { if (string.IsNullOrEmpty(clientGroupId)) { List <GroupAccount> groupAccounts = edisRepo.getAllClientGroupAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); List <ClientAccount> clientAccounts = edisRepo.getAllClientAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); double totalExpenseInAssets = 0; double totalIncomeInAssets = 0; List <CashFlowBriefItem> items = new List <CashFlowBriefItem>(); CashFlowBriefItem jan = new CashFlowBriefItem { month = "Jan" }; CashFlowBriefItem feb = new CashFlowBriefItem { month = "Feb" }; CashFlowBriefItem mar = new CashFlowBriefItem { month = "Mar" }; CashFlowBriefItem apr = new CashFlowBriefItem { month = "Apr" }; CashFlowBriefItem may = new CashFlowBriefItem { month = "May" }; CashFlowBriefItem jun = new CashFlowBriefItem { month = "Jun" }; CashFlowBriefItem jul = new CashFlowBriefItem { month = "Jul" }; CashFlowBriefItem aug = new CashFlowBriefItem { month = "Aug" }; CashFlowBriefItem sep = new CashFlowBriefItem { month = "Sep" }; CashFlowBriefItem oct = new CashFlowBriefItem { month = "Oct" }; CashFlowBriefItem nov = new CashFlowBriefItem { month = "Nov" }; CashFlowBriefItem dec = new CashFlowBriefItem { month = "Dec" }; foreach (var account in groupAccounts) { List <Cashflow> cashFlows = account.GetLiabilitiesSync().OfType <Insurance>().Cast <LiabilityBase>().ToList().GetMonthlyCashflows(); foreach (var cashflow in cashFlows) { switch (cashflow.Month) { case "Jan": jan.date = DateTime.Now; jan.expense += cashflow.Expenses; jan.income += cashflow.Income; break; case "Feb": feb.date = DateTime.Now; feb.expense += cashflow.Expenses; feb.income += cashflow.Income; break; case "Mar": mar.date = DateTime.Now; mar.expense += cashflow.Expenses; mar.income += cashflow.Income; break; case "Apr": apr.date = DateTime.Now; apr.expense += cashflow.Expenses; apr.income += cashflow.Income; break; case "May": may.date = DateTime.Now; may.expense += cashflow.Expenses; may.income += cashflow.Income; break; case "Jun": jun.date = DateTime.Now; jun.expense += cashflow.Expenses; jun.income += cashflow.Income; break; case "Jul": jul.date = DateTime.Now; jul.expense += cashflow.Expenses; jul.income += cashflow.Income; break; case "Aug": aug.date = DateTime.Now; aug.expense += cashflow.Expenses; aug.income += cashflow.Income; break; case "Sep": sep.date = DateTime.Now; sep.expense += cashflow.Expenses; sep.income += cashflow.Income; break; case "Oct": oct.date = DateTime.Now; oct.expense += cashflow.Expenses; oct.income += cashflow.Income; break; case "Nov": nov.date = DateTime.Now; nov.expense += cashflow.Expenses; nov.income += cashflow.Income; break; case "Dec": dec.date = DateTime.Now; dec.expense += cashflow.Expenses; dec.income += cashflow.Income; break; default: break; } totalExpenseInAssets += cashflow.Expenses; totalIncomeInAssets += cashflow.Income; } } foreach (var account in clientAccounts) { List <Cashflow> cashFlows = account.GetLiabilitiesSync().OfType <Insurance>().Cast <LiabilityBase>().ToList().GetMonthlyCashflows(); foreach (var cashflow in cashFlows) { switch (cashflow.Month) { case "Jan": jan.date = DateTime.Now; jan.expense += cashflow.Expenses; jan.income += cashflow.Income; break; case "Feb": feb.date = DateTime.Now; feb.expense += cashflow.Expenses; feb.income += cashflow.Income; break; case "Mar": mar.date = DateTime.Now; mar.expense += cashflow.Expenses; mar.income += cashflow.Income; break; case "Apr": apr.date = DateTime.Now; apr.expense += cashflow.Expenses; apr.income += cashflow.Income; break; case "May": may.date = DateTime.Now; may.expense += cashflow.Expenses; may.income += cashflow.Income; break; case "Jun": jun.date = DateTime.Now; jun.expense += cashflow.Expenses; jun.income += cashflow.Income; break; case "Jul": jul.date = DateTime.Now; jul.expense += cashflow.Expenses; jul.income += cashflow.Income; break; case "Aug": aug.date = DateTime.Now; aug.expense += cashflow.Expenses; aug.income += cashflow.Income; break; case "Sep": sep.date = DateTime.Now; sep.expense += cashflow.Expenses; sep.income += cashflow.Income; break; case "Oct": oct.date = DateTime.Now; oct.expense += cashflow.Expenses; oct.income += cashflow.Income; break; case "Nov": nov.date = DateTime.Now; nov.expense += cashflow.Expenses; nov.income += cashflow.Income; break; case "Dec": dec.date = DateTime.Now; dec.expense += cashflow.Expenses; dec.income += cashflow.Income; break; default: break; } totalExpenseInAssets += cashflow.Expenses; totalIncomeInAssets += cashflow.Income; } } items.Add(jan); items.Add(feb); items.Add(mar); items.Add(apr); items.Add(may); items.Add(jun); items.Add(jul); items.Add(aug); items.Add(sep); items.Add(oct); items.Add(nov); items.Add(dec); CashflowBriefModel model = new CashflowBriefModel { totalExpense = totalExpenseInAssets, totalIncome = totalIncomeInAssets, data = items }; return(model); //return repo.AustralianEquity_GetCashflowSummary_Adviser(User.Identity.GetUserId()); } else { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(clientGroupId); List <GroupAccount> accounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); double totalExpenseInAssets = 0; double totalIncomeInAssets = 0; List <CashFlowBriefItem> items = new List <CashFlowBriefItem>(); CashFlowBriefItem jan = new CashFlowBriefItem { month = "Jan" }; CashFlowBriefItem feb = new CashFlowBriefItem { month = "Feb" }; CashFlowBriefItem mar = new CashFlowBriefItem { month = "Mar" }; CashFlowBriefItem apr = new CashFlowBriefItem { month = "Apr" }; CashFlowBriefItem may = new CashFlowBriefItem { month = "May" }; CashFlowBriefItem jun = new CashFlowBriefItem { month = "Jun" }; CashFlowBriefItem jul = new CashFlowBriefItem { month = "Jul" }; CashFlowBriefItem aug = new CashFlowBriefItem { month = "Aug" }; CashFlowBriefItem sep = new CashFlowBriefItem { month = "Sep" }; CashFlowBriefItem oct = new CashFlowBriefItem { month = "Oct" }; CashFlowBriefItem nov = new CashFlowBriefItem { month = "Nov" }; CashFlowBriefItem dec = new CashFlowBriefItem { month = "Dec" }; List <Cashflow> cashFlows = new List <Cashflow>(); accounts.ForEach(a => cashFlows.AddRange(a.GetLiabilitiesSync().OfType <Insurance>().Cast <LiabilityBase>().ToList().GetMonthlyCashflows())); clientAccounts.ForEach(a => cashFlows.AddRange(a.GetLiabilitiesSync().OfType <Insurance>().Cast <LiabilityBase>().ToList().GetMonthlyCashflows())); foreach (var cashflow in cashFlows) { switch (cashflow.Month) { case "Jan": jan.date = DateTime.Now; jan.expense += cashflow.Expenses; jan.income += cashflow.Income; break; case "Feb": feb.date = DateTime.Now; feb.expense += cashflow.Expenses; feb.income += cashflow.Income; break; case "Mar": mar.date = DateTime.Now; mar.expense += cashflow.Expenses; mar.income += cashflow.Income; break; case "Apr": apr.date = DateTime.Now; apr.expense += cashflow.Expenses; apr.income += cashflow.Income; break; case "May": may.date = DateTime.Now; may.expense += cashflow.Expenses; may.income += cashflow.Income; break; case "Jun": jun.date = DateTime.Now; jun.expense += cashflow.Expenses; jun.income += cashflow.Income; break; case "Jul": jul.date = DateTime.Now; jul.expense += cashflow.Expenses; jul.income += cashflow.Income; break; case "Aug": aug.date = DateTime.Now; aug.expense += cashflow.Expenses; aug.income += cashflow.Income; break; case "Sep": sep.date = DateTime.Now; sep.expense += cashflow.Expenses; sep.income += cashflow.Income; break; case "Oct": oct.date = DateTime.Now; oct.expense += cashflow.Expenses; oct.income += cashflow.Income; break; case "Nov": nov.date = DateTime.Now; nov.expense += cashflow.Expenses; nov.income += cashflow.Income; break; case "Dec": dec.date = DateTime.Now; dec.expense += cashflow.Expenses; dec.income += cashflow.Income; break; default: break; } totalExpenseInAssets += cashflow.Expenses; totalIncomeInAssets += cashflow.Income; } items.Add(jan); items.Add(feb); items.Add(mar); items.Add(apr); items.Add(may); items.Add(jun); items.Add(jul); items.Add(aug); items.Add(sep); items.Add(oct); items.Add(nov); items.Add(dec); CashflowBriefModel model = new CashflowBriefModel { totalExpense = totalExpenseInAssets, totalIncome = totalIncomeInAssets, data = items }; return(model); //return repo.AustralianEquity_GetCashflowSummary_Client(clientUserId); } }
public InvestmentPortfolioModel GetAssetAllocationSummary_Adviser(string clientGroupId = null) { if (string.IsNullOrEmpty(clientGroupId)) { List <GroupAccount> groupAccounts = edisRepo.getAllClientGroupAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); List <ClientAccount> clientAccounts = edisRepo.getAllClientAccountsForAdviser(User.Identity.GetUserId(), DateTime.Now); double totalMarketValueAE = 0; double totalMarketValueIE = 0; double totalMarketValueMI = 0; double totalMarketValueDP = 0; double totalMarketValueFI = 0; double totalMarketValueCD = 0; foreach (var account in groupAccounts) { totalMarketValueAE += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <AustralianEquity>(); totalMarketValueIE += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <InternationalEquity>(); totalMarketValueMI += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <ManagedInvestment>(); totalMarketValueDP += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <DirectProperty>(); totalMarketValueFI += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <FixedIncome>(); totalMarketValueCD += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <Cash>(); } foreach (var account in clientAccounts) { totalMarketValueAE += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <AustralianEquity>(); totalMarketValueIE += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <InternationalEquity>(); totalMarketValueMI += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <ManagedInvestment>(); totalMarketValueDP += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <DirectProperty>(); totalMarketValueFI += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <FixedIncome>(); totalMarketValueCD += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <Cash>(); } InvestmentPortfolioModel model = new InvestmentPortfolioModel { data = new List <DataNameAmountPair> { new DataNameAmountPair { name = "Australian Equity", amount = totalMarketValueAE }, new DataNameAmountPair { name = "International Equity", amount = totalMarketValueIE }, new DataNameAmountPair { name = "Managed Investments", amount = totalMarketValueMI }, new DataNameAmountPair { name = "Direct & Listed Property", amount = totalMarketValueDP }, new DataNameAmountPair { name = "Miscellaneous Investments", amount = totalMarketValueAE }, new DataNameAmountPair { name = "Fixed Income Investments", amount = totalMarketValueFI }, new DataNameAmountPair { name = "Cash & Term Deposit", amount = totalMarketValueCD }, }, }; return(model); } else { ClientGroup clientGroup = edisRepo.getClientGroupByGroupId(clientGroupId); List <GroupAccount> accounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientAccount> clientAccounts = new List <ClientAccount>(); clientGroup.GetClientsSync().ForEach(c => clientAccounts.AddRange(c.GetAccountsSync())); double totalMarketValueAE = 0; double totalMarketValueIE = 0; double totalMarketValueMI = 0; double totalMarketValueDP = 0; double totalMarketValueFI = 0; double totalMarketValueCD = 0; foreach (var account in accounts) { totalMarketValueAE += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <AustralianEquity>(); totalMarketValueIE += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <InternationalEquity>(); totalMarketValueMI += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <ManagedInvestment>(); totalMarketValueDP += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <DirectProperty>(); totalMarketValueFI += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <FixedIncome>(); totalMarketValueCD += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <Cash>(); } foreach (var account in clientAccounts) { totalMarketValueAE += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <AustralianEquity>(); totalMarketValueIE += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <InternationalEquity>(); totalMarketValueMI += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <ManagedInvestment>(); totalMarketValueDP += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <DirectProperty>(); totalMarketValueFI += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <FixedIncome>(); totalMarketValueCD += account.GetAssetsSync().GetTotalMarketValue_ByAssetType <Cash>(); } InvestmentPortfolioModel model = new InvestmentPortfolioModel { data = new List <DataNameAmountPair> { new DataNameAmountPair { name = "Australian Equity", amount = totalMarketValueAE }, new DataNameAmountPair { name = "International Equity", amount = totalMarketValueIE }, new DataNameAmountPair { name = "Managed Investments", amount = totalMarketValueMI }, new DataNameAmountPair { name = "Direct & Listed Property", amount = totalMarketValueDP }, new DataNameAmountPair { name = "Miscellaneous Investments", amount = totalMarketValueAE }, new DataNameAmountPair { name = "Fixed Income Investments", amount = totalMarketValueFI }, new DataNameAmountPair { name = "Cash & Term Deposit", amount = totalMarketValueCD }, }, }; return(model); } //return repo.ManagedInvestment_GetAssetAllocation_Adviser(User.Identity.GetUserId()); }