public RebalanceModel GetModelDetailForId_Client(string modelId) { List <AssetBase> allAssets = new List <AssetBase>(); var savedModel = edisRepo.GetRebalanceModelByModelId(modelId); 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 = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); groupAccounts.ForEach(a => allAssets.AddRange(a.GetAssetsSync().OfType <AustralianEquity>().Cast <AssetBase>().ToList())); clientAccounts.ForEach(a => allAssets.AddRange(a.GetAssetsSync().OfType <AustralianEquity>().Cast <AssetBase>().ToList())); return(GetRebalanceModel(allAssets, savedModel, clientGroup)); } else { List <ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); accounts.ForEach(a => allAssets.AddRange(a.GetAssetsSync().OfType <AustralianEquity>().Cast <AssetBase>().ToList())); return(GetRebalanceModel(allAssets, savedModel, null, client)); } }
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 IEnumerable <PortfolioQuickStatsModel> GetQuickStats_Client() { 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 = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); } else { List <ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); } return(null); }
public List <CorporateActionClientAccountModel> GetAllClientAccounts() { //return advisorRepo.GetAllClientAccounts(User.Identity.GetUserId()); var userid = User.Identity.GetUserId(); var allGroups = edisRepo.GetAllClientGroupsForAdviserSync(userid, DateTime.Now); var clients = new List <Client>(); List <CorporateActionClientAccountModel> allClients = new List <CorporateActionClientAccountModel>(); foreach (var group in allGroups) { clients.AddRange(group.GetClientsSync()); } //to get account number foreach (var client in clients) { var accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); foreach (var account in accounts) { allClients.Add(new CorporateActionClientAccountModel { edisAccountNumber = account.AccountNumber, type = account.AccountType.ToString(), shareAmount = client.FirstName + " " + client.LastName }); } } return(allClients); }
public List <AssetBase> getAllAssetForClient() { 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 = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); groupAccounts.ForEach(a => assets.AddRange(a.GetAssetsSync())); clientAccounts.ForEach(a => assets.AddRange(a.GetAssetsSync())); } else { List <ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now); accounts.ForEach(a => assets.AddRange(a.GetAssetsSync())); } return(assets); }
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 CashflowBriefModel GetCashflow_Client() { 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 = edisRepo.GetAccountsForClientSync(client.ClientNumber, 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); } else { List <ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, 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 accounts) { //List<Cashflow> cashFlows = account.GetAssetsSync().GetMonthlyCashflows(); 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); } }