private string GetVariantProperty(ItemVariationComponent variation, VariationPropertyPolicy variationPropertyPolicy, string v) { foreach (var variationProperty in variationPropertyPolicy.PropertyNames) { var property = GetVariationProperty(variation, variationProperty); if (variationProperty == "PIN") { return((string)property); } } return(string.Empty); }
/// <summary> /// Populates the variation properties in the entity view /// </summary> /// <param name="variationView">The variation view.</param> /// <param name="variation">The item variation component.</param> /// <param name="variationPropertyPolicy">The variation property policy.</param> protected virtual void PopulateVariationProperties(EntityView variationView, ItemVariationComponent variation, VariationPropertyPolicy variationPropertyPolicy) { if (variationView == null) { return; } foreach (var variationProperty in variationPropertyPolicy.PropertyNames) { var property = GetVariationProperty(variation, variationProperty); var insertIndex = variationView.Properties.Count > 0 ? variationView.Properties.Count - 1 : 0; variationView.Properties.Insert(insertIndex, new ViewProperty { Name = variationProperty, RawValue = property ?? string.Empty, IsReadOnly = true }); } }