public override void Apply(PartnerServicePackage package, string iteration, ResolveOffnetServiceSet rss) { //See if tag already exists... var sk = rss.FetchAndRemoveExistingService(rss.GetTagName(_tagName)); if (sk == null) { sk = rss.FetchAndRemoveExistingService(_tagName); } if (sk == null) { sk = _key; } if (!sk.Id.Equals(_key.Id)) { sk.Id = _key.Id; // sk.Activity = ActivityType.Modify; sk.EffectiveDate = DateTime.Now; } package.AddService(rss.GetTagName(_tagName), sk); }
public void AddRule(OffnetServiceMappingRule sr, PartnerKeyWeb key, ResolveOffnetServiceSet rss) { var rule = sr as PartnerTagServiceRule; if (rule != null) { var ptsr = rule; _partnerTags.Add(rss.GetTagName(ptsr.TagName), key); return; } else if (sr != null) { //If the "key" is in there already, replace it. _serviceRules.RemoveAll(r => r.CompareString().Equals(sr.CompareString())); _serviceRules.Add(sr); } }
public override void Apply(PartnerServicePackage package, string iteration, ResolveOffnetServiceSet rss) { var sk = package.GetService(rss.GetTagName(Concat(_sTag, iteration))); if (sk == null) { Debugger.Log(new PcatExceptionInfo($"Service {_sTag} not found!") { StackTrace = this.ToString() }); return; } AttributeValue value; PartnerKeyWeb key; var patts = new PartnerAtrributes(); patts.FromWeb(package.Partner); StringBuilder debugDetail = new StringBuilder(); if (_pTag == CONSTANT) { value = CreateAttribute(sk, _pAtt); key = package.Partner; debugDetail.Append("Constant"); } else { key = rss.GetPartner(_pTag); var av = patts.GetAttributeValue(_pAtt); if (av == null) { // if the product doesn't have a value, let's remove it from the service in case an old value is sitting there sk.RemoveAttribute(_sAttName); Debugger.Log(new DebugAttributeInfo(sk?.Id * -1, _sAttName, null, DebugAttributeInfoSourceType.Rule, DebugAttributeInfoFunctionType.GetValue, null) { RuleText = $"Removed because {_pTag}.{_pAtt} doesn't exist or is null" }); return; } value = CreateAttribute(sk, av); debugDetail.Append($"Copy from {_pTag}.{_pTag}"); } if (value != null) { var oldValue = sk.GetValue(_sAttName, SearchOptions.ALL_TRUE); var changed = (oldValue != null) ? false : AttributeChanged(oldValue, value); if (_strip) { //We need to remove everything but the number from the value before we use it... value.Value = ParseNumber(value.Value); debugDetail.Append(", value stripped to just a number"); } } else { debugDetail.Append($", {_sTag}.{_sAttName} is not applicable"); } sk.AddValue(_sAttName, value); Debugger.Log(new DebugAttributeInfo(sk?.Id + 50000, _sAttName, value?.Value, DebugAttributeInfoSourceType.Rule, DebugAttributeInfoFunctionType.GetValue, null) { RuleText = debugDetail.ToString() }); }