コード例 #1
0
        private Dictionary<string, string> MFD_Validation(GenericMetadataType Metadata, SDMXObjectModel.Message.StructureType CompleteStructure, string MFDId)
        {
            Dictionary<string, string> RetVal;
            int i;
            string MSDIdForMFD;
            RetVal = new Dictionary<string, string>();
            MSDIdForMFD = string.Empty;

            try
            {
                for (i = 0; i < CompleteStructure.Structures.Metadataflows.Count; i++)
                {
                    if (MFDId == CompleteStructure.Structures.Metadataflows[i].id)
                    {
                        MSDIdForMFD = ((MetadataStructureRefType)(CompleteStructure.Structures.Metadataflows[i].Structure.Items[0])).id;
                        break;
                    }
                }
                if (((MetadataStructureRefType)((MetadataStructureReferenceType)(Metadata.Header.Structure[0].Item)).Items[0]).id != MSDIdForMFD)
                {
                    RetVal.Add(MetadataValidationStatus.MFD_Selection_Invalid.ToString(), Constants.ValidationMessages.Invalid_MFD_Selected);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return RetVal;
        }
コード例 #2
0
ファイル: DFDUtility.cs プロジェクト: SDRC-India/sdrcdevinfo
        private SDMXObjectModel.Message.StructureType Get_Structure_Object(SDMXObjectModel.Structure.DataflowType Dataflow)
        {
            SDMXObjectModel.Message.StructureType RetVal;

            RetVal = new SDMXObjectModel.Message.StructureType();
            RetVal.Header = this.Get_Appropriate_Header();
            RetVal.Structures = new StructuresType(null, null, null, null, null, null, null, null, null, null, null, null, null, Dataflow, null);
            RetVal.Footer = null;

            return RetVal;
        }
コード例 #3
0
        private void Load_ListOfAttributesAtObsLevel(SDMXObjectModel.Message.StructureType Structure, out List<string> ListAttributes)
        {
            ListAttributes = new List<string>();
            int i;
            DimensionType Dimension;
            TimeDimensionType TimeDimension;
            AttributeType Attribute;
            ConceptReferenceType ConceptIdentity;
            PrimaryMeasureType PrimaryMeasure;

            SDMXObjectModel.Structure.DataStructureComponentsType DSComponents = new DataStructureComponentsType();
            DSComponents = (SDMXObjectModel.Structure.DataStructureComponentsType)(Structure.Structures.DataStructures[0].Item);

            for (i = 0; i < DSComponents.Items[1].Items.Count; i++)
            {
                Attribute = (SDMXObjectModel.Structure.AttributeType)(DSComponents.Items[1].Items[i]);
                ConceptIdentity = Attribute.ConceptIdentity;
                ListAttributes.Add(((ConceptRefType)(ConceptIdentity.Items[0])).id);
            }
        }
コード例 #4
0
        private Dictionary<string, string> Target_Validation(GenericMetadataType Metadata, SDMXObjectModel.Structure.MetadataStructureType MSD)
        {
            Dictionary<string, string> RetVal;
            SDMXObjectModel.Structure.IdentifiableObjectTargetType IdentifiableObjectTarget;
            SDMXObjectModel.Structure.IdentifiableObjectRepresentationType LocalRepresentation;
            SDMXObjectModel.Common.ItemSchemeReferenceType Enumeration;
            SDMXObjectModel.Structure.MetadataTargetType MetadataTarget;
            SDMXObjectModel.Structure.ReportStructureType ReportStructure;
            SDMXObjectModel.Common.ObjectRefType ObjectRef;

            RetVal = new Dictionary<string, string>();
            try
            {
                MetadataTarget = new MetadataTargetType();
                MetadataTarget = (MetadataTargetType)(((SDMXObjectModel.Structure.MetadataStructureComponentsType)MSD.Item).Items[0]);
                ReportStructure = new SDMXObjectModel.Structure.ReportStructureType();
                ReportStructure = (SDMXObjectModel.Structure.ReportStructureType)(((SDMXObjectModel.Structure.MetadataStructureComponentsType)MSD.Item).Items[1]);
                IdentifiableObjectTarget = ((SDMXObjectModel.Structure.IdentifiableObjectTargetType)(MetadataTarget.Items[0]));
                LocalRepresentation = ((SDMXObjectModel.Structure.IdentifiableObjectRepresentationType)(IdentifiableObjectTarget.LocalRepresentation));
                Enumeration = ((SDMXObjectModel.Common.ItemSchemeReferenceType)(LocalRepresentation.Items[0]));

                if (Metadata.MetadataSet[0].Report[0].id == ReportStructure.id)
                {
                    if (Metadata.MetadataSet[0].Report[0].Target.id == MetadataTarget.id)
                    {
                        ObjectRef = new ObjectRefType();
                        ObjectRef=((SDMXObjectModel.Common.ObjectRefType)((SDMXObjectModel.Common.ObjectReferenceType)(Metadata.MetadataSet[0].Report[0].Target.ReferenceValue[0].Item)).Items[0]);
                        if (((ObjectRef.agencyID == ((SDMXObjectModel.Common.ItemSchemeRefType)Enumeration.Items[0]).agencyID) && (ObjectRef.maintainableParentID == ((SDMXObjectModel.Common.ItemSchemeRefType)Enumeration.Items[0]).id) && (ObjectRef.maintainableParentVersion == ((SDMXObjectModel.Common.ItemSchemeRefType)Enumeration.Items[0]).version))==false)
                        {
                            RetVal.Add(MetadataValidationStatus.Metadata_Target_Object_Reference_Invalid.ToString(), Constants.ValidationMessages.Invalid_Metadata_Target_Object_Reference);
                        }
                    }
                    else
                    {
                        RetVal.Add(MetadataValidationStatus.Metadata_Target_Invalid.ToString(), Constants.ValidationMessages.Invalid_Metadata_Target + Metadata.MetadataSet[0].Report[0].Target.id);
                    }
                }
                else
                {
                    RetVal.Add(MetadataValidationStatus.Metadata_Report_Invalid.ToString(), Constants.ValidationMessages.Invalid_Metadata_Report + Metadata.MetadataSet[0].Report[0].id);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return RetVal;
        }
コード例 #5
0
        private SDMXObjectModel.Message.StructureType Get_Structure_Object(SDMXObjectModel.Structure.OrganisationSchemeType OrganisationScheme)
        {
            SDMXObjectModel.Message.StructureType RetVal;

            RetVal = new SDMXObjectModel.Message.StructureType();
            RetVal.Header = this.Get_Appropriate_Header();
            RetVal.Structures = new StructuresType(null, null, null, null, null, null, null, null, null, null, null, null, null, null, OrganisationScheme);
            RetVal.Footer = null;

            return RetVal;
        }
コード例 #6
0
    private bool UpdateArtefactsForDBWithHeader(SDMXObjectModel.Message.StructureHeaderType Header, string DbNId, string UserNId, string sdmxFolderPath, string DatabaseNIDVersion2_1)
    {
        bool RetVal;
        SDMXObjectModel.Message.StructureType DSD;
        SDMXObjectModel.Message.StructureType MSD;
        SDMXObjectModel.Message.StructureType MSDConcepts;
        SDMXObjectModel.Message.StructureType Summary;
        string AgencyId, AgencyName, Language, MFDDFolderPathInMetadataFolder;
        string AppPhysicalPath;
        string SummaryFile;
        string DSDFile;
        string DbFolder;
        string ConsumerFileName, ProviderFileName;
        string ConceptSchemeFolder;
        string MSDFolder;

        string[] conceptSchemes;
        string[] MSDS;
        RetVal = true;
        AgencyId = string.Empty;
        AgencyName = string.Empty;
        Language = string.Empty;
        MFDDFolderPathInMetadataFolder = string.Empty;
        ConsumerFileName = string.Empty;
        ProviderFileName = string.Empty;
        ConceptSchemeFolder = string.Empty;
        MSDFolder = string.Empty;

        try
        {

            AgencyId = DevInfo.Lib.DI_LibSDMX.Constants.MaintenanceAgencyScheme.Prefix + UserNId;
            AgencyName = Global.GetDbDetails(DbNId.ToString(), Language)[0];
            AppPhysicalPath = HttpContext.Current.Request.PhysicalApplicationPath;
            DbFolder = Constants.FolderName.Data + DbNId.ToString() + "\\";

            DSD = new SDMXObjectModel.Message.StructureType();
            DSDFile = sdmxFolderPath + "\\" + DevInfo.Lib.DI_LibSDMX.Constants.DSD.FileName;
            DSD = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), DSDFile);
            DSD.Header = Header;
            DSD.Structures.OrganisationSchemes = null;
            DSD.Structures.HierarchicalCodelists = null;
            DSD.Structures.Concepts = null;
            DSD.Structures.Metadataflows = null;
            DSD.Structures.MetadataStructures = null;
            DSD.Structures.Processes = null;
            DSD.Structures.ReportingTaxonomies = null;
            DSD.Structures.StructureSets = null;
            DSD.Structures.CategorySchemes = null;
            DSD.Structures.Codelists = null;
            DSD.Structures.Dataflows = null;
            DSD.Structures.Constraints = null;
            DSD.Structures.ProvisionAgreements = null;
            DSD.Footer = null;
            //Creating DSD and saving its information in the Database.mdb
            SDMXObjectModel.Serializer.SerializeToFile(typeof(SDMXObjectModel.Message.StructureType), DSD, sdmxFolderPath + "\\" + DevInfo.Lib.DI_LibSDMX.Constants.DSD.FileName);

            SummaryFile = sdmxFolderPath + "\\" + DevInfo.Lib.DI_LibSDMX.Constants.Summary_XML.FileName;
            Summary = new SDMXObjectModel.Message.StructureType();
            Summary = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), SummaryFile);

            ConceptSchemeFolder = sdmxFolderPath + "/" + "Concepts";
            MSDFolder = sdmxFolderPath + "/" + "MSD";

            Summary.Header = Header;
            Summary.Structures.OrganisationSchemes = null;
            Summary.Structures.HierarchicalCodelists = null;
            Summary.Structures.Processes = null;
            Summary.Structures.ReportingTaxonomies = null;
            Summary.Structures.StructureSets = null;
            Summary.Structures.Constraints = null;
            Summary.Structures.ProvisionAgreements = null;
            Summary.Structures.Categorisations = null;
            Summary.Footer = null;

            //Creating Summary file and saving its information in the Database.mdb
            SDMXObjectModel.Serializer.SerializeToFile(typeof(SDMXObjectModel.Message.StructureType), Summary, sdmxFolderPath + "\\" + DevInfo.Lib.DI_LibSDMX.Constants.Summary_XML.FileName);

            MSDS = Directory.GetFiles(MSDFolder);
            foreach (string msdfile in MSDS)
            {
                MSD = new SDMXObjectModel.Message.StructureType();
                MSD = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), msdfile);
                MSD.Header = Header;
                MSD.Structures.OrganisationSchemes = null;
                MSD.Structures.HierarchicalCodelists = null;
                MSD.Structures.Concepts = null;
                MSD.Structures.Metadataflows = null;
                MSD.Structures.DataStructures = null;
                MSD.Structures.Processes = null;
                MSD.Structures.ReportingTaxonomies = null;
                MSD.Structures.StructureSets = null;
                MSD.Structures.CategorySchemes = null;
                MSD.Structures.Codelists = null;
                MSD.Structures.Dataflows = null;
                MSD.Structures.Codelists = null;
                MSD.Structures.Categorisations = null;
                MSD.Structures.ProvisionAgreements = null;
                MSD.Footer = null;
                //Creating MSD and saving its information in the Database.mdb

                SDMXObjectModel.Serializer.SerializeToFile(typeof(SDMXObjectModel.Message.StructureType), MSD, msdfile);//sdmxFolderPath + "\\MSD\\" +
            }

            conceptSchemes = Directory.GetFiles(ConceptSchemeFolder);
            foreach (string conceptSchemeFile in conceptSchemes)
            {
                MSDConcepts = new SDMXObjectModel.Message.StructureType();
                MSDConcepts = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), conceptSchemeFile);
                MSDConcepts.Header = Header;
                MSDConcepts.Structures.MetadataStructures = null;
                MSDConcepts.Structures.OrganisationSchemes = null;
                MSDConcepts.Structures.HierarchicalCodelists = null;
                MSDConcepts.Structures.Metadataflows = null;
                MSDConcepts.Structures.DataStructures = null;
                MSDConcepts.Structures.Processes = null;
                MSDConcepts.Structures.ReportingTaxonomies = null;
                MSDConcepts.Structures.StructureSets = null;
                MSDConcepts.Structures.CategorySchemes = null;
                MSDConcepts.Structures.Codelists = null;
                MSDConcepts.Structures.Dataflows = null;
                MSDConcepts.Structures.Categorisations = null;
                MSDConcepts.Structures.ProvisionAgreements = null;
                MSDConcepts.Structures.Constraints = null;
                MSDConcepts.Footer = null;

                //Creating MSDConcepts and saving its information in the Database.mdb
                SDMXObjectModel.Serializer.SerializeToFile(typeof(SDMXObjectModel.Message.StructureType), MSDConcepts, conceptSchemeFile);//sdmxFolderPath + "\\Concepts\\" +

            }
        }
        catch (Exception ex)
        {
            //Global.WriteErrorsInLog("Creating Artefacts For Uploaded DSD From Admin");
            //Global.WriteErrorsInLog(ex.StackTrace);
            //Global.WriteErrorsInLog(ex.Message);
            RetVal = false;
            Global.CreateExceptionString(ex, null);
        }
        finally
        {

        }

        return RetVal;
    }
