コード例 #1
0
 public void AddProperty(int materialId, int sourceMaterialId, int sourceId, int subgroupId, PropertyFilter propertyClient, ref ElsevierMaterials.Models.Domain.Comparison.Property propertyComparison, IMaterialsContextUow materialContextUow)
 {
     ElsevierMaterials.Models.Condition condition = _conditionBinder.FillCondition(sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient);
     propertyComparison = _propertyBinder.FillPropertyData(materialId, sourceMaterialId, sourceId, subgroupId, materialContextUow, propertyClient, condition);
     ElsevierMaterials.Models.Domain.Comparison.Comparison comparison = GetComparison();
     comparison.Properties.Add(propertyComparison);
 }
コード例 #2
0
        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);
        }