Exemple #1
0
        private static void ProcessLovs(SchemaInfo schemaInfo, SchemaAttribute bridgeSchemaAttribute)
        {
            var lovs = from lov in schemaInfo.ListOfValues where lov.Active select lov;

            var listOfValues = new List <LangDependentMetaDataLov>();

            bridgeSchemaAttribute.LangDependentMetaDatas.First().ListOfValues = listOfValues;
            var metaDataLovs = from listOfValue in lovs
                               let enrichmentImage = new EnrichmentFileResourceType {
                Filename = listOfValue.EnrichmentImage
            }
            let enrichment =
                new Enrichment
            {
                EnrichmentCopy         = listOfValue.EnrichmentCopy,
                EnrichmentPrimaryImage = enrichmentImage
            }
            select
            new LangDependentMetaDataLov
            {
                Id    = listOfValue.ID,
                Value =
                    new MeasuredValueType {
                    Value = listOfValue.Value
                },
                DisplayOrder =
                    Convert.ToInt32(listOfValue.DisplayOrder),
                Enrichment = enrichment
            };

            listOfValues.AddRange(metaDataLovs);
        }
Exemple #2
0
        private void ProcessSchema(SchemaInfo si)
        {
            var metaDatas = new LangDependentMetaData
            {
                lang = EnUs,
            };
            var sa = new SchemaAttribute
            {
                Id                     = si.ID,
                TaxonomyNodeId         = si.TaxonomyID,
                AttributeId            = si.AttributeID,
                DataType               = si.SchemaData.DataType,
                DisplayOrder           = Convert.ToInt32(si.SchemaData.DisplayOrder),
                NavigationOrder        = Convert.ToInt32(si.SchemaData.NavigationOrder),
                InSchema               = si.SchemaData.InSchema,
                LangDependentMetaDatas =
                    new List <LangDependentMetaData> {
                    metaDatas
                }
            };

            var schemaMetaDatas = from smi in si.SchemaMetaInfos
                                  let displayOrder = (from mi in smi.Attribute.SchemaInfos
                                                      from md in mi.SchemaDatas
                                                      where md.Active
                                                      select md.DisplayOrder).Min()
                                                     where displayOrder > 0
                                                     from smd in smi.SchemaMetaDatas
                                                     where smd.Active
                                                     select smd;

            foreach (var smd in schemaMetaDatas)
            {
                switch (smd.SchemaMetaInfo.Attribute.AttributeName.ToLower())
                {
                case "definition":
                    metaDatas.Definition = smd.Value;
                    break;

                case "sample values":
                    metaDatas.SampleValues = smd.Value;
                    break;

                case "single or multivalue?":
                case "single or multivalue":
                    sa.Multivalue = smd.Value.ToLower().Contains("multi");
                    break;

                case "simple or complex?":
                case "simple or complex":
                    sa.Complex = smd.Value.ToLower().Contains("complex");
                    break;

                case "restricted uom":
                    sa.RestrictedUom =
                        smd.Value.Split(new[] { ';', ',', '|' }, StringSplitOptions.RemoveEmptyEntries)
                        .Select(uom => uom.Trim())
                        .ToList();
                    break;

                case "schema enrichment copy":
                    if (metaDatas.Enrichment == null)
                    {
                        metaDatas.Enrichment = new Enrichment {
                            lang = EnUs
                        }
                    }
                    ;
                    metaDatas.Enrichment.EnrichmentCopy = smd.Value;
                    break;

                case "schema enrichment image":
                    if (metaDatas.Enrichment == null)
                    {
                        metaDatas.Enrichment = new Enrichment {
                            lang = EnUs
                        }
                    }
                    ;
                    metaDatas.Enrichment.EnrichmentPrimaryImage = new EnrichmentFileResourceType
                    {
                        Filename =
                            smd.Value
                    };
                    break;

                default:
                    if (metaDatas.MetaDatums == null)
                    {
                        metaDatas.MetaDatums = new List <MetaDatumType>();
                    }
                    metaDatas.MetaDatums.Add(new MetaDatumType
                    {
                        Id    = smd.MetaID,
                        Name  = smd.SchemaMetaInfo.Attribute.AttributeName,
                        Value = smd.Value
                    });
                    break;
                }
            }

            ProcessLovs(si, sa);
            sa.SerializeObject(GetSaveFilePath("SchemaAttribute", sa.Id.ToString()));
        }