private static Dictionary<string, string> ReportedAttribute_Validation(MetadataAttributeType MetadataAttribute, ReportedAttributeType ReportedAttribute)
    {
        Dictionary<string, string> RetVal;
        RetVal = new Dictionary<string, string>();

        try
        {
            if (MetadataAttribute.MetadataAttribute.Count == ReportedAttribute.ReportedAttribute.Count)
            {
                for (int i = 0; i < MetadataAttribute.MetadataAttribute.Count; i++)
                {
                    if (RetVal.Keys.Count == 0)
                    {
                        if (MetadataAttribute.MetadataAttribute[i].conceptRef != ReportedAttribute.ReportedAttribute[i].conceptID)
                        {
                            RetVal.Add(MetadataValidationStatus.Metadata_Report_Structure_Invalid.ToString(), DevInfo.Lib.DI_LibSDMX.Constants.ValidationMessages.Invalid_Metadata_Reported_Attribute + ReportedAttribute.ReportedAttribute[i].conceptID);
                        }
                        else
                        {
                            RetVal = ReportedAttribute_Validation(MetadataAttribute.MetadataAttribute[i], ReportedAttribute.ReportedAttribute[i]);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else
            {
                RetVal.Add(MetadataValidationStatus.Metadata_Report_Structure_Invalid.ToString(), DevInfo.Lib.DI_LibSDMX.Constants.ValidationMessages.Invalid_Report_Structure);
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            throw ex;
        }

        return RetVal;
    }
Beispiel #2
0
        private void Fill_MetadataAttribute(MetadataAttributeType MetadataAttribute, string CategoryGId, MSDTypes msdType)
        {
            MetadataAttribute.Annotations = null;
            MetadataAttribute.ConceptIdentity = new ConceptReferenceType();
            MetadataAttribute.ConceptIdentity.Items = new List<object>();

            switch (msdType)
            {
                case MSDTypes.MSD_Area:
                    MetadataAttribute.ConceptIdentity.Items.Add(new ConceptRefType(CategoryGId, this.AgencyId, Constants.ConceptScheme.MSD_Area.Id, Constants.ConceptScheme.MSD_Area.Version));
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).local = false;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).localSpecified = true;

                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).@class = ObjectTypeCodelistType.Concept;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).classSpecified = true;

                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).package = PackageTypeCodelistType.conceptscheme;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).packageSpecified = true;
                    break;
                case MSDTypes.MSD_Indicator:
                    MetadataAttribute.ConceptIdentity.Items.Add(new ConceptRefType(CategoryGId, this.AgencyId, Constants.ConceptScheme.MSD_Indicator.Id, Constants.ConceptScheme.MSD_Indicator.Version));
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).local = false;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).localSpecified = true;

                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).@class = ObjectTypeCodelistType.Concept;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).classSpecified = true;

                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).package = PackageTypeCodelistType.conceptscheme;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).packageSpecified = true;
                    break;
                case MSDTypes.MSD_Source:
                    MetadataAttribute.ConceptIdentity.Items.Add(new ConceptRefType(CategoryGId, this.AgencyId, Constants.ConceptScheme.MSD_Source.Id, Constants.ConceptScheme.MSD_Source.Version));
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).local = false;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).localSpecified = true;

                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).@class = ObjectTypeCodelistType.Concept;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).classSpecified = true;

                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).package = PackageTypeCodelistType.conceptscheme;
                    ((ConceptRefType)MetadataAttribute.ConceptIdentity.Items[0]).packageSpecified = true;
                    break;
            }

            MetadataAttribute.LocalRepresentation = new MetadataAttributeRepresentationType();
            MetadataAttribute.LocalRepresentation.Items = new List<object>();
            MetadataAttribute.LocalRepresentation.Items.Add(new BasicComponentTextFormatType());
            ((BasicComponentTextFormatType)MetadataAttribute.LocalRepresentation.Items[0]).textType = SDMXObjectModel.Common.DataType.String;
        }
Beispiel #3
0
        private void Fill_ReportStructure(ReportStructureType ReportStructure, DataTable DtMetadataCategory, MSDTypes msdType)
        {
            MetadataAttributeType MetadataAttribute;
            DataRow[] ParentRows;
            string CategoryNId, CategoryGId;
            bool IsPresentational;

            ReportStructure.Items = new List<ComponentType>();
            ParentRows = DtMetadataCategory.Select("ParentCategoryNId = -1", "CategoryOrder ASC");

            foreach (DataRow ParentRow in ParentRows)
            {
                CategoryNId = ParentRow["CategoryNId"].ToString();
                CategoryGId = ParentRow["CategoryGId"].ToString();
                IsPresentational = Convert.ToBoolean(ParentRow["IsPresentational"].ToString());

                MetadataAttribute = new MetadataAttributeType(CategoryGId, IsPresentational, null);
                this.Add_Children_Attributes(MetadataAttribute, CategoryNId, DtMetadataCategory, msdType);
                this.Fill_MetadataAttribute(MetadataAttribute, CategoryGId, msdType);

                ReportStructure.Items.Add(MetadataAttribute);
            }
        }
Beispiel #4
0
        private void Add_Children_Attributes(MetadataAttributeType MetadataAttribute, string CategoryNId, DataTable DtMetadataCategory, MSDTypes msdType)
        {
            MetadataAttributeType ChildMetadataAttribute;
            DataRow[] ChildRows;
            string ChildCategoryNId, ChildCategoryGId;
            bool ChildIsPresentational;

            ChildRows = DtMetadataCategory.Select("ParentCategoryNId = " + CategoryNId, "CategoryOrder ASC");

            if (ChildRows.Length > 0)
            {
                MetadataAttribute.MetadataAttribute = new List<MetadataAttributeType>();

                foreach (DataRow ChildRow in ChildRows)
                {
                    ChildCategoryNId = ChildRow["CategoryNId"].ToString();
                    ChildCategoryGId = ChildRow["CategoryGId"].ToString();
                    ChildIsPresentational = Convert.ToBoolean(ChildRow["IsPresentational"].ToString());

                    ChildMetadataAttribute = new MetadataAttributeType(ChildCategoryGId, ChildIsPresentational, null);
                    this.Add_Children_Attributes(ChildMetadataAttribute, ChildCategoryNId, DtMetadataCategory, msdType);
                    this.Fill_MetadataAttribute(ChildMetadataAttribute, ChildCategoryGId, msdType);

                    MetadataAttribute.MetadataAttribute.Add(ChildMetadataAttribute);
                }
            }
            else
            {
                MetadataAttribute.MetadataAttribute = null;
            }
        }