示例#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);
        }
示例#2
0
        public static List <CompanyHolding> GetCompanyHoldings(GameContext context, int companyId, bool recursively)
        {
            List <CompanyHolding> companyHoldings = new List <CompanyHolding>();

            var c = Get(context, companyId);

            var investments = GetDaughterCompanies(context, companyId);

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

                companyHoldings.Add(holding);
            }

            return(companyHoldings);
        }
示例#3
0
        // entity can be company, investor or human?
        public static List <CompanyHolding> GetHoldings(GameEntity entity, GameContext context, bool recursively)
        {
            List <CompanyHolding> holdings = new List <CompanyHolding>();

            var ownings = GetOwnings(entity, context);

            foreach (var company in ownings)
            {
                var holding = new CompanyHolding
                {
                    //companyId = company.company.Id,
                    company = company,

                    control = Companies.GetShareSize(context, company, entity),

                    holdings = recursively ? GetHoldings(company, context, recursively) : new List <CompanyHolding>()
                };

                holdings.Add(holding);
            }

            return(holdings);
        }