Пример #1
0
        public List <Account> GetAccountsWithCF(string collectionsId, int count)
        {
            CFClassification        classification  = new CFClassification();
            List <CFClassification> classifications = classification.GetList();
            List <Account>          accounts        = GetAccountsEmpty(collectionsId);
            Institution             institution     = new Institution();
            List <Institution>      institutions    = institution.GetInstitutions();
            AccountType             type            = new AccountType();
            List <AccountType>      types           = type.GetAccountTypes();
            ManualCashFlow          manual          = new ManualCashFlow();
            AutomatedCashFlow       automated       = new AutomatedCashFlow();
            Collections             collection      = new Collections();

            foreach (Account item in accounts)
            {
                item.Institution = institutions
                                   .Where(x => x.Id == item.InstitutionId)
                                   .FirstOrDefault();
                item.AccountType = types
                                   .Where(x => x.AccountTypeId == item.AccountTypeId)
                                   .FirstOrDefault();
                item.AccountType.Accounts = null;
                item.ManualCashFlows      = manual.GetManualCashFlows(item.Id, count);
                item.AutomatedCashFlows   = automated.GetAutomatedCashFlows(item.Id, count);
                foreach (ManualCashFlow flow in item.ManualCashFlows)
                {
                    flow.CFClassification = classifications.Where(x => x.Id == flow.CFClassificationId).FirstOrDefault();;
                    flow.CFClassification.ManualCashFlows = null;
                }
                foreach (AutomatedCashFlow flow in item.AutomatedCashFlows)
                {
                    flow.CFClassification = classifications.Where(x => x.Id == flow.CFClassificationId).FirstOrDefault();;
                    flow.CFClassification.ManualCashFlows = null;
                }
                item.Collections = collection.GetCollections(collectionsId);
                //foreach(ManualCashFlow flow in item.ManualCashFlows)
                //{
                //	flow.Account.ManualCashFlows = null;
                //}
            }
            return(accounts);
        }
Пример #2
0
        /// <summary>
        /// List of accounts associated to a single Collection
        /// </summary>
        /// <param name="collectionsId">The collection Id that is being requested</param>
        /// <param name="transactions">Are transactions to be included</param>
        /// <returns>Returns a list of accounts associated to the collection Id</returns>
        public List <Account> GetAccounts(string collectionsId, bool transactions = true)
        {
            List <Account>     accounts     = GetAccountsEmpty(collectionsId);
            Institution        institution  = new Institution();
            List <Institution> institutions = institution.GetInstitutions();
            AccountType        type         = new AccountType();
            List <AccountType> types        = type.GetAccountTypes();

            foreach (Account item in accounts)
            {
                item.Institution = institutions.Where(x => x.Id == item.InstitutionId).FirstOrDefault();
                item.AccountType = types.Where(x => x.AccountTypeId == item.AccountTypeId).FirstOrDefault();
                if (transactions)
                {
                    item.GetTransactions();
                }
                item.AccountType.Accounts = null;
            }
            return(accounts);
        }