public string GetPropertiesForExport(int sourceMaterialId, int sourceId, int subgroupId, List <PropertyFilter> properties, ElsevierMaterials.Models.Domain.Export.Exporter exporter, out List <PropertyFilter> propertiesForExport, IMaterialsContextUow materialContextUow) { propertiesForExport = new List <PropertyFilter>(); PropertyBinder propertyBinder = new PropertyBinder(); ConditionBinder conditionBinder = new ConditionBinder(); string message = ""; string propertes1 = ""; string propertes2 = ""; string ulOpen = "<ul>"; string ulClose = "</ul>"; string title1 = "The following properties are added to export: "; string title2 = "The following properties cannot be exported: "; foreach (var addedProperty in properties) { ElsevierMaterials.Models.Condition condition = conditionBinder.FillCondition(sourceMaterialId, sourceId, subgroupId, materialContextUow, addedProperty); int notMappedPropertyId = addedProperty.SourceTypeId != 0 ? addedProperty.SourceTypeId : addedProperty.TypeId; TMPropertyTypeEnum propertyId = MapElsPropertyId(notMappedPropertyId, (SourceTypeEnum)sourceId); if (!exporter.Properties.Contains(propertyId)) { if (propertes2 == "") { propertes2 = propertes2 + ulOpen; } propertes2 = propertes2 + "<li>" + propertyBinder.FillPropertyName(sourceMaterialId, sourceId, subgroupId, materialContextUow, addedProperty, condition) + "</li>"; } else { propertiesForExport.Add(addedProperty); if (propertes1 == "") { propertes1 = propertes1 + ulOpen; } propertes1 = propertes1 + "<li>" + propertyBinder.FillPropertyName(sourceMaterialId, sourceId, subgroupId, materialContextUow, addedProperty, condition) + "</li>"; } } if (propertes1 != "" && propertes2 != "") { message = title1 + propertes1 + ulClose + "<br/>" + title2 + propertes2 + ulClose; } else if (propertes1 != "") { message = title1 + propertes1 + ulClose; } else if (propertes2 != "") { message = title2 + propertes2 + ulClose; } return(message); }
public ElsevierMaterials.Models.Domain.Comparison.Property FillPropertyData(int materialId, int sourceMaterialId, int sourceId, int subgroupId, IMaterialsContextUow context, PropertyFilter propertyClient, ElsevierMaterials.Models.Condition condition) { ElsevierMaterials.Models.Domain.Comparison.Comparison comparison = GetComparison(); PropertyBasicInfo propertyInfo = _propertyBinder.FillPropertyBasicData(context, propertyClient, null); ElsevierMaterials.Models.Domain.Comparison.Property property = new ElsevierMaterials.Models.Domain.Comparison.Property(); property.PropertyInfo = propertyInfo; property.PropertyInfo.Name = _propertyBinder.FillPropertyName(sourceMaterialId, sourceId, subgroupId, context, propertyClient, condition); property.PropertyInfo.Unit = _propertyBinder.FillPropertyUnit(sourceMaterialId, sourceId, subgroupId, context, propertyClient, condition); return(property); }