private void MailUpdateChange(PstDeleteChange change, IDataManager dataManager, SecurityRepository securityRepository, MailMessage mailMessage, String username, DateTime date) { this.PortfolioName = change.PortfolioId; this.PortfolioName = change.PortfolioId; StringBuilder bodyAppendix = new StringBuilder("\n"); bodyAppendix.AppendLine("---" + date + ", Approved by: " + username + "---"); var security = securityRepository.FindSecurity(change.SecurityId); bodyAppendix.AppendLine(security.Name + "(" + security.ShortName + ") was removed [last target was " + MailSender.TransformTargetToString(change.TargetBefore) + "]"); bodyAppendix.AppendLine("COMMENT: " + change.Comment); mailMessage.Body += bodyAppendix; }
protected void ApplyDeleteChange(PstDeleteChange change, IDataManager manager, Int32 changesetId, Int32 changeId) { var changeInfo = new BuPortfolioSecurityTargetChangeInfo ( changeId, change.PortfolioId, change.SecurityId, change.TargetBefore, null, changesetId, change.Comment ); manager.InsertPortfolioSecurityTargetChange(changeInfo); manager.DeletePortfolioSecurityTarget(change.PortfolioId, change.SecurityId); }
public IEnumerable <IPstChange> TransformItems(String portfolioId, IEnumerable <ItemModel> items) { var result = new List <IPstChange>(); foreach (var item in items) { IPstChange change; if (item.Target.InitialValue.HasValue) { // update or delete if (item.Target.EditedValue.HasValue && item.Target.EditedValue.Value != 0) { if (CalculationHelper.NoDifference(item.Target.InitialValue.Value, item.Target.EditedValue.Value)) { continue; } else { // update change = new PstUpdateChange( portfolioId, item.Security.Id, item.Target.InitialValue.Value, item.Target.EditedValue.Value, item.Target.Comment ); } } else { // delete change = new PstDeleteChange( portfolioId, item.Security.Id, item.Target.InitialValue.Value, item.Target.Comment ); } } else { // insert or nothing if (item.Target.EditedValue.HasValue) { // insert change = new PstInsertChange( portfolioId, item.Security.Id, item.Target.EditedValue.Value, item.Target.Comment ); } else { // nothing, just skip this guy continue; } } result.Add(change); } return(result); }
public void Resolve(PstDeleteChange change) { this.applier.ApplyDeleteChange(change, this.manager, this.changesetId, this.changeId); }
public void Resolve(PstDeleteChange change) { this.applier.MailUpdateChange(change, this.manager, this.securityRepository, this.mail, this.username, this.date); }