public List <ClientView> getAllAdviserClientsForGroup(ClientAccountCreationBindingModel clientGroupNumber) { var clientGroup = edisRepo.getClientGroupByGroupId(clientGroupNumber.clientGroup); //Add this statement ............. var clientList = edisRepo.GetClientsForGroupSync(clientGroup.ClientGroupNumber, DateTime.Now); List <ClientView> clients = new List <ClientView>(); foreach (var client in clientList) { if (client.ClientType == "person") { clients.Add(new ClientView { id = client.Id, name = client.FirstName + " " + client.LastName, }); } else { clients.Add(new ClientView { id = client.Id, name = client.EntityName, }); } } return(clients); }
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 void createClientGroupAccount(ClientAccountCreationBindingModel model) { edisRepo.CreateNewClientGroupAccountSync(model.clientGroup, model.accountName, model.accountType, model.marginLenderId); }