コード例 #7
0
    private DIExcel GenerateDimensionAndAttributesComparison(string hlngcodedb,SDMXObjectModel.Message.StructureType DSD1, SDMXObjectModel.Message.StructureType DSD2, DIExcel ReportExcel, Dictionary<string, string> dictMappedIndicators, List<String> ListOfMissingDimensions, List<String> AdditionalDSD1DimensionList, Dictionary<string, string> dictMappedAttributes, List<String> ListOfMissingAttributes, List<String> AdditionalDSD1AttributeList)
    {
        int rowindex = 0;
        string DimensionName = string.Empty;
        string AttributeName = string.Empty;
        int SNo;
        SDMXObjectModel.Structure.DataStructureComponentsType DSD1DSComponents;
        SDMXObjectModel.Structure.DataStructureComponentsType DSD2DSComponents;
        SDMXObjectModel.Structure.StructuresType ConceptsObjDSD1;
        SDMXObjectModel.Structure.StructuresType ConceptsObjDSD2;
        IWorksheet WorkbookSheet = null;

        try
        {
            DSD1DSComponents = (SDMXObjectModel.Structure.DataStructureComponentsType)(DSD1.Structures.DataStructures[0].Item);
            DSD2DSComponents = (SDMXObjectModel.Structure.DataStructureComponentsType)(DSD2.Structures.DataStructures[0].Item);

            ConceptsObjDSD1 = DSD1.Structures;
            ConceptsObjDSD2 = DSD2.Structures;

            ReportExcel.RenameWorkSheet(0, "Dimensions");
            // Writing into Dimensions Worksheet

            // Writing Matched Dimensions that exist in both DSD1 and DSD2
            rowindex = rowindex + 1;
            WorkbookSheet = ReportExcel.GetWorksheet(0);
            this.WriteValueInCell(ReportExcel, "Matched Dimensions", rowindex, 1, 14, true, 10, 0, 0);
            WorkbookSheet.Cells[rowindex, 1, rowindex, 2].Merge();
            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0, 0);
            this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0, 0);
            this.WriteValueInCell(ReportExcel, "Name", rowindex,3, 12, true, 70, 0, 0);
            rowindex = rowindex + 1;
            SNo = 0;
            foreach (string MatchedDimension in dictMappedIndicators.Keys)
            {
                if(!(AdditionalDSD1DimensionList.Contains(MatchedDimension)))
                {
                    SNo = SNo + 1;
                    this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false, 10, 0, 0);
                    DimensionName = string.Empty;
                    DimensionName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD1, MatchedDimension, hlngcodedb);
                    this.WriteValueInCell(ReportExcel, MatchedDimension, rowindex, 2, 10, false, 60, 0, 0);
                    if (DimensionName != string.Empty)
                    {
                        this.WriteValueInCell(ReportExcel,DimensionName, rowindex, 3, 10, false, 70, 0, 0);
                    }

                    rowindex = rowindex + 1;
                }

            }

            // Writing Missing Dimensions that exist in DSD2 but not in DSD1

            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "Missing Dimensions", rowindex, 1, 14, true, 10, 0, 0);
            WorkbookSheet.Cells[rowindex, 1, rowindex, 2].Merge();
            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0, 0);
            this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0, 0);
            this.WriteValueInCell(ReportExcel, "Name", rowindex, 3, 12, true, 70, 0, 0);
            rowindex = rowindex + 1;

            SNo = 0;
            foreach (string MissingDimension in ListOfMissingDimensions)
            {
                SNo = SNo + 1;
                this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false, 10, 0, 0);
                DimensionName = string.Empty;
                DimensionName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD2, MissingDimension, hlngcodedb);
                this.WriteValueInCell(ReportExcel, MissingDimension, rowindex, 2, 10, false, 60, 0, 0);
                if (DimensionName != string.Empty)
                {
                    this.WriteValueInCell(ReportExcel, DimensionName, rowindex, 3, 10, false, 70, 0, 0);
                }
                rowindex = rowindex + 1;

            }

            // Writing Additional Dimensions that exist in DSD1 but not in DSD2

            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "Additional Dimensions", rowindex, 1, 14, true, 10, 0, 0);
            WorkbookSheet.Cells[rowindex, 1, rowindex, 2].Merge();
            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0, 0);
            this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0, 0);
            this.WriteValueInCell(ReportExcel, "Name", rowindex, 3, 12, true, 70, 0, 0);
            rowindex = rowindex + 1;

            SNo = 0;
            foreach (string AdditionalDimension in AdditionalDSD1DimensionList)
            {
                SNo = SNo + 1;
                this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false, 10, 0, 0);
                DimensionName = string.Empty;
                DimensionName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD1, AdditionalDimension, hlngcodedb);
                this.WriteValueInCell(ReportExcel, AdditionalDimension, rowindex, 2, 10, false, 60, 0, 0);
                if (DimensionName != string.Empty)
                {
                    this.WriteValueInCell(ReportExcel, DimensionName, rowindex, 3, 10, false, 70, 0, 0);
                }

                rowindex = rowindex + 1;

            }

            // Writing into Attributes Worksheet

            ReportExcel.InsertWorkSheet("Attributes");
            WorkbookSheet = ReportExcel.GetWorksheet(1);
            // Writing Matched Attributes that exist in both DSD1 and DSD2

            rowindex = 1;
            this.WriteValueInCell(ReportExcel, "Matched Attributes", rowindex, 1, 14, true, 10, 0, 1);
            WorkbookSheet.Cells[rowindex, 1, rowindex, 2].Merge();
            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0,1);
            this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0, 1);
            this.WriteValueInCell(ReportExcel, "Name", rowindex, 3, 12, true, 70, 0, 1);
            rowindex = rowindex + 1;

            SNo = 0;
            foreach (string MatchedAttribute in dictMappedAttributes.Keys)
            {
                if (!(AdditionalDSD1AttributeList.Contains(MatchedAttribute)))
                {
                    SNo = SNo + 1;
                    this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false,10, 0, 1);
                    AttributeName = string.Empty;
                    AttributeName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD1, MatchedAttribute, hlngcodedb);
                    this.WriteValueInCell(ReportExcel, MatchedAttribute, rowindex, 2, 10, false, 60, 0, 1);
                    if (AttributeName != string.Empty)
                    {
                        this.WriteValueInCell(ReportExcel, AttributeName, rowindex, 3, 10, false, 70, 0, 1);
                    }
                    rowindex = rowindex + 1;
                }
            }

            // Writing Missing Attributes that exist in DSD2 but not in DSD1
            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "Missing Attributes", rowindex, 1, 14, true, 10, 0, 1);
            WorkbookSheet.Cells[rowindex, 1, rowindex, 2].Merge();
            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0, 1);
            this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0,1);
            this.WriteValueInCell(ReportExcel, "Name", rowindex, 3, 12, true, 70, 0, 1);
            rowindex = rowindex + 1;

            SNo = 0;
            foreach (string MissingAttribute in ListOfMissingAttributes)
            {
                SNo = SNo + 1;
                this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false, 10, 0, 1);
                AttributeName = string.Empty;
                AttributeName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD2, MissingAttribute, hlngcodedb);
                this.WriteValueInCell(ReportExcel, MissingAttribute, rowindex, 2, 10, false, 60, 0, 1);
                if (AttributeName != string.Empty)
                {
                    this.WriteValueInCell(ReportExcel, AttributeName, rowindex, 3, 10, false, 70, 0, 1);
                }
                rowindex = rowindex + 1;
            }

            // Writing Additional Attributes that exist in DSD1 but not in DSD2

            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "Additional Attributes", rowindex, 1, 14, true, 10, 0, 1);
            WorkbookSheet.Cells[rowindex, 1, rowindex, 2].Merge();
            rowindex = rowindex + 2;
            this.WriteValueInCell(ReportExcel, "S.No.", rowindex, 1, 12, true, 10, 0, 1);
            this.WriteValueInCell(ReportExcel, "ID", rowindex, 2, 12, true, 60, 0, 1);
            this.WriteValueInCell(ReportExcel, "Name", rowindex, 3, 12, true, 70, 0, 1);
            rowindex = rowindex + 1;

            SNo = 0;
            foreach (string AdditionalAttribute in AdditionalDSD1AttributeList)
            {
                SNo = SNo + 1;
                this.WriteValueInCell(ReportExcel, SNo.ToString(), rowindex, 1, 10, false, 10, 0, 1);
                AttributeName = string.Empty;
                AttributeName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD1, AdditionalAttribute, hlngcodedb);
                this.WriteValueInCell(ReportExcel, AdditionalAttribute, rowindex, 2, 10, false, 60, 0, 1);
                if (AttributeName != string.Empty)
                {
                    this.WriteValueInCell(ReportExcel, AttributeName, rowindex, 3, 10, false, 70, 0, 1);
                }
                rowindex = rowindex + 1;
            }

        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            throw ex;

        }
        finally
        {

        }

        return ReportExcel;
    }
