public ProviderPortfolioScheme GetScheme(string id)
        {
            // get the portfolio
            var portfolio = this.Mongo.GetProviderPortfolio(id);

            // create the portfolio scheme
            var portfolioScheme = new ProviderPortfolioScheme(portfolio);

            // add the members
            var members = this.Mongo.GetProviderPortfolioMembers(portfolio.Id);

            portfolioScheme.Members.AddRange(members);

            return(portfolioScheme);
        }
Example #2
0
        public ProviderMember GetScheme(string memberId, string portfoliId = null)
        {
            // get the current member
            var member = this.Collection.FindAll().Where(item => item.Id == memberId).FirstOrDefault();

            if (portfoliId == null)
            {
                // create all the portfolio schemes
                var portfolios = this.Mongo.GetProviderPortfolios(memberId);

                foreach (var portfolio in portfolios)
                {
                    // create the portfolio scheme
                    var portfolioScheme = new ProviderPortfolioScheme(portfolio);

                    // add the members
                    var members = this.Mongo.GetProviderPortfolioMembers(portfolio.Id, member.Id);
                    portfolioScheme.Members.AddRange(members);

                    // add to the member's list of portfolio schemes
                    member.Portfolios.Add(portfolioScheme);
                }
            }
            else
            {
                // create all the portfolio schemes
                var portfolio = this.Mongo.GetProviderPortfolio(portfoliId);

                // create the portfolio scheme
                var portfolioScheme = new ProviderPortfolioScheme(portfolio);

                // add the members
                var members = this.Mongo.GetProviderPortfolioMembers(portfolio.Id, member.Id);
                portfolioScheme.Members.AddRange(members);

                // add to the member's list of portfolio schemes
                member.Portfolios.Add(portfolioScheme);
            }

            return(member);
        }
Example #3
0
        public void ProviderPortfolioCreated(ProviderPortfolio providerPortfolio)
        {
            // find the identities for any administrators
            var identities = this.Identities.Where(item => item.AccountType == AccountType.Administrator);

            if (!identities.Any())
            {
                return;
            }

            // build a provider portfolio scheme to send out
            var providerPortfolioScheme = new ProviderPortfolioScheme(providerPortfolio);

            // send this out to all client identities
            foreach (var identity in identities)
            {
                // send out the created provider portfolio
                this.HubContext.Clients.Client(identity.ConnectionId).ProviderPortfolioCreated(providerPortfolioScheme);

                // trace the transmission of this response
                this.Logger.Trace(string.Format("created provider portfolio for Id {0} automatically transmitted to for user Id {1} with connection Id {2}", providerPortfolioScheme.Id, identity.UserId, identity.ConnectionId));
            }
        }