コード例 #1
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);
        }
コード例 #2
0
 public ExporterBinder()
 {
     _conditionBinder = new ConditionBinder();
     _materialBinder  = new MaterialBinder();
     _propertyBinder  = new PropertyBinder();
 }
コード例 #3
0
 public ComparisonControllerBinder()
 {
     _conditionBinder = new ConditionBinder();
     _propertyBinder  = new ComparisonPropertyBinder();
     _materialBinder  = new ComparisonMaterialBinder();
 }