コード例 #8
0
        private ArtefactInfo Prepare_ArtefactInfo_From_NotifyRegistryEvent(SDMXObjectModel.Registry.NotifyRegistryEventType NotifyRegistryEvent)
        {
            ArtefactInfo RetVal;
            SDMXObjectModel.Message.RegistryInterfaceType RegistryInterface;
            XmlDocument XmlContent;

            RetVal = null;
            XmlContent = null;

            try
            {
                RegistryInterface = this.Get_RegistryInterface_Object(NotifyRegistryEvent);
                XmlContent = Serializer.SerializeToXmlDocument(typeof(SDMXObjectModel.Message.RegistryInterfaceType), RegistryInterface);
                RetVal = new ArtefactInfo(string.Empty, string.Empty, string.Empty, string.Empty, ArtefactTypes.None, string.Empty, XmlContent);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
コード例 #9
0
    private void Remove_Extra_Annotations(SDMXObjectModel.Message.StructureType Structure)
    {
        if (Structure.Structures.Codelists != null)
        {
            foreach (CodelistType Codelist in Structure.Structures.Codelists)
            {
                Codelist.Annotations = null;
            }
        }

        if (Structure.Structures.CategorySchemes != null)
        {
            foreach (CategorySchemeType CategoryScheme in Structure.Structures.CategorySchemes)
            {
                CategoryScheme.Annotations = null;

                foreach (CategoryType Category in CategoryScheme.Items)
                {
                    Category.Annotations = null;
                    this.Remove_Extra_Annotations_From_Child_Categories(Category);
                }
            }
        }

        if (Structure.Structures.Categorisations != null)
        {
            foreach (CategorisationType Categorisation in Structure.Structures.Categorisations)
            {
                Categorisation.Annotations = null;

                ((ObjectRefType)Categorisation.Source.Items[0]).version = null;
            }
        }

        // Removing annotation at ConceptScheme level
        if (Structure.Structures.Concepts != null)
        {
            foreach (ConceptSchemeType ConceptScheme in Structure.Structures.Concepts)
            {
                ConceptScheme.Annotations = null;

                foreach (ConceptType Concept in ConceptScheme.Items)
                {
                    Concept.Annotations = null;
                }
            }
        }

        // Removing annotation at DataStructure level
        if (Structure.Structures.DataStructures != null)
        {
            if (Structure.Structures.DataStructures.Count > 0)
            {
                Structure.Structures.DataStructures[0].Annotations = null;

                // Removing annotation at Dimensionlist level
                ((DataStructureComponentsType)Structure.Structures.DataStructures[0].Item).DimensionList = null;
                Structure.Structures.DataStructures[0].Item.Items[0].Annotations = null;
                foreach (BaseDimensionType BaseDimension in Structure.Structures.DataStructures[0].Item.Items[0].Items)
                {
                    BaseDimension.Annotations = null;
                }

                // Removing annotation at Attributelist level
                ((DataStructureComponentsType)Structure.Structures.DataStructures[0].Item).AttributeList = null;
                Structure.Structures.DataStructures[0].Item.Items[1].Annotations = null;
                foreach (AttributeType Attribute in Structure.Structures.DataStructures[0].Item.Items[1].Items)
                {
                    Attribute.Annotations = null;
                }

                // Removing annotation at Measurelist level
                ((DataStructureComponentsType)Structure.Structures.DataStructures[0].Item).MeasureList = null;
                Structure.Structures.DataStructures[0].Item.Items[2].Annotations = null;
                foreach (PrimaryMeasureType PrimaryMeasure in Structure.Structures.DataStructures[0].Item.Items[2].Items)
                {
                    PrimaryMeasure.Annotations = null;
                }
            }
        }

        // Removing annotation at MetadataStructure level
        if (Structure.Structures.MetadataStructures != null)
        {
            foreach (SDMXObjectModel.Structure.MetadataStructureType MetadataStructure in Structure.Structures.MetadataStructures)
            {
                MetadataStructure.Annotations = null;

                // Removing annotation at MetadataTarget level
                MetadataStructure.Item.Items[0].Annotations = null;

                // Removing annotation at IdentifiableObjectTarget level
                MetadataStructure.Item.Items[0].Items[0].Annotations = null;

                // Removing annotation at ReportStructure level
                MetadataStructure.Item.Items[1].Annotations = null;

                // Removing annotation at MetadataAttribute level
                foreach (MetadataAttributeType MetadataAttribute in MetadataStructure.Item.Items[1].Items)
                {
                    MetadataAttribute.Annotations = null;
                }
            }
        }

        // Removing annotation at DataFlow level
        if (Structure.Structures.Dataflows != null)
        {
            foreach (DataflowType DataFlow in Structure.Structures.Dataflows)
            {
                DataFlow.Annotations = null;
            }
        }

        // Removing annotation at MetadataFlow level
        if (Structure.Structures.Metadataflows != null)
        {
            foreach (MetadataflowType MetadataFlow in Structure.Structures.Metadataflows)
            {
                MetadataFlow.Annotations = null;
            }
        }
    }
コード例 #10
0
        private SDMXObjectModel.Message.RegistryInterfaceType Get_RegistryInterface_Object(SDMXObjectModel.Registry.SubscriptionRequestType SubscriptionRequestType)
        {
            SDMXObjectModel.Message.RegistryInterfaceType RetVal;

            RetVal = new SDMXObjectModel.Message.RegistryInterfaceType();
            RetVal.Header = this.Get_Appropriate_Header();

            RetVal.Item = new SDMXObjectModel.Registry.SubmitSubscriptionsRequestType();
            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)RetVal.Item).SubscriptionRequest = new List<SDMXObjectModel.Registry.SubscriptionRequestType>();
            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)RetVal.Item).SubscriptionRequest.Add(SubscriptionRequestType);

            RetVal.Footer = null;

            return RetVal;
        }
