Exemplo n.º 1
0
        public static List <CompanyHolding> GetPersonalHoldings(GameContext context, int shareholderId, bool recursively)
        {
            List <CompanyHolding> companyHoldings = new List <CompanyHolding>();

            var investments = Investments.GetInvestmentsOf(context, shareholderId);

            foreach (var investment in investments)
            {
                var holding = new CompanyHolding
                {
                    companyId = investment.company.Id,
                    control   = GetShareSize(context, investment.company.Id, shareholderId),
                    holdings  = recursively ? GetCompanyHoldings(context, investment.company.Id, recursively) : new List <CompanyHolding>()
                };

                companyHoldings.Add(holding);
            }

            return(companyHoldings);
        }