public static void AddMissingParentAttributes(OffnetServiceKey key) { if (key.ParentServiceKey != null) { key.ParentServiceKey.AddMissingAttributes(); var childConfig = OffnetServiceConfiguration.Get(key.Id, key.EffectiveDate); var parentConfig = OffnetServiceConfiguration.Get(key.ParentServiceKey.Id, key.ParentServiceKey.EffectiveDate); string value; foreach (var attribute in childConfig.Attributes) { if (attribute.Value.Type == AttributeType.Parent) { value = key.ParentServiceKey.GetAttributeValue(attribute.Value.Name, SearchOptions.ALL_TRUE); if (value == null) { value = parentConfig.GetDefaultValue(attribute.Value.Name, key.ParentServiceKey); } if (value != null) { key.AddAttribute(attribute.Value.Name, value); } } } } }
public void SetAttributeValue(OffnetServiceKey key, long id) { var childConfig = OffnetServiceConfiguration.Get(key.Id, key.EffectiveDate); string value; foreach (var attribute in childConfig.Attributes) { if (attribute.Value.Name.Equals("UNI Reference ID")) { value = id.ToString(); key.AddAttribute(attribute.Value.Name, value); } } }
public static void AddMissingDefaultAttributes(OffnetServiceKey key) { var childConfig = OffnetServiceConfiguration.Get(key.Id, key.EffectiveDate); string value; foreach (var attribute in childConfig.Attributes) { //if (attribute.Value.Type != AttributeType.List // && key.GetAttributeValue(attribute.Value.Name, SearchOptions.ALL_FALSE) == null // && !childConfig.IsOptional(attribute.Value.Name, key)) //{ value = childConfig.GetDefaultValue(attribute.Value.Name, key); if (value != null) { key.AddAttribute(attribute.Value.Name, value); } //} } }