コード例 #1
0
        /// <summary>
        /// Scrapes a changeset with portfolio adjustments.
        /// Changeset isn't guaranteed because changeset may not have any changes at all.
        /// </summary>
        public Changeset TryTransformToChangeset(RootModel model, String username)
        {
            var models = this.traverser.TraverseGlobe(model.Globe);

            IEnumerable <IChange> changes = models
                                            .Select(x => this.TryTransformToChangeOnceResolved(x))
                                            .Where(x => x != null);

            Changeset result;

            if (changes.Any())
            {
                result = new Changeset(model.LatestTtbptChangeset, model.TargetingType.Id, model.Portfolio.Id, username, changes);
            }
            else
            {
                result = null;
            }
            return(result);
        }
コード例 #2
0
        private void SendNotification(String ttName, String portfolioName, ChangingPsto.Changeset pstoChangeset, ChangingTtbbv.Changeset ttbbvChangeset, ChangingTtbpt.Changeset ttbptChangeset, IDataManager manager, SecurityRepository securityRepository, BasketRepository basketRepository, PortfolioRepository portfolioRepository, string userEmail)
        {
            try
            {
                MailMessage mail = new MailMessage();
                mail.IsBodyHtml = false;

                var pstoChanges  = this.pstoChangesetApplier.PrepareToSend(pstoChangeset, manager, securityRepository, portfolioRepository, portfolioName);
                var ttbbvChanges = this.ttbbvChangesetApplier.PrepareToSend(ttbbvChangeset, manager, securityRepository, basketRepository, ttName);
                var ttbptChanges = this.ttbptChangesetApplier.PrepareToSend(ttbptChangeset, manager, securityRepository, basketRepository, ttName, portfolioName);


                mail.Body    = "The following Asset Allocation changes were made to the Global Active Accounts:\n" + (ttbbvChangeset != null ? String.Join("\n", ttbbvChanges) : "\n") + (ttbptChangeset != null ? String.Join("\n", ttbptChanges) : "\n") + (pstoChangeset != null ? String.Join("\n", pstoChanges) : "");
                mail.Subject = "Targeting: Asset Allocation Changes";
                MailSender.SendTargetingAlert(mail, userEmail);
            }
            catch (Exception e)
            {
                throw new EmailNotificationException("See inner exception for details.", e);
            }
        }