コード例 #11
0
ファイル: Global.cs プロジェクト: SDRC-India/sdrcdevinfo
    private static void Send_Notifications_For_Current_Subscription(SubscriptionType Subscription, SDMXObjectModel.Registry.RegistrationType Registration, string HeaderFilePath = null)
    {
        string MessageContent;
        List<ArtefactInfo> Artefacts;
        DateTime CurrentDate;
        DateTime ValidityPeriodStartDate;
        DateTime ValidityPeriodEndDate;

        Header Header = new Header();
        XmlDocument UploadedHeaderXml = new XmlDocument();
        SDMXApi_2_0.Message.StructureType UploadedDSDStructure = new SDMXApi_2_0.Message.StructureType();
        SDMXApi_2_0.Message.HeaderType Header_2_0 = new SDMXApi_2_0.Message.HeaderType();

        if (File.Exists(HeaderFilePath))
        {
            UploadedHeaderXml.Load(HeaderFilePath);
            UploadedDSDStructure = (SDMXApi_2_0.Message.StructureType)SDMXApi_2_0.Deserializer.LoadFromXmlDocument(typeof(SDMXApi_2_0.Message.StructureType), UploadedHeaderXml);
            Header_2_0 = UploadedDSDStructure.Header;
        }
        try
        {
            if (string.IsNullOrEmpty(HeaderFilePath) == false)
            {
                Header.ID = Header_2_0.ID;
                Header.Name = Header_2_0.Name[0].Value.ToString();
                foreach (SDMXApi_2_0.Message.PartyType Senders in Header_2_0.Sender)
                {
                    Header.Sender.ID = Senders.id;
                    Header.Sender.Name = !string.IsNullOrEmpty(Senders.Name[0].Value.ToString()) ? Senders.Name[0].Value.ToString() : string.Empty;
                    foreach (SDMXApi_2_0.Message.ContactType Contacts in Senders.Contact)
                    {
                        Header.Sender.Contact.Department = !string.IsNullOrEmpty(Contacts.Department[0].Value.ToString()) ? Contacts.Department[0].Value.ToString() : string.Empty;
                        Header.Sender.Contact.Email = !string.IsNullOrEmpty(Contacts.Items[1].ToString()) ? Contacts.Items[1].ToString() : string.Empty;
                        Header.Sender.Contact.Fax = !string.IsNullOrEmpty(Contacts.Items[2].ToString()) ? Contacts.Items[2].ToString() : string.Empty;
                        Header.Sender.Contact.Name = !string.IsNullOrEmpty(Contacts.Name[0].Value.ToString()) ? Contacts.Name[0].Value.ToString() : string.Empty;
                        Header.Sender.Contact.Role = !string.IsNullOrEmpty(Contacts.Role[0].Value.ToString()) ? Contacts.Role[0].Value.ToString() : string.Empty;
                        Header.Sender.Contact.Telephone = !string.IsNullOrEmpty(Contacts.Items[0].ToString()) ? Contacts.Items[0].ToString() : string.Empty;

                    }

                }

                foreach (SDMXApi_2_0.Message.PartyType Receiver in Header_2_0.Receiver)
                {
                    Header.Receiver.ID = Receiver.id;
                    if (string.IsNullOrEmpty(Convert.ToString(Receiver.Name[0].Value)) == false)
                    {
                        Header.Receiver.Name = !string.IsNullOrEmpty(Receiver.Name[0].Value.ToString()) ? Receiver.Name[0].Value.ToString() : string.Empty;
                        foreach (SDMXApi_2_0.Message.ContactType Contacts in Receiver.Contact)
                        {
                            Header.Receiver.Contact.Department = !string.IsNullOrEmpty(Convert.ToString(Contacts.Department[0].Value)) ? Convert.ToString(Contacts.Department[0].Value) : string.Empty;
                            if (Contacts.Items.Length > 2)
                            {
                                Header.Receiver.Contact.Email = !string.IsNullOrEmpty(Convert.ToString(Contacts.Items[1])) ? Convert.ToString(Contacts.Items[1]) : string.Empty;
                                Header.Receiver.Contact.Fax = !string.IsNullOrEmpty(Convert.ToString(Contacts.Items[2])) ? Convert.ToString(Contacts.Items[2]) : string.Empty;
                            }
                            else
                            {
                                Header.Receiver.Contact.Email = !string.IsNullOrEmpty(Convert.ToString(Contacts.Items[1])) ? Convert.ToString(Contacts.Items[1]) : string.Empty;
                            }
                            //Header.Receiver.Contact.Email = !string.IsNullOrEmpty(Convert.ToString(Contacts.Items[1])) ? Convert.ToString(Contacts.Items[1]) : string.Empty;
                            //Header.Receiver.Contact.Fax = !string.IsNullOrEmpty(Convert.ToString(Contacts.Items[2])) ? Convert.ToString(Contacts.Items[2]) : string.Empty;
                            Header.Receiver.Contact.Name = !string.IsNullOrEmpty(Convert.ToString(Contacts.Name[0].Value)) ? Convert.ToString(Contacts.Name[0].Value) : string.Empty;
                            Header.Receiver.Contact.Role = !string.IsNullOrEmpty(Convert.ToString(Contacts.Role[0].Value)) ? Convert.ToString(Contacts.Role[0].Value) : string.Empty;
                            Header.Receiver.Contact.Telephone = !string.IsNullOrEmpty(Convert.ToString(Contacts.Items[0])) ? Convert.ToString(Contacts.Items[0]) : string.Empty;
                            //Header.Receiver.Contact.Department = !string.IsNullOrEmpty(Contacts.Department[0].Value.ToString()) ? Contacts.Department[0].Value.ToString() : string.Empty;
                            //Header.Receiver.Contact.Email = !string.IsNullOrEmpty(Contacts.Items[2].ToString()) ? Contacts.Items[2].ToString() : string.Empty;
                            //Header.Receiver.Contact.Fax = !string.IsNullOrEmpty(Contacts.Items[1].ToString()) ? Contacts.Items[1].ToString() : string.Empty;
                            //Header.Receiver.Contact.Name = !string.IsNullOrEmpty(Contacts.Name[0].Value.ToString()) ? Contacts.Name[0].Value.ToString() : string.Empty;
                            //Header.Receiver.Contact.Role = !string.IsNullOrEmpty(Contacts.Role[0].Value.ToString()) ? Contacts.Role[0].Value.ToString() : string.Empty;
                            //Header.Receiver.Contact.Telephone = !string.IsNullOrEmpty(Contacts.Items[0].ToString()) ? Contacts.Items[0].ToString() : string.Empty;
                        }
                    }

                }

            }
            CurrentDate = DateTime.Now;
            ValidityPeriodStartDate = Subscription.ValidityPeriod.StartDate;
            ValidityPeriodEndDate = Subscription.ValidityPeriod.EndDate;
            if ((CurrentDate >= ValidityPeriodStartDate) && (CurrentDate <= ValidityPeriodEndDate))
            {
                if (string.IsNullOrEmpty(HeaderFilePath) == false)
                {
                    Artefacts = SDMXUtility.Get_Notification(SDMXSchemaType.Two_One, DateTime.Now, Registration.id, Subscription.RegistryURN, ActionType.Append, Registration, Header);
                }
                else
                {
                    Artefacts = SDMXUtility.Get_Notification(SDMXSchemaType.Two_One, DateTime.Now, Registration.id, Subscription.RegistryURN, ActionType.Append, Registration, null);
                }
                foreach (NotificationURLType NotificationMailId in Subscription.NotificationMailTo)
                {
                    if (NotificationMailId.isSOAP == true)
                    {
                        MessageContent = GetSoapWrappedXml(Artefacts[0].Content.OuterXml);
                    }
                    else
                    {
                        MessageContent = Artefacts[0].Content.OuterXml;
                    }

                    Send_Notification_By_Email(MessageContent, NotificationMailId.Value);
                }

                foreach (NotificationURLType NotificationHTTP in Subscription.NotificationHTTP)
                {
                    if (NotificationHTTP.isSOAP == true)
                    {
                        MessageContent = GetSoapWrappedXml(Artefacts[0].Content.OuterXml);
                    }
                    else
                    {
                        MessageContent = Artefacts[0].Content.OuterXml;
                    }

                    Send_Notification_By_HTTP_Post(MessageContent, NotificationHTTP.Value);
                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);

            throw ex;
        }
        finally
        {
        }
    }
コード例 #12
0
        internal bool Generate_MetadataReport(MetadataTypes metadataType, string filterNIds, string outputFolder, out List<string> GeneratedMetadataFiles, SDMXObjectModel.Message.StructureHeaderType Header)
        {
            bool RetVal;
            string Query, ColumnName, TargetObjectId, FileName;
            GenericMetadataType Metadata;
            DataTable DtTable;

            RetVal = false;
            Query = string.Empty;
            ColumnName = string.Empty;
            TargetObjectId = string.Empty;
            FileName = string.Empty;
            Metadata = null;
            DtTable = null;
            GeneratedMetadataFiles = new List<string>();
            DateTime CurrentTime = DateTime.Now;
            try
            {
                switch (metadataType)
                {
                    case MetadataTypes.Area:
                        Query = "SELECT Area_ID FROM UT_Area_" + this._language;

                        if (!string.IsNullOrEmpty(filterNIds))
                        {
                            Query += " WHERE Area_NId IN (" + filterNIds + ");";
                        }

                        ColumnName = "Area_ID";
                        break;
                    case MetadataTypes.Indicator:
                        Query = "SELECT Indicator_GId FROM UT_Indicator_" + this._language;

                        if (!string.IsNullOrEmpty(filterNIds))
                        {
                            Query += " WHERE Indicator_NId IN (" + filterNIds + ");";
                        }

                        ColumnName = "Indicator_GId";
                        break;
                    case MetadataTypes.Source:
                        Query = "SELECT IC_GId FROM UT_Indicator_Classifications_" + this._language + " WHERE IC_Type = 'SR'";

                        if (!string.IsNullOrEmpty(filterNIds))
                        {
                            Query += " AND IC_NId IN (" + filterNIds + ");";
                        }

                        ColumnName = "IC_GId";
                        break;
                    default:
                        break;
                }

                DtTable = this._diConnection.ExecuteDataTable(Regex.Replace(Query, "UT_", this._diConnection.DIDataSetDefault(), RegexOptions.IgnoreCase));

                foreach (DataRow DrTable in DtTable.Rows)
                {
                    TargetObjectId = DrTable[ColumnName].ToString();
                    Metadata = this.Retrieve_Metadata_From_Database(metadataType, TargetObjectId, Header);

                    if (Metadata != null)
                    {
                        FileName = Path.Combine(outputFolder, TargetObjectId + "_" + CurrentTime.ToString("yyyy-MM-dd HHmmss") + Constants.XmlExtension);
                        Serializer.SerializeToFile(typeof(SDMXObjectModel.Message.GenericMetadataType), Metadata, FileName);
                        GeneratedMetadataFiles.Add(FileName);
                    }
                }

                RetVal = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
コード例 #13
0
        private GenericMetadataType Retrieve_Metadata_From_Database(MetadataTypes metadataType, string TargetObjectId,SDMXObjectModel.Message.StructureHeaderType Header)
        {
            GenericMetadataType RetVal;
            string StructureRef, ReportStructureId, MetadataTargetId, IdentifiableObjectTargetId, MaintenableParentId, MaintenableParentVersion;
            ObjectTypeCodelistType TargetObjectType;
            PackageTypeCodelistType TargetPackageType;

            RetVal = null;
            StructureRef = string.Empty;
            ReportStructureId = string.Empty;
            MetadataTargetId = string.Empty;
            IdentifiableObjectTargetId = string.Empty;
            MaintenableParentId = string.Empty;
            MaintenableParentVersion = string.Empty;
            TargetObjectType = ObjectTypeCodelistType.Code;
            TargetPackageType = PackageTypeCodelistType.codelist;

            try
            {
                switch (metadataType)
                {
                    case MetadataTypes.Area:
                        StructureRef = Constants.MSD.Area.Id;
                        ReportStructureId = Constants.MSD.Area.ReportStructureId;
                        MetadataTargetId = Constants.MSD.Area.MetadataTargetId;
                        IdentifiableObjectTargetId = Constants.MSD.Area.IdentifiableObjectTargetId;
                        MaintenableParentId = Constants.CodeList.Area.Id;
                        MaintenableParentVersion = Constants.CodeList.Area.Version;
                        TargetObjectType = ObjectTypeCodelistType.Code;
                        TargetPackageType = PackageTypeCodelistType.codelist;
                        break;
                    case MetadataTypes.Indicator:
                        StructureRef = Constants.MSD.Indicator.Id;
                        ReportStructureId = Constants.MSD.Indicator.ReportStructureId;
                        MetadataTargetId = Constants.MSD.Indicator.MetadataTargetId;
                        IdentifiableObjectTargetId = Constants.MSD.Indicator.IdentifiableObjectTargetId;
                        MaintenableParentId = Constants.CodeList.Indicator.Id;
                        MaintenableParentVersion = Constants.CodeList.Indicator.Version;
                        TargetObjectType = ObjectTypeCodelistType.Code;
                        TargetPackageType = PackageTypeCodelistType.codelist;
                        break;
                    case MetadataTypes.Source:
                        StructureRef = Constants.MSD.Source.Id;
                        ReportStructureId = Constants.MSD.Source.ReportStructureId;
                        MetadataTargetId = Constants.MSD.Source.MetadataTargetId;
                        IdentifiableObjectTargetId = Constants.MSD.Source.IdentifiableObjectTargetId;
                        MaintenableParentId = Constants.CategoryScheme.Source.Id;
                        MaintenableParentVersion = Constants.CategoryScheme.Source.Version;
                        TargetObjectType = ObjectTypeCodelistType.Category;
                        TargetPackageType = PackageTypeCodelistType.categoryscheme;
                        break;
                    case MetadataTypes.Layer:
                        StructureRef = Constants.MSD.Area.Id;
                        ReportStructureId = Constants.MSD.Area.ReportStructureId;
                        MetadataTargetId = Constants.MSD.Area.MetadataTargetId;
                        IdentifiableObjectTargetId = Constants.MSD.Area.IdentifiableObjectTargetId;
                        MaintenableParentId = Constants.CodeList.Area.Id;
                        MaintenableParentVersion = Constants.CodeList.Area.Version;
                        TargetObjectType = ObjectTypeCodelistType.Code;
                        TargetPackageType = PackageTypeCodelistType.codelist;
                        break;
                    default:
                        break;
                }

                RetVal = new GenericMetadataType();
                if (Header != null)
                {
                    RetVal.Header.ID = Header.ID;
                    RetVal.Header.Name = Header.Name;
                    RetVal.Header.Receiver = Header.Receiver;
                    RetVal.Header.Sender = Header.Sender;
                    RetVal.Header.Test = Header.Test;
                    RetVal.Header.Source = Header.Source;
                    RetVal.Header.Prepared = Header.Prepared;

                }
                else
                {
                    RetVal.Header = this.Get_Appropriate_Header(metadataType);
                }
                RetVal.Footer = null;

                RetVal.MetadataSet = new List<SDMXObjectModel.Metadata.Generic.MetadataSetType>();
                RetVal.MetadataSet.Add(new SDMXObjectModel.Metadata.Generic.MetadataSetType());
                RetVal.MetadataSet[0].structureRef = StructureRef;
                RetVal.MetadataSet[0].Annotations = null;
                RetVal.MetadataSet[0].DataProvider = null;

                RetVal.MetadataSet[0].Report = new List<SDMXObjectModel.Metadata.Generic.ReportType>();
                RetVal.MetadataSet[0].Report.Add(new SDMXObjectModel.Metadata.Generic.ReportType());
                RetVal.MetadataSet[0].Report[0].id = ReportStructureId;
                RetVal.MetadataSet[0].Report[0].Annotations = null;

                RetVal.MetadataSet[0].Report[0].Target = new SDMXObjectModel.Metadata.Generic.TargetType();
                RetVal.MetadataSet[0].Report[0].Target.id = MetadataTargetId;

                RetVal.MetadataSet[0].Report[0].Target.ReferenceValue = new List<SDMXObjectModel.Metadata.Generic.ReferenceValueType>();
                RetVal.MetadataSet[0].Report[0].Target.ReferenceValue.Add(new SDMXObjectModel.Metadata.Generic.ReferenceValueType());
                RetVal.MetadataSet[0].Report[0].Target.ReferenceValue[0].id = IdentifiableObjectTargetId;

                RetVal.MetadataSet[0].Report[0].Target.ReferenceValue[0].Item = new ObjectReferenceType();
                ((ObjectReferenceType)RetVal.MetadataSet[0].Report[0].Target.ReferenceValue[0].Item).Items = new List<object>();
                ((ObjectReferenceType)RetVal.MetadataSet[0].Report[0].Target.ReferenceValue[0].Item).Items.Add(new ObjectRefType(TargetObjectId, this._agencyId, null, MaintenableParentId, MaintenableParentVersion, TargetObjectType, true, TargetPackageType, true));

                RetVal.MetadataSet[0].Report[0].AttributeSet = this.Get_AttributeSet(metadataType);

                if (RetVal.MetadataSet[0].Report[0].AttributeSet != null && RetVal.MetadataSet[0].Report[0].AttributeSet.ReportedAttribute != null && RetVal.MetadataSet[0].Report[0].AttributeSet.ReportedAttribute.Count > 0)
                {
                    this.Fill_AttributeSet_Values(RetVal.MetadataSet[0].Report[0].AttributeSet, TargetObjectId, metadataType);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
コード例 #14
0
 internal virtual bool Generate_Data(XmlDocument query, string outputFolder, out int fileCount, out List<string> GeneratedFiles, SDMXObjectModel.Message.StructureHeaderType Header)
 {
     fileCount = 0;
     GeneratedFiles = new List<string>();
     return true;
 }
コード例 #15
0
ファイル: RegMapping.cs プロジェクト: SDRC-India/sdrcdevinfo
    private string Get_Language_Based_Name_From_Codelist(SDMXObjectModel.Structure.CodelistType Codelist, string GId, string Language)
    {
        string RetVal;

        RetVal = string.Empty;

        try
        {
            foreach (SDMXObjectModel.Structure.ItemType Code in Codelist.Items)
            {
                if (Code.id == GId)
                {
                    RetVal = GetLangSpecificValue_For_Version_2_1(Code.Name, Language);
                    break;
                }
            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);

            throw ex;
        }
        finally
        {
        }

        return RetVal;
    }
コード例 #16
0
    private string GetLanguageBasedConceptNameFromConceptScheme(SDMXObjectModel.Structure.StructuresType ConceptsObj, string UnMatchedConceptId, string hlngcodedb)
    {
        string RetVal;
        int j, k;
        RetVal = string.Empty;

        try
        {

            if (ConceptsObj.Concepts.Count > 0)
            {
                for (j = 0; j < ConceptsObj.Concepts.Count; j++)
                {

                    for (k = 0; k < ConceptsObj.Concepts[j].Items.Count; k++)
                    {
                        if (UnMatchedConceptId == ConceptsObj.Concepts[j].Items[k].id.ToString())
                        {

                            RetVal = GetLangSpecificValue(ConceptsObj.Concepts[j].Items[k].Name, hlngcodedb);

                            break;
                        }
                    }

                }
            }

        }
        catch (Exception ex)
        {
            RetVal = string.Empty;
            Global.CreateExceptionString(ex, null);
            throw ex;

        }
        finally
        {

        }

        return RetVal;
    }
コード例 #17
0
        private Dictionary<string, string> Referred_MSD_Validation(GenericMetadataType Metadata, SDMXObjectModel.Message.StructureType CompleteStructure)
        {
            Dictionary<string, string> RetVal;
            List<string> ListOfMSDIds;
            RetVal = new Dictionary<string, string>();
            ListOfMSDIds=new List<string>();
            try
            {
                foreach(SDMXObjectModel.Structure.MetadataStructureType MSD in  CompleteStructure.Structures.MetadataStructures)
                {
                    ListOfMSDIds.Add(MSD.id);
                }
                if (!(ListOfMSDIds.Contains(((MetadataStructureRefType)((MetadataStructureReferenceType)(Metadata.Header.Structure[0].Item)).Items[0]).id)))
                {
                    RetVal.Add(MetadataValidationStatus.Referred_MSD_Invalid.ToString(), Constants.ValidationMessages.Invalid_Referred_MSD_Id + ((MetadataStructureRefType)((MetadataStructureReferenceType)(Metadata.Header.Structure[0].Item)).Items[0]).id);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return RetVal;
        }
コード例 #18
0
        private ArtefactInfo Prepare_ArtefactInfo_From_SubscriptionRequest(SDMXObjectModel.Registry.SubscriptionRequestType SubscriptionRequest, string FileName)
        {
            ArtefactInfo RetVal;
            SDMXObjectModel.Message.RegistryInterfaceType RegistryInterface;
            XmlDocument XmlContent;

            RetVal = null;
            XmlContent = null;

            try
            {
                RegistryInterface = this.Get_RegistryInterface_Object(SubscriptionRequest);
                XmlContent = Serializer.SerializeToXmlDocument(typeof(SDMXObjectModel.Message.RegistryInterfaceType), RegistryInterface);
                RetVal = new ArtefactInfo(SubscriptionRequest.Subscription.RegistryURN, string.Empty, string.Empty, string.Empty, ArtefactTypes.Subscription, FileName, XmlContent);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
コード例 #19
0
ファイル: Global.cs プロジェクト: SDRC-India/sdrcdevinfo
    public static void Retrieve_SimpleAndQueryableDataSource_FromRegistration(RegistrationType Registration, out string SimpleDataSource, out SDMXObjectModel.Registry.QueryableDataSourceType QueryableDataSource)
    {
        SimpleDataSource = string.Empty;
        QueryableDataSource = null;

        if (Registration.Datasource != null && Registration.Datasource.Count > 0 && Registration.Datasource.Count < 3)
        {
            if (Registration.Datasource.Count == 1)
            {
                if (Registration.Datasource[0] is SDMXObjectModel.Registry.QueryableDataSourceType)
                {
                    QueryableDataSource = (SDMXObjectModel.Registry.QueryableDataSourceType)Registration.Datasource[0];
                }
                else if (Registration.Datasource[0] is string)
                {
                    SimpleDataSource = (string)Registration.Datasource[0];
                }
            }
            else if (Registration.Datasource.Count == 2)
            {
                if (Registration.Datasource[0] is SDMXObjectModel.Registry.QueryableDataSourceType)
                {
                    QueryableDataSource = (SDMXObjectModel.Registry.QueryableDataSourceType)Registration.Datasource[0];

                    if (Registration.Datasource[1] is string)
                    {
                        SimpleDataSource = (string)Registration.Datasource[1];
                    }
                }
                else if (Registration.Datasource[0] is string)
                {
                    SimpleDataSource = (string)Registration.Datasource[0];

                    if (Registration.Datasource[1] is SDMXObjectModel.Registry.QueryableDataSourceType)
                    {
                        QueryableDataSource = (SDMXObjectModel.Registry.QueryableDataSourceType)Registration.Datasource[1];
                    }
                }
            }
        }
    }
コード例 #20
0
        private void Load_ListOfDimensionsAtSeriesLevel(SDMXObjectModel.Message.StructureType Structure, out List<string> ListDimensions)
        {
            ListDimensions = new List<string>();
            int i;
            DimensionType Dimension;

            SDMXObjectModel.Structure.DataStructureComponentsType DSComponents = new DataStructureComponentsType();
            DSComponents = (SDMXObjectModel.Structure.DataStructureComponentsType)(Structure.Structures.DataStructures[0].Item);

            for (i = 0; i < DSComponents.Items[0].Items.Count; i++)
            {
                if (DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.DimensionType)
                {
                    Dimension = (SDMXObjectModel.Structure.DimensionType)(DSComponents.Items[0].Items[i]);
                    ListDimensions.Add(((ConceptRefType)(Dimension.ConceptIdentity.Items[0])).id);
                }
            }
        }
コード例 #21
0
        private SDMXObjectModel.Message.RegistryInterfaceType Get_RegistryInterface_Object(SDMXObjectModel.Registry.NotifyRegistryEventType NotifyRegistryEvent)
        {
            SDMXObjectModel.Message.RegistryInterfaceType RetVal;

            RetVal = new SDMXObjectModel.Message.RegistryInterfaceType();
            RetVal.Header = this.Get_Appropriate_Header();
            RetVal.Item = NotifyRegistryEvent;
            RetVal.Footer = null;

            return RetVal;
        }
コード例 #22
0
        /// <summary>
        /// Load_Lists_From_Codelists method initialises various lists from a SDMXApi's Structure object. 
        /// </summary>
        /// <param name="Structure">SDMXApi's Structure object to be used for initialisation of lists.</param>
        /// <param name="ListIndicator">List of valid indicators.</param>
        /// <param name="ListUnit">List of valid units.</param>
        /// <param name="ListArea">List of valid reference areas.</param>
        /// <remarks>These lists represent the codelists contained in Structure object and are later used to validate Series and Obs objects 
        /// contained in StructureSpecificData object.</remarks>
        private void Load_Lists_From_Codelists(SDMXObjectModel.Message.StructureType Structure, out List<string> ListIndicator, out List<string> ListUnit,
                                               out List<string> ListArea, out List<string> ListSource, out Dictionary<string, List<string>> dictSubgroupBreakUp)
        {
            ListIndicator = new List<string>();
            ListUnit = new List<string>();
            ListArea = new List<string>();
            ListSource = new List<string>();
            dictSubgroupBreakUp = new Dictionary<string, List<string>>();

            // 1. Initialising all Lists and dictionary of Subgroup Breakups.
            foreach (CodelistType Codelist in Structure.Structures.Codelists)
            {
                switch (Codelist.id)
                {
                    case Constants.CodeList.Indicator.Id:
                        ListIndicator = Get_CodeValues_From_Codelist(Codelist);
                        break;
                    case Constants.CodeList.Unit.Id:
                        ListUnit = Get_CodeValues_From_Codelist(Codelist);
                        break;
                    case Constants.CodeList.Area.Id:
                        ListArea = Get_CodeValues_From_Codelist(Codelist);
                        break;
                    //case Constants.CodeList.Source.Id:
                    //    ListSource = Get_CodeValues_From_Codelist(Codelist);
                    //    break;
                    case Constants.CodeList.SubgroupVal.Id:
                        break;
                    case Constants.CodeList.SubgroupType.Id:
                        break;
                    case Constants.CodeList.IUS.Id:
                        break;
                    default:
                        dictSubgroupBreakUp.Add(Codelist.id.Replace(Constants.CodelistPrefix, string.Empty), Get_CodeValues_From_Codelist(Codelist));
                        break;
                }
            }
        }
コード例 #23
0
        internal override bool Generate_Data(XmlDocument query, string outputFolder, out int fileCount, out List<string> GeneratedFiles, SDMXObjectModel.Message.StructureHeaderType Header)
        {
            bool RetVal;
            string FileName;
            fileCount = 0;
            SDMXObjectModel.Message.StructureSpecificTimeSeriesDataQueryType StructureSpecificTimeSeriesDataQuery;
            StructureSpecificTimeSeriesDataType StructureSpecificTimeSeriesData;
            TimeSeriesDataSetType Dataset;
            SeriesType Series;
            ObsType Obs;
            Dictionary<string, string> DictSeriesAttributes, DictObsAttributes, DictSubgroupBreakup;
            DataTable DtSubgroup, DtSubgroupTypes, DtData, DtDistinctIUS, DtDistinctIUSA;
            string IndicatorGId, UnitGId, SubgroupValGId, AreaID, Source;
            DataRow[] IUSRows, IUSARows;
            GeneratedFiles = new List<string>();
            DateTime CurrentTime = DateTime.Now;
            try
            {
                StructureSpecificTimeSeriesDataQuery = (SDMXObjectModel.Message.StructureSpecificTimeSeriesDataQueryType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureSpecificTimeSeriesDataQueryType), query);

                this.Parse_Query(StructureSpecificTimeSeriesDataQuery.Query.DataWhere, StructureSpecificTimeSeriesDataQuery.Query.ReturnDetails);
                this.Create_Folder_Structure(outputFolder);

                DtSubgroup = this.DIConnection.ExecuteDataTable(this.DIQueries.SubgroupValSubgroup.GetSubgroupValsWithSubgroups());
                DtSubgroupTypes = this.DIConnection.ExecuteDataTable(this.DIQueries.SubgroupTypes.GetSubgroupTypes(FilterFieldType.None, string.Empty));
                FileName = string.Empty;

                SDMXUtility.Raise_Initilize_Process_Event("Generating SDMX files...", this.Languages.Count, this.Languages.Count);

                if (this.Languages != null && this.Languages.Count > 0)
                {
                    foreach (string language in this.Languages)
                    {
                        this.Set_Area_NIds(language);
                        this.Set_Source_NIds(language);
                        DtDistinctIUS = this.Get_Distinct_IUS_Table(language);
                        DtDistinctIUSA = this.Get_Distinct_IUSA_Table(language);
                        DtData = this.Get_Language_Specific_Data_Table(language);

                        foreach (DataRow DrDistinctIUS in DtDistinctIUS.Rows)
                        {
                            fileCount = fileCount + 1;
                            IndicatorGId = DrDistinctIUS[Indicator.IndicatorGId].ToString();
                            UnitGId = DrDistinctIUS[Unit.UnitGId].ToString();
                            SubgroupValGId = DrDistinctIUS[SubgroupVals.SubgroupValGId].ToString();

                            FileName = Path.Combine(Path.Combine(outputFolder, language), IndicatorGId + Constants.Underscore + UnitGId + Constants.Underscore + SubgroupValGId + "_" + language + "_" + CurrentTime.ToString("yyyy-MM-dd HHmmss") + Constants.XmlExtension);

                            StructureSpecificTimeSeriesData = new StructureSpecificTimeSeriesDataType();
                            StructureSpecificTimeSeriesData.DataSet = new List<TimeSeriesDataSetType>();

                            //StructureSpecificTimeSeriesData.Header = this.Get_Appropriate_Header();

                            if (Header == null)
                            {
                                StructureSpecificTimeSeriesData.Header = this.Get_Appropriate_Header();
                            }
                            else
                            {
                                StructureSpecificTimeSeriesData.Header.ID = Header.ID;
                                StructureSpecificTimeSeriesData.Header.Name = Header.Name;
                                StructureSpecificTimeSeriesData.Header.Prepared = Header.Prepared;
                                StructureSpecificTimeSeriesData.Header.Receiver = Header.Receiver;
                                StructureSpecificTimeSeriesData.Header.Sender = Header.Sender;
                                StructureSpecificTimeSeriesData.Header.Test = Header.Test;
                            }
                            StructureSpecificTimeSeriesData.Header.Structure = new List<SDMXObjectModel.Common.StructureSpecificDataTimeSeriesStructureType>();
                            StructureSpecificTimeSeriesData.Header.Structure.Add(new SDMXObjectModel.Common.StructureSpecificDataTimeSeriesStructureType());

                            StructureSpecificTimeSeriesData.Header.Structure[0].dimensionAtObservation = Constants.Concept.TIME_PERIOD.Id;
                            StructureSpecificTimeSeriesData.Header.Structure[0].structureID = Constants.DSD.Id;
                            StructureSpecificTimeSeriesData.Header.Structure[0].@namespace = Constants.defaultNamespace;

                            StructureSpecificTimeSeriesData.Header.Structure[0].Item = new DataStructureReferenceType();
                            ((DataStructureReferenceType)StructureSpecificTimeSeriesData.Header.Structure[0].Item).Items.Add(new DataStructureRefType());
                            ((DataStructureRefType)((DataStructureReferenceType)StructureSpecificTimeSeriesData.Header.Structure[0].Item).Items[0]).id = Constants.DSD.Id;
                            ((DataStructureRefType)((DataStructureReferenceType)StructureSpecificTimeSeriesData.Header.Structure[0].Item).Items[0]).agencyID = this.AgencyId;
                            ((DataStructureRefType)((DataStructureReferenceType)StructureSpecificTimeSeriesData.Header.Structure[0].Item).Items[0]).version = Constants.DSD.Version;
                            StructureSpecificTimeSeriesData.Footer = null;

                            Dataset = new TimeSeriesDataSetType();
                            StructureSpecificTimeSeriesData.DataSet.Add(Dataset);
                            Dataset.structureRef = Constants.DSD.Id;
                            Dataset.DataProvider = null;
                            Dataset.Annotations = null;
                            Dataset.Items = new List<SDMXObjectModel.Common.AnnotableType>();

                            IUSRows = DtDistinctIUSA.Select(Indicator.IndicatorGId + Constants.EqualsTo + Constants.Apostophe + IndicatorGId + Constants.Apostophe + Constants.AND + Unit.UnitGId + Constants.EqualsTo + Constants.Apostophe + UnitGId + Constants.Apostophe + Constants.AND + SubgroupVals.SubgroupValGId + Constants.EqualsTo + Constants.Apostophe + SubgroupValGId + Constants.Apostophe);

                            foreach (DataRow DrIUS in IUSRows)
                            {
                                AreaID = DrIUS[Area.AreaID].ToString();
                                Source = DrIUS[IndicatorClassifications.ICName].ToString();

                                DictSeriesAttributes = new Dictionary<string, string>();

                                DictSeriesAttributes.Add(Constants.Concept.INDICATOR.Id, IndicatorGId);
                                DictSeriesAttributes.Add(Constants.Concept.UNIT.Id, UnitGId);

                                DictSubgroupBreakup = this.Get_Subgroup_Breakup(SubgroupValGId, DtSubgroup, DtSubgroupTypes);
                                foreach (string Key in DictSubgroupBreakup.Keys)
                                {
                                    DictSeriesAttributes.Add(Key, DictSubgroupBreakup[Key]);
                                }

                                DictSeriesAttributes.Add(Constants.Concept.AREA.Id, AreaID);
                                DictSeriesAttributes.Add(Constants.Concept.SOURCE.Id, Source);

                                Series = new SeriesType(DictSeriesAttributes, null);
                                Dataset.Items.Add(Series);
                                Series.Annotations = null;
                                Series.Obs = new List<ObsType>();

                                IUSARows = DtData.Select(Indicator.IndicatorGId + Constants.EqualsTo + Constants.Apostophe + IndicatorGId + Constants.Apostophe + Constants.AND + Unit.UnitGId + Constants.EqualsTo + Constants.Apostophe + UnitGId + Constants.Apostophe + Constants.AND + SubgroupVals.SubgroupValGId + Constants.EqualsTo + Constants.Apostophe + SubgroupValGId + Constants.Apostophe + Constants.AND + Area.AreaID + Constants.EqualsTo + Constants.Apostophe + AreaID.Replace("'", "''") + Constants.Apostophe + Constants.AND + IndicatorClassifications.ICName + Constants.EqualsTo + Constants.Apostophe + Source.Replace("'", "''") + Constants.Apostophe);

                                foreach (DataRow DrIUSA in IUSARows)
                                {
                                    DictObsAttributes = new Dictionary<string, string>();

                                    DictObsAttributes.Add(Constants.Concept.OBS_VALUE.Id, DrIUSA[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Data.DataValue].ToString());
                                    DictObsAttributes.Add(Constants.Concept.TIME_PERIOD.Id, DrIUSA[Timeperiods.TimePeriod].ToString());

                                    DictObsAttributes.Add(Constants.Concept.CONFIDENCE_INTERVAL_LOWER.Id, DrIUSA["ConfidenceIntervalLower"].ToString());
                                    DictObsAttributes.Add(Constants.Concept.CONFIDENCE_INTERVAL_UPPER.Id, DrIUSA["ConfidenceIntervalUpper"].ToString());
                                    DictObsAttributes.Add(Constants.Concept.NATURE.Id, DrIUSA["Nature"].ToString());
                                    DictObsAttributes.Add(Constants.Concept.PERIODICITY.Id, DrIUSA["Periodicity"].ToString());
                                    DictObsAttributes.Add(Constants.Concept.DENOMINATOR.Id, DrIUSA[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.Data.DataDenominator].ToString());
                                    DictObsAttributes.Add(Constants.Concept.FOOTNOTES.Id, DrIUSA[DevInfo.Lib.DI_LibDAL.Queries.DIColumns.FootNotes.FootNote].ToString());
                                    Obs = new ObsType(DictObsAttributes);
                                    Series.Obs.Add(Obs);
                                    Obs.Annotations = null;
                                }
                            }

                            Serializer.SerializeToFile(typeof(StructureSpecificTimeSeriesDataType), StructureSpecificTimeSeriesData, FileName);
                            GeneratedFiles.Add(FileName);
                            //-- Raise event for generated file
                            SDMXUtility.Raise_Notify_File_Name_Event(FileName);
                        }
                    }
                }

                RetVal = true;
            }
            catch (Exception ex)
            {
                RetVal = false;
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
コード例 #24
0
    /// <summary>
    /// Todo: try catch block for both complete
    /// </summary>
    /// <param name="Header"></param>
    /// <param name="DbNId"></param>
    /// <param name="UserNId"></param>
    /// <param name="sdmxFolderPath"></param>
    /// <returns></returns>
    private bool UpdateCompleteWithHeaderForDB(SDMXObjectModel.Message.StructureHeaderType Header, string DbNId, string UserNId, string sdmxFolderPath)
    {
        bool RetVal = false;
        SDMXObjectModel.Message.StructureType Complete;

        string completePath = sdmxFolderPath + "\\" + DevInfo.Lib.DI_LibSDMX.Constants.Complete_XML.FileName;
        Complete = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), completePath);
        Complete.Header = Header;

        Complete.Structures.HierarchicalCodelists = null;
        Complete.Structures.ProvisionAgreements = null;
        Complete.Structures.ReportingTaxonomies = null;
        Complete.Structures.StructureSets = null;
        Complete.Structures.OrganisationSchemes = null;
        Complete.Structures.Constraints = null;
        Complete.Structures.Processes = null;
        Complete.Footer = null;

        Remove_Extra_Annotations(Complete);
        SDMXObjectModel.Serializer.SerializeToFile(typeof(SDMXObjectModel.Message.StructureType), Complete, sdmxFolderPath + "\\" + DevInfo.Lib.DI_LibSDMX.Constants.Complete_XML.FileName);
        RetVal = true;
        return RetVal;
    }
コード例 #25
0
    private void Remove_Reduntant_Artefact_Tags(SDMXObjectModel.Message.StructureType Structure)
    {
        if (Structure.Structures.Categorisations != null && Structure.Structures.Categorisations.Count == 0)
        {
            Structure.Structures.Categorisations = null;
        }

        if (Structure.Structures.CategorySchemes != null && Structure.Structures.CategorySchemes.Count == 0)
        {
            Structure.Structures.CategorySchemes = null;
        }

        if (Structure.Structures.Codelists != null && Structure.Structures.Codelists.Count == 0)
        {
            Structure.Structures.Codelists = null;
        }

        if (Structure.Structures.Concepts != null && Structure.Structures.Concepts.Count == 0)
        {
            Structure.Structures.Concepts = null;
        }

        if (Structure.Structures.Constraints != null && Structure.Structures.Constraints.Count == 0)
        {
            Structure.Structures.Constraints = null;
        }

        if (Structure.Structures.Dataflows != null && Structure.Structures.Dataflows.Count == 0)
        {
            Structure.Structures.Dataflows = null;
        }

        if (Structure.Structures.DataStructures != null && Structure.Structures.DataStructures.Count == 0)
        {
            Structure.Structures.DataStructures = null;
        }

        if (Structure.Structures.HierarchicalCodelists != null && Structure.Structures.HierarchicalCodelists.Count == 0)
        {
            Structure.Structures.HierarchicalCodelists = null;
        }

        if (Structure.Structures.Metadataflows != null && Structure.Structures.Metadataflows.Count == 0)
        {
            Structure.Structures.Metadataflows = null;
        }

        if (Structure.Structures.MetadataStructures != null && Structure.Structures.MetadataStructures.Count == 0)
        {
            Structure.Structures.MetadataStructures = null;
        }

        if (Structure.Structures.OrganisationSchemes != null && Structure.Structures.OrganisationSchemes.Count == 0)
        {
            Structure.Structures.OrganisationSchemes = null;
        }

        if (Structure.Structures.Processes != null && Structure.Structures.Processes.Count == 0)
        {
            Structure.Structures.Processes = null;
        }

        if (Structure.Structures.ProvisionAgreements != null && Structure.Structures.ProvisionAgreements.Count == 0)
        {
            Structure.Structures.ProvisionAgreements = null;
        }

        if (Structure.Structures.ReportingTaxonomies != null && Structure.Structures.ReportingTaxonomies.Count == 0)
        {
            Structure.Structures.ReportingTaxonomies = null;
        }

        if (Structure.Structures.StructureSets != null && Structure.Structures.StructureSets.Count == 0)
        {
            Structure.Structures.StructureSets = null;
        }

        Structure.Footer = null;
    }
コード例 #26
0
    private string GenerateMetadata(int DbNid, string LoggedInUserNId, string IndicatorNIds, string AreaNIds, string SourceNIds, out List<string> GeneratedIndicatorMetadataFiles, out List<string> GeneratedAreaMetadataFiles, out List<string> GeneratedSourceMetadataFiles, SDMXObjectModel.Message.StructureHeaderType Header)
    {
        string RetVal;
        DIConnection DIConnection;
        DIQueries DIQueries;
        string OutputFolder, AgencyId;
        bool MetadataGenerated = false;

        RetVal = "false";
        DIConnection = Global.GetDbConnection(DbNid);
        DIQueries = new DIQueries(DIConnection.DIDataSetDefault(), DIConnection.DILanguageCodeDefault(DIConnection.DIDataSetDefault()));
        OutputFolder = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.Data + DbNid.ToString());
        AgencyId = DevInfo.Lib.DI_LibSDMX.Constants.MaintenanceAgencyScheme.Prefix + LoggedInUserNId;
        //this.Clean_Metadata_Folder(DbNid);
        //    GeneratedMetadataFiles=new List<string>();
        GeneratedIndicatorMetadataFiles = new List<string>();
        GeneratedAreaMetadataFiles = new List<string>();
        GeneratedSourceMetadataFiles = new List<string>();
        try
        {
            MetadataGenerated = SDMXUtility.Generate_MetadataReport(SDMXSchemaType.Two_One, MetadataTypes.Area, AreaNIds, AgencyId, string.Empty, null, DIConnection, DIQueries, Path.Combine(OutputFolder, Constants.FolderName.SDMX.AreaMetadata), out GeneratedAreaMetadataFiles, Header);

            if (MetadataGenerated == true)
            {
                MetadataGenerated = SDMXUtility.Generate_MetadataReport(SDMXSchemaType.Two_One, MetadataTypes.Indicator, IndicatorNIds, AgencyId, string.Empty, null, DIConnection, DIQueries, Path.Combine(OutputFolder, Constants.FolderName.SDMX.IndicatorMetadata), out GeneratedIndicatorMetadataFiles, Header);

                if (MetadataGenerated == true)
                {
                    MetadataGenerated = SDMXUtility.Generate_MetadataReport(SDMXSchemaType.Two_One, MetadataTypes.Source, SourceNIds, AgencyId, string.Empty, null, DIConnection, DIQueries, Path.Combine(OutputFolder, Constants.FolderName.SDMX.SourceMetadata), out GeneratedSourceMetadataFiles, Header);

                    if (MetadataGenerated == true)
                    {
                        RetVal = "true";
                    }
                    else
                    {
                        RetVal = "false";
                    }
                }
                else
                {
                    RetVal = "false";
                }
            }
            else
            {
                RetVal = "false";
            }
        }
        catch (Exception ex)
        {
            //Global.WriteErrorsInLog(ex.StackTrace);
            Global.CreateExceptionString(ex, null);
            throw ex;
        }

        return RetVal;
    }
コード例 #27
0
    private bool UpdateCodelistsForDBWithHeader(SDMXObjectModel.Message.StructureHeaderType Header, string DbNId, string UserNId, string CodelistsFolderPath)
    {
        bool RetVal;
        SDMXObjectModel.Message.StructureType CodelistStructure;
        RetVal = true;
        try
        {

            string[] Files = Directory.GetFiles(CodelistsFolderPath);
            foreach (string codilistFile in Files)
            {
                CodelistStructure = new SDMXObjectModel.Message.StructureType();
                CodelistStructure = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromFile(typeof(SDMXObjectModel.Message.StructureType), codilistFile);
                CodelistStructure.Header = Header;

                CodelistStructure.Structures.Categorisations = null;
                CodelistStructure.Structures.OrganisationSchemes = null;
                CodelistStructure.Structures.HierarchicalCodelists = null;
                CodelistStructure.Structures.Concepts = null;
                CodelistStructure.Structures.Metadataflows = null;
                CodelistStructure.Structures.MetadataStructures = null;
                CodelistStructure.Structures.Processes = null;
                CodelistStructure.Structures.ReportingTaxonomies = null;
                CodelistStructure.Structures.StructureSets = null;
                CodelistStructure.Structures.CategorySchemes = null;
                CodelistStructure.Structures.Constraints = null;
                CodelistStructure.Structures.Dataflows = null;
                CodelistStructure.Footer = null;
                Remove_Extra_Annotations(CodelistStructure);
                SDMXObjectModel.Serializer.SerializeToFile(typeof(SDMXObjectModel.Message.StructureType), CodelistStructure, codilistFile);
            }

        }
        catch (Exception ex)
        {
            //Global.WriteErrorsInLog("Creating Codelists For Uploaded DSD from Admin");
            //Global.WriteErrorsInLog(ex.StackTrace);
            //Global.WriteErrorsInLog(ex.Message);
            RetVal = false;
            Global.CreateExceptionString(ex, null);
        }
        finally
        {

        }

        return RetVal;
    }
コード例 #28
0
        private ArtefactInfo Prepare_ArtefactInfo_From_OrganisationScheme(SDMXObjectModel.Structure.OrganisationSchemeType OrganisationScheme, string FileName, ArtefactTypes artefactType)
        {
            ArtefactInfo RetVal;
            SDMXObjectModel.Message.StructureType Structure;
            XmlDocument XmlContent;

            RetVal = null;
            XmlContent = null;

            try
            {
                Structure = this.Get_Structure_Object(OrganisationScheme);
                XmlContent = Serializer.SerializeToXmlDocument(typeof(SDMXObjectModel.Message.StructureType), Structure);
                RetVal = new ArtefactInfo(OrganisationScheme.id, OrganisationScheme.agencyID, OrganisationScheme.version, string.Empty, artefactType, FileName, XmlContent);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
コード例 #29
0
    private XmlDocument GetQueryXmlDocumentForSubmitSubscription(ActionType Action, string UserIdAndType, string agencyId, List<bool> isSOAPMailIds, List<string> notificationMailIds, List<bool> isSOAPHTTPs, List<string> notificationHTTPs, DateTime startDate, DateTime endDate, string eventSelector, Dictionary<string, string> dictCategories, string mfdId, string RegistryURN,SDMXObjectModel.Message.StructureHeaderType Header)
    {
        XmlDocument RetVal;
        string id;
        string userId;
        UserTypes userType;
        SDMXObjectModel.Message.RegistryInterfaceType RegistryInterface;
        int counter = 0;
        DIConnection DIConnection;

        RetVal = null;
        id = string.Empty;
        userId = string.Empty;
        userType = UserTypes.Consumer;

        try
        {
            DIConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, Server.MapPath("~//stock//Database.mdb"),
                           string.Empty, string.Empty);
            if (string.IsNullOrEmpty(RegistryURN))
            {
                id = Guid.NewGuid().ToString();
            }
            else
            {
                id = RegistryURN;
            }

            userId = UserIdAndType.Split('|')[0];
            if (UserIdAndType.Split('|')[1] == "True")
            {
                userType = UserTypes.Provider;
            }
            else
            {
                userType = UserTypes.Consumer;
            }

            RegistryInterface = new RegistryInterfaceType();
            if (Header == null)
            {
                RegistryInterface.Header = Global.Get_Appropriate_Header();
            }
            else
            {
                RegistryInterface.Header.ID = Header.ID.ToString();
                RegistryInterface.Header.Prepared = Header.Prepared.ToString();
                foreach (PartyType receiver in Header.Receiver)
                {
                    RegistryInterface.Header.Receiver = new PartyType();
                    RegistryInterface.Header.Receiver.Contact = receiver.Contact;
                    RegistryInterface.Header.Receiver.id = receiver.id;
                    RegistryInterface.Header.Receiver.Name = receiver.Name;
                }
                RegistryInterface.Header.Sender = (SDMXObjectModel.Message.SenderType)Header.Sender;
                RegistryInterface.Header.Test = Header.Test;
            }
            RegistryInterface.Item = new SDMXObjectModel.Registry.SubmitSubscriptionsRequestType();

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest = new List<SubscriptionRequestType>();
            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest.Add(new SubscriptionRequestType());

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription = new SDMXObjectModel.Registry.SubscriptionType();

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].action = Action;
            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.Organisation = new OrganisationReferenceType();

            if (userType == UserTypes.Consumer)
            {
                ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.Organisation.Items.Add(new DataConsumerRefType(DevInfo.Lib.DI_LibSDMX.Constants.DataConsumerScheme.Prefix + userId, DevInfo.Lib.DI_LibSDMX.Constants.DataConsumerScheme.AgencyId, DevInfo.Lib.DI_LibSDMX.Constants.DataConsumerScheme.Id, DevInfo.Lib.DI_LibSDMX.Constants.DataConsumerScheme.Version));
            }
            else
            {
                ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.Organisation.Items.Add(new DataProviderRefType(DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Prefix + userId, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.AgencyId, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Id, DevInfo.Lib.DI_LibSDMX.Constants.DataProviderScheme.Version));
            }

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.RegistryURN = id;

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.NotificationMailTo = new List<SDMXObjectModel.Registry.NotificationURLType>();
            foreach (string notificationMailId in notificationMailIds)
            {
                ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.NotificationMailTo.Add(new SDMXObjectModel.Registry.NotificationURLType(isSOAPMailIds[counter], notificationMailIds[counter]));
                counter++;
            }

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.NotificationHTTP = new List<SDMXObjectModel.Registry.NotificationURLType>();

            counter = 0;
            foreach (string notificationHTTP in notificationHTTPs)
            {
                ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.NotificationHTTP.Add(new SDMXObjectModel.Registry.NotificationURLType(isSOAPHTTPs[counter], notificationHTTPs[counter]));
                counter++;
            }

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.SubscriberAssignedID = Guid.NewGuid().ToString();

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.ValidityPeriod = new SDMXObjectModel.Registry.ValidityPeriodType();
            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.ValidityPeriod.StartDate = startDate;
            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.ValidityPeriod.EndDate = endDate;

            ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector = new List<object>();

            if (eventSelector == "Data Registration")
            {
                ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector.Add(new DataRegistrationEventsType());
                ((DataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items = new CategoryReferenceType[dictCategories.Keys.Count];
                ((DataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).ItemsElementName = new SDMXObjectModel.Registry.DataRegistrationEventsChoiceType[dictCategories.Keys.Count];

                counter = 0;
                foreach (string categoryId in dictCategories.Keys)
                {
                    ((DataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items[counter] = new CategoryReferenceType();
                    ((DataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).ItemsElementName[counter] = SDMXObjectModel.Registry.DataRegistrationEventsChoiceType.Category;

                    ((CategoryReferenceType)((DataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items[counter]).Items.Add(new CategoryRefType(categoryId, agencyId, dictCategories[categoryId], DevInfo.Lib.DI_LibSDMX.Constants.CategoryScheme.Sector.Version));

                    counter++;
                }
            }
            else if (eventSelector == "Metadata Registration")
            {
                ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector.Add(new MetadataRegistrationEventsType());
                ((MetadataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items = new MaintainableEventType[1];

                ((MetadataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items[0] = new MaintainableEventType();
                ((MetadataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).ItemsElementName = new MetadataRegistrationEventsChoiceType[1];
                ((MetadataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).ItemsElementName[0] = SDMXObjectModel.Registry.MetadataRegistrationEventsChoiceType.MetadataflowReference;
                ((MaintainableEventType)((MetadataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items[0]).Item = new MaintainableQueryType();
                ((MaintainableQueryType)(((MaintainableEventType)((MetadataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items[0]).Item)).id = mfdId;
                ((MaintainableQueryType)(((MaintainableEventType)((MetadataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items[0]).Item)).agencyID = agencyId;
                ((MaintainableQueryType)(((MaintainableEventType)((MetadataRegistrationEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items[0]).Item)).version = DevInfo.Lib.DI_LibSDMX.Constants.MFD.Area.Version;
            }
            else if (eventSelector == "Structural Metadata Registration")
            {
                ((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector.Add(new StructuralRepositoryEventsType());
                ((StructuralRepositoryEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).AgencyID = new List<string>();
                ((StructuralRepositoryEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).AgencyID.Add(agencyId);
                ((StructuralRepositoryEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items = new EmptyType[1];
                ((StructuralRepositoryEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).Items[0] = new EmptyType();
                ((StructuralRepositoryEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).ItemsElementName = new StructuralRepositoryEventsChoiceType[1];
                ((StructuralRepositoryEventsType)((SDMXObjectModel.Registry.SubmitSubscriptionsRequestType)(RegistryInterface.Item)).SubscriptionRequest[0].Subscription.EventSelector[0]).ItemsElementName[0] = SDMXObjectModel.Registry.StructuralRepositoryEventsChoiceType.AllEvents;
            }
            RetVal = Serializer.SerializeToXmlDocument(typeof(SDMXObjectModel.Message.RegistryInterfaceType), RegistryInterface);

        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
        }
        finally
        {
        }

        return RetVal;
    }
コード例 #30
0
        private Dictionary<string, string> Report_Structure_Validation(GenericMetadataType Metadata, SDMXObjectModel.Structure.MetadataStructureType MSD)
        {
            Dictionary<string, string> RetVal;
            List<string> ListOfReportedAttributes;
            SDMXObjectModel.Structure.ReportStructureType ReportStructure;
            SDMXObjectModel.Structure.MetadataAttributeType MetadataAttribute;
            int i;

            RetVal = new Dictionary<string, string>();
            ListOfReportedAttributes = new List<string>();
            try
            {
                ReportStructure=(SDMXObjectModel.Structure.ReportStructureType)(((SDMXObjectModel.Structure.MetadataStructureComponentsType)MSD.Item).Items[1]);
                for (i = 0; i < ReportStructure.Items.Count; i++)
                {
                    MetadataAttribute = ((SDMXObjectModel.Structure.MetadataAttributeType)(ReportStructure.Items[i]));
                    ListOfReportedAttributes.Add(MetadataAttribute.id);
                }
                for (i = 0; i < Metadata.MetadataSet[0].Report[0].AttributeSet.ReportedAttribute.Count; i++)
                {
                    if (!(ListOfReportedAttributes.Contains(Metadata.MetadataSet[0].Report[0].AttributeSet.ReportedAttribute[i].id)))
                    {
                        RetVal.Add(MetadataValidationStatus.Metadata_Report_Structure_Invalid.ToString(), Constants.ValidationMessages.Invalid_Metadata_Reported_Attribute + Metadata.MetadataSet[0].Report[0].AttributeSet.ReportedAttribute[i].id);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return RetVal;
        }