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);
                }
            }
        }
        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);
            }
        }
    private string BindComparisonOfTwoDSDs(string dsd1FileNameWPath, string dsd2FileNameWPath, string hlngcodedb, string ComparisonType)
    {
        StringBuilder RetVal;
        XmlDocument DSD1Xml;
        XmlDocument DSD2Xml;

        List<String> ListOfMissingDimensions;
        List<String> ListOfMissingAttributes;
        List<String> DSD2DimensionList;
        List<String> DSD2AttributeList;
        List<String> DSD1DimensionList;
        List<String> DSD1AttributeList;
        List<String> UnMappedDSD2DimensionList;
        List<String> UnMappedDSD2AttributeList;

        SDMXObjectModel.Structure.DimensionType Dimension;
        SDMXObjectModel.Structure.TimeDimensionType TimeDimension;
        SDMXObjectModel.Structure.AttributeType Attribute;
        SDMXObjectModel.Common.ConceptReferenceType ConceptIdentity;
        SDMXObjectModel.Structure.StructuresType ConceptsObjDSD1;
        SDMXObjectModel.Structure.StructuresType ConceptsObjDSD2;

        int i, j;

        DSD1Xml = new XmlDocument();
        DSD2Xml = new XmlDocument();

        DSD2DimensionList = new List<string>();
        DSD2AttributeList = new List<string>();
        DSD1DimensionList = new List<string>();
        DSD1AttributeList = new List<string>();

        ListOfMissingDimensions = new List<string>();
        ListOfMissingAttributes = new List<string>();
        UnMappedDSD2DimensionList = new List<string>();
        UnMappedDSD2AttributeList = new List<string>();

        string DSD1Dimension = string.Empty;
        string DSD1Attribute = string.Empty;
        string UnmatchedDimensionName = string.Empty;
        string UnmatchedAttributeName = string.Empty;

        try
        {
            DSD1Xml.Load(dsd1FileNameWPath);
            DSD2Xml.Load(dsd2FileNameWPath);

            SDMXObjectModel.Message.StructureType DSD1 = new SDMXObjectModel.Message.StructureType();
            SDMXObjectModel.Message.StructureType DSD2 = new SDMXObjectModel.Message.StructureType();
            SDMXObjectModel.Structure.DataStructureComponentsType DSD1DSComponents = new DataStructureComponentsType();
            SDMXObjectModel.Structure.DataStructureComponentsType DSD2DSComponents = new DataStructureComponentsType();

            DSD1 = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), DSD1Xml);
            DSD2 = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), DSD2Xml);

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

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

            // Binding DSD2 Dimension in a list - DSD2DimensionList

            for (i = 0; i < DSD2DSComponents.Items[0].Items.Count; i++)
            {

                if (DSD2DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.TimeDimensionType)
                {
                    TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSD2DSComponents.Items[0].Items[i]);
                    ConceptIdentity = TimeDimension.ConceptIdentity;

                }
                else
                {
                    Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD2DSComponents.Items[0].Items[i]);
                    ConceptIdentity = Dimension.ConceptIdentity;

                }
                DSD2DimensionList.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());

            }

            // Binding DSD2 Attributes in a list - DSD2AttributeList
            for (i = 0; i < DSD2DSComponents.Items[1].Items.Count; i++)
            {
                Attribute = (SDMXObjectModel.Structure.AttributeType)(DSD2DSComponents.Items[1].Items[i]);
                ConceptIdentity = Attribute.ConceptIdentity;
                DSD2AttributeList.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());

            }

            // Binding Unmatched Dimensions in a list- ListOfMissingDimensions that exist in DSD1 and not in DSD2

            for (i = 0; i < DSD1DSComponents.Items[0].Items.Count; i++)
            {

                if (DSD1DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.TimeDimensionType)
                {
                    TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSD1DSComponents.Items[0].Items[i]);
                    ConceptIdentity = TimeDimension.ConceptIdentity;

                }
                else
                {
                    Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD1DSComponents.Items[0].Items[i]);
                    ConceptIdentity = Dimension.ConceptIdentity;

                }
                DSD1Dimension = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                DSD1DimensionList.Add(DSD1Dimension);
                if (!(DSD2DimensionList.Contains(DSD1Dimension)))
                {
                    ListOfMissingDimensions.Add(DSD1Dimension);
                }

            }

            // Binding Unmatched Attributes in a list- ListOfMissingAttributes that exist in DSD1 and not in DSD2

            for (i = 0; i < DSD1DSComponents.Items[1].Items.Count; i++)
            {
                Attribute = (SDMXObjectModel.Structure.AttributeType)(DSD1DSComponents.Items[1].Items[i]);
                ConceptIdentity = Attribute.ConceptIdentity;

                DSD1Attribute = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                DSD1AttributeList.Add(DSD1Attribute);
                if (!(DSD2AttributeList.Contains(DSD1Attribute)))
                {
                    ListOfMissingAttributes.Add(DSD1Attribute);
                }

            }

            // Binding UnMapped DSD2 Dimension in a list - UnMappedDSD2DimensionList

            for (i = 0; i < DSD2DimensionList.Count; i++)
            {
                if (!(DSD1DimensionList.Contains(DSD2DimensionList[i])))
                {
                    UnMappedDSD2DimensionList.Add(DSD2DimensionList[i]);
                }

            }

            // Binding UnMapped DSD2 Attribute in a list - UnMappedDSD2AttributeList

            for (i = 0; i < DSD2AttributeList.Count; i++)
            {
                if (!(DSD1AttributeList.Contains(DSD2AttributeList[i])))
                {
                    UnMappedDSD2AttributeList.Add(DSD2AttributeList[i]);
                }

            }

            //Binding Comparison of the two DSDs - DSD1 and DSD2

            RetVal = new StringBuilder();
            RetVal.Append("<br/>");
            if (ComparisonType == "1")
            {
                RetVal.Append("<h4>Unmatched Dimensions that exist in the Uploaded DSD1 and not in DSD2</h4>");
            }
            else
            {
                RetVal.Append("<h4>Unmatched Dimensions that exist in the Uploaded DSD and not in Master DSD</h4>");
            }

            RetVal.Append("<ul>");
            if (ListOfMissingDimensions.Count > 0)
            {
                for (i = 0; i < ListOfMissingDimensions.Count; i++)
                {
                    RetVal.Append("<li>");
                    UnmatchedDimensionName = string.Empty;
                    UnmatchedDimensionName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD1, ListOfMissingDimensions[i], hlngcodedb);
                    RetVal.Append("<label id=" + ListOfMissingDimensions[i] + " >" + ListOfMissingDimensions[i] + "</label>");
                    if (UnmatchedDimensionName != string.Empty)
                    {

                        RetVal.Append("<span class=\"reg_li_brac_txt\">(");
                        RetVal.Append(UnmatchedDimensionName);
                        RetVal.Append(")</span> ");

                    }

                    RetVal.Append("&nbsp;&nbsp;<select id='ddlDimensionAlternative_" + ListOfMissingDimensions[i] + "'" + "  class='confg_frm_inp_bx_txt_dd' style='width:350px'>");
                    RetVal.Append("<option value='0'>Select UnMapped Dimensions</option>");
                    for (j = 0; j < UnMappedDSD2DimensionList.Count; j++)
                    {
                        UnmatchedDimensionName = string.Empty;
                        UnmatchedDimensionName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD2, UnMappedDSD2DimensionList[j], hlngcodedb);
                        if (UnmatchedDimensionName == string.Empty)
                        {
                            RetVal.Append("<option value='" + UnMappedDSD2DimensionList[j] + "'>" + UnMappedDSD2DimensionList[j] + "</option>");
                        }
                        else
                        {
                            RetVal.Append("<option value='" + UnMappedDSD2DimensionList[j] + "'>");
                            RetVal.Append(UnMappedDSD2DimensionList[j]);
                            RetVal.Append(" (");
                            RetVal.Append(UnmatchedDimensionName);
                            RetVal.Append(")");
                            RetVal.Append("</option>");
                        }

                    }
                    RetVal.Append("</select>");
                    RetVal.Append("</li>");
                }
            }
            else
            {
                RetVal.Append("<span class=\"reg_li_brac_txt\">(");
                RetVal.Append("No Unmatched Dimensions");
                RetVal.Append(")</span> ");
            }

            RetVal.Append("</ul>");
            RetVal.Append("<br/>");
            if (ComparisonType == "1")
            {
                RetVal.Append("<h4>Unmatched Attributes that exist in the Uploaded DSD1 and not in DSD2</h4>");
            }
            else
            {
                RetVal.Append("<h4>Unmatched Attributes that exist in the Uploaded DSD and not in Master DSD</h4>");
            }
            RetVal.Append("<ul>");
            if (ListOfMissingAttributes.Count > 0)
            {
                for (i = 0; i < ListOfMissingAttributes.Count; i++)
                {
                    RetVal.Append("<li>");
                    UnmatchedAttributeName = string.Empty;
                    UnmatchedAttributeName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD1, ListOfMissingAttributes[i], hlngcodedb);
                    RetVal.Append("<label id=" + ListOfMissingAttributes[i] + " >" + ListOfMissingAttributes[i] + "</label>");
                    if (UnmatchedAttributeName != string.Empty)
                    {

                        RetVal.Append("<span class=\"reg_li_brac_txt\">(");
                        RetVal.Append(UnmatchedAttributeName);
                        RetVal.Append(")</span> ");

                    }

                    RetVal.Append("&nbsp;&nbsp;<select id='ddlAttributeAlternative_" + ListOfMissingAttributes[i] + "'" + "  class='confg_frm_inp_bx_txt_dd' style='width:350px'>");
                    RetVal.Append("<option value='0'>Select UnMapped Attributes</option>");
                    for (j = 0; j < UnMappedDSD2AttributeList.Count; j++)
                    {
                        UnmatchedAttributeName = string.Empty;
                        UnmatchedAttributeName = GetLanguageBasedConceptNameFromConceptScheme(ConceptsObjDSD2, UnMappedDSD2AttributeList[j], hlngcodedb);
                        if (UnmatchedAttributeName == string.Empty)
                        {
                            RetVal.Append("<option value='" + UnMappedDSD2AttributeList[j] + "'>" + UnMappedDSD2AttributeList[j] + "</option>");
                        }
                        else
                        {
                            RetVal.Append("<option value='" + UnMappedDSD2AttributeList[j] + "'>");
                            RetVal.Append(UnMappedDSD2AttributeList[j]);
                            RetVal.Append(" (");
                            RetVal.Append(UnmatchedAttributeName);
                            RetVal.Append(")");
                            RetVal.Append("</option>");
                        }

                    }
                    RetVal.Append("</select>");
                    RetVal.Append("</li>");
                }
            }
            else
            {
                RetVal.Append("<span class=\"reg_li_brac_txt\">(");
                RetVal.Append("No Unmatched Attributes");
                RetVal.Append(")</span> ");
            }

            RetVal.Append("</ul>");
            RetVal.Append("<br/>");
            RetVal.Append("&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' name='btnCompareCodes' id='btnCompareCodes' value='Compare Codes' class='di_gui_button' style='width:150px;float:left;margin-left:20px;' onclick='CompareCodelists(" + ComparisonType + ");'/>");
            RetVal.Append("&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' name='btnGenerateReport' id='btnGenerateReport' value='Generate Report' class='di_gui_button' style='width:150px;float:left;' onclick='GenerateReport(" + ComparisonType + ");'/>");
            RetVal.Append("&nbsp;&nbsp;<div id='divDownloadReport' class='reg_dwnld_bttn_main'  style='display:none;width:150px;float:left; height:11px;'>");
            RetVal.Append("<p><a id='lnkReport' href='#'>Download Report</a></p>");
            RetVal.Append("</div>");
            RetVal.Append("<br/>");
            RetVal.Append("<br/>");
            RetVal.Append("<br/>");
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);
            throw ex;

        }
        finally
        {

        }

        return RetVal.ToString();
    }
    private void BindDimensionsAttributesMeasure_For_Version_2_1()
    {
        XmlDocument SummaryXml;
        SummaryXml = new XmlDocument();
        int i, j, k;
        string DSDViewPath, DSDPath;

        StringBuilder sb;
        SDMXObjectModel.Structure.MeasureListType MeasureList;
        SDMXObjectModel.Structure.DimensionType Dimension;
        SDMXObjectModel.Structure.TimeDimensionType TimeDimension;
        SDMXObjectModel.Structure.AttributeType Attribute;
        SDMXObjectModel.Common.ConceptReferenceType ConceptIdentity;
        SDMXObjectModel.Structure.AttributeRelationshipType AttributeRelationship;
        SDMXObjectModel.Common.LocalPrimaryMeasureReferenceType LocalPrimaryMeasureReference;
        SDMXObjectModel.Structure.PrimaryMeasureType PrimaryMeasure;

        SDMXObjectModel.Structure.StructuresType ConceptsObj;

        SDMXObjectModel.Structure.DataStructureComponentsType DSComponents = new DataStructureComponentsType();

        DSDViewPath = string.Empty;
        DSDPath = string.Empty;

        SDMXObjectModel.Message.StructureType Summary = new SDMXObjectModel.Message.StructureType();

        DSDViewPath = "../../" + Constants.FolderName.Data + hdbnid + "\\sdmx\\DSD" + DevInfo.Lib.DI_LibSDMX.Constants.XmlExtension;
        DSDPath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.Data + hdbnid + "\\sdmx\\DSD" + DevInfo.Lib.DI_LibSDMX.Constants.XmlExtension);

        //Providing the Path of the Summary.xml
        SummaryXml.Load(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.Data + hdbnid + "\\sdmx\\Summary" + DevInfo.Lib.DI_LibSDMX.Constants.XmlExtension));

        //Loading Summary objects from its XML document into 'DataStructuresType' Summary object
        Summary = (SDMXObjectModel.Message.StructureType)SDMXObjectModel.Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), SummaryXml);

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

        //Binding DSD
        sb = new StringBuilder();
        sb.Append("<div class=\"reg_li_sub_txt\">");
        sb.Append("<b>");
        sb.Append(GetLangSpecificValue_For_Version_2_1(Summary.Structures.DataStructures[0].Name, hlngcodedb));
        sb.Append("</b>");
        sb.Append("<span class=\"reg_li_brac_txt\">(");
        sb.Append(GetLangSpecificValue_For_Version_2_1(Summary.Structures.DataStructures[0].Description, hlngcodedb));
        sb.Append(")</span> ");
        sb.Append("</div>");
        sb.Append("<div>");
        sb.Append("<a href=\" " + DSDViewPath.Replace("\\", "/") + "\"  ");
        sb.Append(" target=\"_blank\" class=\"reg_li_link_txt\" name=\"lang_View\"></a> | ");
        sb.Append("<a href='Download.aspx?fileId=" + DSDPath + "' class=\"reg_li_link_txt\" name=\"lang_Download\"></a>");
        sb.Append("</div>");
        sb.Append("<br/>");

        //Binding Dimensions

        sb.Append("<h4 id=\"lang_Dimensions\"></h4>");
        sb.Append("<ul>");
        for (i = 0; i < DSComponents.Items[0].Items.Count; i++)
        {

            if (DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.TimeDimensionType)
            {
                TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSComponents.Items[0].Items[i]);
                ConceptIdentity = TimeDimension.ConceptIdentity;
            }
            else
            {
                Dimension = (SDMXObjectModel.Structure.DimensionType)(DSComponents.Items[0].Items[i]);
                ConceptIdentity = Dimension.ConceptIdentity;
            }

            sb.Append("<li>");
            for (j = 0; j < ConceptsObj.Concepts.Count; j++)
                if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).maintainableParentID.ToString() == ConceptsObj.Concepts[j].id.ToString())
                {

                    for (k = 0; k < ConceptsObj.Concepts[j].Items.Count; k++)
                    {
                        if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString() == ConceptsObj.Concepts[j].Items[k].id.ToString())
                        {
                            sb.Append("<div>");
                            sb.Append(GetLangSpecificValue_For_Version_2_1(ConceptsObj.Concepts[j].Items[k].Name, hlngcodedb));
                            sb.Append("<span class=\"reg_li_brac_txt\">(");
                            sb.Append(GetLangSpecificValue_For_Version_2_1(ConceptsObj.Concepts[j].Items[k].Description, hlngcodedb));
                            sb.Append(")</span>");
                            sb.Append("<div>");

                            break;
                        }
                    }

                }
            sb.Append("</li>");
        }
        sb.Append("</ul>");
        divDimensions.InnerHtml = sb.ToString();

        //Binding Attributes

        sb = new StringBuilder();
        sb.Append("<h4 id=\"lang_Attributes\"></h4>");
        sb.Append("<ul>");
        for (i = 0; i < DSComponents.Items[1].Items.Count; i++)
        {
            Attribute = (SDMXObjectModel.Structure.AttributeType)(DSComponents.Items[1].Items[i]);
            ConceptIdentity = Attribute.ConceptIdentity;
            AttributeRelationship = Attribute.AttributeRelationship;
            LocalPrimaryMeasureReference = (SDMXObjectModel.Common.LocalPrimaryMeasureReferenceType)(AttributeRelationship.Items[0]);
            sb.Append("<li>");
            for (j = 0; j < ConceptsObj.Concepts.Count; j++)
                if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).maintainableParentID.ToString() == ConceptsObj.Concepts[j].id.ToString())
                {
                    for (k = 0; k < ConceptsObj.Concepts[j].Items.Count; k++)
                    {
                        if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString() == ConceptsObj.Concepts[j].Items[k].id.ToString())
                        {
                            sb.Append("<div>");
                            sb.Append(GetLangSpecificValue_For_Version_2_1(ConceptsObj.Concepts[j].Items[k].Name, hlngcodedb));
                            sb.Append("<span class=\"reg_li_brac_txt\">(");
                            sb.Append(GetLangSpecificValue_For_Version_2_1(ConceptsObj.Concepts[j].Items[k].Description, hlngcodedb));
                            sb.Append(")</span>");
                            sb.Append("</div>");
                            break;
                        }
                    }
                }
            sb.Append("<div class=\"reg_li_sub_txt\">");
            sb.Append("<span id=\"lang_Attachment_Level" + i + "\" ></span>");
            sb.Append("<span id=\"lang_Obs_Val" + i + "\">");
            sb.Append(((SDMXObjectModel.Common.LocalPrimaryMeasureRefType)(LocalPrimaryMeasureReference.Items[0])).id.ToString());
            sb.Append(" , ");
            sb.Append("</span>");
            sb.Append("<span id=\"lang_Mandatory" + i + "\" ></span>");
            if (((UsageStatusType)(Attribute.assignmentStatus)) == UsageStatusType.Mandatory)
            {
                sb.Append("<span id=\"lang_Yes" + i + "\" ></span>");
            }
            else
            {
                sb.Append("<span id=\"lang_No" + i + "\" ></span>");
            }
            sb.Append("</div>");
            sb.Append("</li>");
        }
        sb.Append("</ul>");
        divAttributes.InnerHtml = sb.ToString();

        //Binding Measure

        MeasureList = ((SDMXObjectModel.Structure.MeasureListType)((SDMXObjectModel.Structure.DataStructureComponentsType)(DSComponents)).MeasureList);
        sb = new StringBuilder();
        sb.Append("<h4 id=\"lang_Measure\"></h4>");
        sb.Append("<ul>");
        for (i = 0; i < DSComponents.Items[2].Items.Count; i++)
        {

            PrimaryMeasure = (SDMXObjectModel.Structure.PrimaryMeasureType)(DSComponents.Items[2].Items[i]);
            ConceptIdentity = PrimaryMeasure.ConceptIdentity;
            sb.Append("<li>");
            for (j = 0; j < ConceptsObj.Concepts.Count; j++)
                if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).maintainableParentID.ToString() == ConceptsObj.Concepts[j].id.ToString())
                {

                    for (k = 0; k < ConceptsObj.Concepts[j].Items.Count; k++)
                    {
                        if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString() == ConceptsObj.Concepts[j].Items[k].id.ToString())
                        {
                            sb.Append("<div>");
                            sb.Append("<span style=\"font-weight:normal\">");
                            sb.Append(GetLangSpecificValue_For_Version_2_1(ConceptsObj.Concepts[j].Items[k].Name, hlngcodedb));
                            sb.Append("</span>");

                            sb.Append("<span class=\"reg_li_brac_txt\">(");
                            sb.Append(GetLangSpecificValue_For_Version_2_1(ConceptsObj.Concepts[j].Items[k].Description, hlngcodedb));
                            sb.Append(")</span>");
                            sb.Append("<div>");
                            break;
                        }
                    }

                }
            sb.Append("</li>");
        }
        sb.Append("</ul>");
        divMeasure.InnerHtml = sb.ToString();
    }
    private string SaveComparisonReport(string dsd1FileNameWPath, string dsd2FileNameWPath, string hlngcodedb, Dictionary<string, string> dictMappedIndicators, Dictionary<string, string> dictMappedAttributes)
    {
        string RetVal;
        XmlDocument DSD1Xml;
        XmlDocument DSD2Xml;

        List<String> ListOfMissingDimensions;
        List<String> ListOfMissingAttributes;
        List<String> DSD2DimensionList;
        List<String> DSD2AttributeList;
        List<String> DSD1DimensionList;
        List<String> DSD1AttributeList;
        List<String> AdditionalDSD1DimensionList;
        List<String> AdditionalDSD1AttributeList;
        List<CodelistType> DSD1Codelists;
        List<CodelistType> DSD2Codelists;
        RepresentationType LocalRepresentation;

        SDMXObjectModel.Structure.DimensionType Dimension;
        SDMXObjectModel.Structure.TimeDimensionType TimeDimension;
        SDMXObjectModel.Structure.AttributeType Attribute;
        SDMXObjectModel.Common.ConceptReferenceType ConceptIdentity;
        SDMXObjectModel.Structure.StructuresType ConceptsObjDSD1;
        SDMXObjectModel.Structure.StructuresType ConceptsObjDSD2;

        int i,j,SheetIndex;
        RetVal = string.Empty;
        DSD1Xml = new XmlDocument();
        DSD2Xml = new XmlDocument();

        DSD2DimensionList = new List<string>();
        DSD2AttributeList = new List<string>();
        DSD1DimensionList = new List<string>();
        DSD1AttributeList = new List<string>();

        ListOfMissingDimensions = new List<string>();
        ListOfMissingAttributes = new List<string>();
        AdditionalDSD1DimensionList = new List<string>();
        AdditionalDSD1AttributeList = new List<string>();

        string DSD1Dimension = string.Empty;
        string DSD2Dimension = string.Empty;
        string DSD1Attribute = string.Empty;
        string DSD2Attribute = string.Empty;
        string UnmatchedDimensionName = string.Empty;
        string UnmatchedAttributeName = string.Empty;

        string DSD1CodelistId = string.Empty;
        string DSD2CodelistId = string.Empty;

        DIExcel ReportExcel = new DIExcel();
        string tempPath = string.Empty;
        string FileName = string.Empty;
        string FilePath = string.Empty;

        try
        {
            DSD1Xml.Load(dsd1FileNameWPath);
            DSD2Xml.Load(dsd2FileNameWPath);

            SDMXObjectModel.Message.StructureType DSD1 = new SDMXObjectModel.Message.StructureType();
            SDMXObjectModel.Message.StructureType DSD2 = new SDMXObjectModel.Message.StructureType();
            SDMXObjectModel.Structure.DataStructureComponentsType DSD1DSComponents = new DataStructureComponentsType();
            SDMXObjectModel.Structure.DataStructureComponentsType DSD2DSComponents = new DataStructureComponentsType();

            CodelistType DSD1Codelist = new CodelistType();
            CodelistType DSD2Codelist = new CodelistType();

            DSD1 = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), DSD1Xml);
            DSD2 = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), DSD2Xml);

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

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

            DSD1Codelists = DSD1.Structures.Codelists;
            DSD2Codelists = DSD2.Structures.Codelists;

            // Binding DSD2 Dimension in a list - DSD2DimensionList

            for (i = 0; i < DSD2DSComponents.Items[0].Items.Count; i++)
            {

                if (DSD2DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.TimeDimensionType)
                {
                    TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSD2DSComponents.Items[0].Items[i]);
                    ConceptIdentity = TimeDimension.ConceptIdentity;

                }
                else
                {
                    Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD2DSComponents.Items[0].Items[i]);
                    ConceptIdentity = Dimension.ConceptIdentity;

                }
                DSD2DimensionList.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());

            }

            // Binding DSD2 Attributes in a list - DSD2AttributeList
            for (i = 0; i < DSD2DSComponents.Items[1].Items.Count; i++)
            {
                Attribute = (SDMXObjectModel.Structure.AttributeType)(DSD2DSComponents.Items[1].Items[i]);
                ConceptIdentity = Attribute.ConceptIdentity;
                DSD2AttributeList.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());

            }

            // Binding Matched Dimensions in a dictionary- dictMappedIndicators that exist in DSD1 as well as in DSD2
            // and unmatched Dimensions in a list-AdditionalDSD1DimensionList that exist in DSD1 but not in DSD2

            for (i = 0; i < DSD1DSComponents.Items[0].Items.Count; i++)
            {

                if (DSD1DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.TimeDimensionType)
                {
                    TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSD1DSComponents.Items[0].Items[i]);
                    ConceptIdentity = TimeDimension.ConceptIdentity;

                }
                else
                {
                    Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD1DSComponents.Items[0].Items[i]);
                    ConceptIdentity = Dimension.ConceptIdentity;

                }
                DSD1Dimension = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                DSD1DimensionList.Add(DSD1Dimension);
                if ((DSD2DimensionList.Contains(DSD1Dimension)))
                {
                    dictMappedIndicators.Add(DSD1Dimension, DSD1Dimension);
                }
                else
                {
                    AdditionalDSD1DimensionList.Add(DSD1Dimension);
                }

            }

            // Binding Matched Attributes in a dictionary- dictMappedAttributes that exist in DSD1 as well as in DSD2
            // and unmatched Attributes in a list-AdditionalDSD1AttributeList that exist in DSD1 but not in DSD2

            for (i = 0; i < DSD1DSComponents.Items[1].Items.Count; i++)
            {
                Attribute = (SDMXObjectModel.Structure.AttributeType)(DSD1DSComponents.Items[1].Items[i]);
                ConceptIdentity = Attribute.ConceptIdentity;

                DSD1Attribute = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                DSD1AttributeList.Add(DSD1Attribute);
                if ((DSD2AttributeList.Contains(DSD1Attribute)))
                {
                    dictMappedAttributes.Add(DSD1Attribute, DSD1Attribute);
                }
                else
                {
                    AdditionalDSD1AttributeList.Add(DSD1Attribute);
                }

            }

            //Binding Missing Dimensions in a list-ListOfMissingDimensions that exist in DSD2 but not in DSD1

            for (i = 0; i < DSD2DimensionList.Count; i++)
            {
                if (!(DSD1DimensionList.Contains(DSD2DimensionList[i])))
                {
                    ListOfMissingDimensions.Add(DSD2DimensionList[i]);
                }
            }

            //Binding Missing Attributes in a list-ListOfMissingAttributes that exist in DSD2 but not in DSD1

            for (i = 0; i < DSD2AttributeList.Count; i++)
            {
                if (!(DSD1AttributeList.Contains(DSD2AttributeList[i])))
                {
                    ListOfMissingAttributes.Add(DSD2AttributeList[i]);
                }
            }

            //Binding Comparison of the two DSDs - DSD1 and DSD2

            tempPath= Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath,"stock\\tempSDMXFiles");
            FileName = "ComparisonReport_" + Guid.NewGuid().ToString() + ".xls";
            FilePath = tempPath + "\\" + FileName;
            ReportExcel = this.GenerateDimensionAndAttributesComparison(hlngcodedb,DSD1, DSD2, ReportExcel, dictMappedIndicators, ListOfMissingDimensions, AdditionalDSD1DimensionList, dictMappedAttributes, ListOfMissingAttributes, AdditionalDSD1AttributeList);
            SheetIndex = 2;
            foreach (string Indicator in dictMappedIndicators.Keys)
            {
                DSD1CodelistId = string.Empty;
                for (i = 0; i < DSD1DSComponents.Items[0].Items.Count; i++)
                {

                    if (DSD1DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.DimensionType)
                    {
                        Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD1DSComponents.Items[0].Items[i]);
                        ConceptIdentity = Dimension.ConceptIdentity;
                        LocalRepresentation = Dimension.LocalRepresentation;
                        DSD1Dimension = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                        if (DSD1Dimension == Indicator)
                        {
                            DSD1CodelistId = ((CodelistRefType)((((CodelistReferenceType)(LocalRepresentation.Items[0])).Items[0]))).id;
                            break;
                        }

                    }

                }

                if (string.IsNullOrEmpty(DSD1CodelistId) == false)
                {
                    for (j = 0; j < DSD1Codelists.Count; j++)
                    {
                        if (DSD1CodelistId == DSD1Codelists[j].id)
                        {
                            DSD1Codelist = DSD1Codelists[j];
                            break;
                        }
                    }
                }

                for (i = 0; i < DSD2DSComponents.Items[0].Items.Count; i++)
                {
                    DSD2CodelistId = string.Empty;
                    if (DSD2DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.DimensionType)
                    {
                        Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD2DSComponents.Items[0].Items[i]);
                        ConceptIdentity = Dimension.ConceptIdentity;
                        LocalRepresentation = Dimension.LocalRepresentation;
                        DSD2Dimension = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                        if (DSD2Dimension == dictMappedIndicators[Indicator])
                        {
                            DSD2CodelistId = ((CodelistRefType)((((CodelistReferenceType)(LocalRepresentation.Items[0])).Items[0]))).id;
                            break;
                        }

                    }

                }
                if (string.IsNullOrEmpty(DSD2CodelistId) == false)
                {
                    for (j = 0; j < DSD2Codelists.Count; j++)
                    {
                        if (DSD2CodelistId == DSD2Codelists[j].id)
                        {
                            DSD2Codelist = DSD2Codelists[j];
                            break;
                        }
                    }
                }
                if ((DSD1CodelistId != string.Empty) && (DSD2CodelistId != string.Empty))
                {

                    if( (DSD1Codelist.Items.Count > 0) && (DSD2Codelist.Items.Count > 0) )
                    {
                        ReportExcel.InsertWorkSheet(DSD1Codelist.id + " Vs " + DSD2Codelist.id);
                        ReportExcel = this.GenerateCodelistsComparison(hlngcodedb, DSD1Codelist, DSD2Codelist, ReportExcel, SheetIndex);
                        SheetIndex = SheetIndex + 1;
                    }

                }

            }
            ReportExcel.ActiveSheetIndex = 0;
            if (ReportExcel.AvailableWorksheetsCount > 1)
            {

                ReportExcel.SaveAs(FilePath);
                RetVal = FileName;

            }

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

        }
        finally
        {

        }

        return RetVal;
    }
    private string BindCodelistComparison(string dsd1FileNameWPath, string dsd2FileNameWPath, string hlngcodedb, Dictionary<string, string> dictMappedIndicators, Dictionary<string, string> dictMappedAttributes, string ComparisonType)
    {
        StringBuilder RetVal;
        XmlDocument DSD1Xml;
        XmlDocument DSD2Xml;

        List<String> ListOfMissingDimensions;
        List<String> ListOfMissingAttributes;
        List<String> DSD2DimensionList;
        List<String> DSD2AttributeList;
        List<String> DSD1DimensionList;
        List<String> DSD1AttributeList;
        List<String> UnMappedDSD2DimensionList;
        List<String> UnMappedDSD2AttributeList;
        List<CodelistType> DSD1Codelists;
        List<CodelistType> DSD2Codelists;

        SDMXObjectModel.Structure.DimensionType Dimension;
        SDMXObjectModel.Structure.TimeDimensionType TimeDimension;
        SDMXObjectModel.Structure.AttributeType Attribute;
        SDMXObjectModel.Common.ConceptReferenceType ConceptIdentity;
        RepresentationType LocalRepresentation;
        SDMXObjectModel.Structure.StructuresType ConceptsObjDSD1;
        SDMXObjectModel.Structure.StructuresType ConceptsObjDSD2;

        int i, j, k;

        DSD1Xml = new XmlDocument();
        DSD2Xml = new XmlDocument();

        DSD2DimensionList = new List<string>();
        DSD2AttributeList = new List<string>();
        DSD1DimensionList = new List<string>();
        DSD1AttributeList = new List<string>();

        ListOfMissingDimensions = new List<string>();
        ListOfMissingAttributes = new List<string>();
        UnMappedDSD2DimensionList = new List<string>();
        UnMappedDSD2AttributeList = new List<string>();

        string DSD1Dimension = string.Empty;
        string DSD2Dimension = string.Empty;
        string DSD1Attribute = string.Empty;
        string DSD2Attribute = string.Empty;
        string UnmatchedDimensionName = string.Empty;
        string UnmatchedAttributeName = string.Empty;

        string DSD1CodelistId = string.Empty;
        string DSD2CodelistId = string.Empty;

        try
        {
            DSD1Xml.Load(dsd1FileNameWPath);
            DSD2Xml.Load(dsd2FileNameWPath);

            SDMXObjectModel.Message.StructureType DSD1 = new SDMXObjectModel.Message.StructureType();
            SDMXObjectModel.Message.StructureType DSD2 = new SDMXObjectModel.Message.StructureType();
            SDMXObjectModel.Structure.DataStructureComponentsType DSD1DSComponents = new DataStructureComponentsType();
            SDMXObjectModel.Structure.DataStructureComponentsType DSD2DSComponents = new DataStructureComponentsType();

            CodelistType DSD1Codelist = new CodelistType();
            CodelistType DSD2Codelist = new CodelistType();

            DSD1 = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), DSD1Xml);
            DSD2 = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), DSD2Xml);

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

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

            DSD1Codelists = DSD1.Structures.Codelists;
            DSD2Codelists = DSD2.Structures.Codelists;

            // Binding DSD2 Dimension in a list - DSD2DimensionList

            for (i = 0; i < DSD2DSComponents.Items[0].Items.Count; i++)
            {

                if (DSD2DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.TimeDimensionType)
                {
                    TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSD2DSComponents.Items[0].Items[i]);
                    ConceptIdentity = TimeDimension.ConceptIdentity;

                }
                else
                {
                    Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD2DSComponents.Items[0].Items[i]);
                    ConceptIdentity = Dimension.ConceptIdentity;

                }
                DSD2DimensionList.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());

            }

            // Binding DSD2 Attributes in a list - DSD2AttributeList
            for (i = 0; i < DSD2DSComponents.Items[1].Items.Count; i++)
            {
                Attribute = (SDMXObjectModel.Structure.AttributeType)(DSD2DSComponents.Items[1].Items[i]);
                ConceptIdentity = Attribute.ConceptIdentity;
                DSD2AttributeList.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());

            }

            // Binding Matched Dimensions in a dictionary- dictMappedIndicators that exist in DSD1 as well as in DSD2

            for (i = 0; i < DSD1DSComponents.Items[0].Items.Count; i++)
            {

                if (DSD1DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.TimeDimensionType)
                {
                    TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSD1DSComponents.Items[0].Items[i]);
                    ConceptIdentity = TimeDimension.ConceptIdentity;

                }
                else
                {
                    Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD1DSComponents.Items[0].Items[i]);
                    ConceptIdentity = Dimension.ConceptIdentity;

                }
                DSD1Dimension = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                DSD1DimensionList.Add(DSD1Dimension);
                if ((DSD2DimensionList.Contains(DSD1Dimension)))
                {
                    dictMappedIndicators.Add(DSD1Dimension, DSD1Dimension);
                }

            }

            // Binding Matched Attributes in a dictionary- dictMappedAttributes that exist in DSD1 as well as in DSD2

            for (i = 0; i < DSD1DSComponents.Items[1].Items.Count; i++)
            {
                Attribute = (SDMXObjectModel.Structure.AttributeType)(DSD1DSComponents.Items[1].Items[i]);
                ConceptIdentity = Attribute.ConceptIdentity;

                DSD1Attribute = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                DSD1AttributeList.Add(DSD1Attribute);
                if ((DSD2AttributeList.Contains(DSD1Attribute)))
                {
                    dictMappedAttributes.Add(DSD1Attribute, DSD1Attribute);
                }

            }

            //Binding Comparison of the two DSDs - DSD1 and DSD2

            RetVal = new StringBuilder();
            RetVal.Append("<br/>");
            foreach (string Indicator in dictMappedIndicators.Keys)
            {
                DSD1CodelistId = string.Empty;
                for (i = 0; i < DSD1DSComponents.Items[0].Items.Count; i++)
                {

                    if (DSD1DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.DimensionType)
                    {
                        Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD1DSComponents.Items[0].Items[i]);
                        ConceptIdentity = Dimension.ConceptIdentity;
                        LocalRepresentation = Dimension.LocalRepresentation;
                        DSD1Dimension = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                        if (DSD1Dimension == Indicator)
                        {
                            DSD1CodelistId = ((CodelistRefType)((((CodelistReferenceType)(LocalRepresentation.Items[0])).Items[0]))).id;
                            break;
                        }

                    }

                }

                if (string.IsNullOrEmpty(DSD1CodelistId) == false)
                {
                    for (j = 0; j < DSD1Codelists.Count; j++)
                    {
                        if (DSD1CodelistId == DSD1Codelists[j].id)
                        {
                            DSD1Codelist = DSD1Codelists[j];
                            break;
                        }
                    }
                }

                for (i = 0; i < DSD2DSComponents.Items[0].Items.Count; i++)
                {
                    DSD2CodelistId = string.Empty;
                    if (DSD2DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.DimensionType)
                    {
                        Dimension = (SDMXObjectModel.Structure.DimensionType)(DSD2DSComponents.Items[0].Items[i]);
                        ConceptIdentity = Dimension.ConceptIdentity;
                        LocalRepresentation = Dimension.LocalRepresentation;
                        DSD2Dimension = ((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString();
                        if (DSD2Dimension == dictMappedIndicators[Indicator])
                        {
                            DSD2CodelistId = ((CodelistRefType)((((CodelistReferenceType)(LocalRepresentation.Items[0])).Items[0]))).id;
                            break;
                        }

                    }

                }
                if (string.IsNullOrEmpty(DSD2CodelistId) == false)
                {
                    for (j = 0; j < DSD2Codelists.Count; j++)
                    {
                        if (DSD2CodelistId == DSD2Codelists[j].id)
                        {
                            DSD2Codelist = DSD2Codelists[j];
                            break;
                        }
                    }
                }
                if ((DSD1CodelistId != string.Empty) && (DSD2CodelistId != string.Empty))
                {

                    if (DSD1Codelist.Items.Count > 0)
                    {
                        RetVal.Append("<a href=\"javascript:void(0);\" id=\"lnk_" + DSD1CodelistId + "\" ");
                    }
                    else
                    {
                        RetVal.Append("<a href=\"javascript:void(0);\" id=\"lnk_" + DSD2CodelistId + "\" ");
                    }

                    RetVal.Append(" onclick=\"ToggleExpandCollapse(event);\"");
                    RetVal.Append(" class=\"collapse\" style=\"padding-left:40px;\">" + DSD1CodelistId + "&nbsp;&nbsp;Vs&nbsp;&nbsp;" + DSD2CodelistId + "</a>");
                    RetVal.Append("<br/>");
                    RetVal.Append(BindCodesComparison(DSD1Codelist, DSD2Codelist, hlngcodedb, ComparisonType));
                    RetVal.Append("<br/>");

                }

            }

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

        }
        finally
        {

        }

        return RetVal.ToString();
    }
        private Dictionary<string, string> Check_DimensionsAttributesMeasure_Exist_In_MasterDSD(string dsdFileNameWPath, string devinfodsdFileNameWPath)
        {
            Dictionary<string, string> RetVal;
            List<string> UserDSDDimensionList, UserDSDAttributeList,UserDSDMeasureList;
            List<string> MasterDSDDimensionList, MasterDSDAttributeList,MasterDSDMeasureList;
            XmlDocument UserDSDXml,MasterDevInfoDSDXml;

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

            UserDSDXml = new XmlDocument();
            MasterDevInfoDSDXml = new XmlDocument();

            SDMXObjectModel.Message.StructureType UserDSD = new SDMXObjectModel.Message.StructureType();
            SDMXObjectModel.Message.StructureType MasterDevInfoDSD = new SDMXObjectModel.Message.StructureType();
            SDMXObjectModel.Structure.DataStructureComponentsType UserDSComponents = new DataStructureComponentsType();
            SDMXObjectModel.Structure.DataStructureComponentsType MasterDSComponents = new DataStructureComponentsType();

            UserDSDXml.Load(dsdFileNameWPath);
            UserDSD = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), UserDSDXml);

            MasterDevInfoDSDXml.Load(devinfodsdFileNameWPath);
            MasterDevInfoDSD = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), MasterDevInfoDSDXml);

            UserDSComponents = (SDMXObjectModel.Structure.DataStructureComponentsType)(UserDSD.Structures.DataStructures[0].Item);
            MasterDSComponents = (SDMXObjectModel.Structure.DataStructureComponentsType)(MasterDevInfoDSD.Structures.DataStructures[0].Item);

            UserDSDDimensionList = BindDimensionList(UserDSComponents);
            UserDSDAttributeList = BindAttributeList(UserDSComponents);
            UserDSDMeasureList = BindMeasureList(UserDSComponents);

            RetVal=Check_MandatoryDimensions_Exist_In_UserDSD(UserDSDDimensionList, UserDSDMeasureList);
            if (RetVal.Keys.Count == 0)
            {
                MasterDSDDimensionList = BindDimensionList(MasterDSComponents);
                MasterDSDAttributeList = BindAttributeList(MasterDSComponents);
                MasterDSDMeasureList = BindMeasureList(MasterDSComponents);

                //Comparison of Dimensions

                foreach (string Dimension in UserDSDDimensionList)
                {
                    if (!MasterDSDDimensionList.Contains(Dimension))
                    {
                        RetVal.Add(DSDValidationStatus.DSD_Dimensions_Invalid.ToString(), Constants.ValidationMessages.Invalid_Dimension + Dimension);
                        break;
                    }

                }

                //Comparison of Attributes

                foreach (string Attribute in UserDSDAttributeList)
                {
                    if (!MasterDSDAttributeList.Contains(Attribute))
                    {
                        RetVal.Add(DSDValidationStatus.DSD_Attribute_Invalid.ToString(), Constants.ValidationMessages.Invalid_Attribute + Attribute);
                        break;
                    }

                }

                //Comparison of Measure

                foreach (string Measure in UserDSDMeasureList)
                {
                    if (!MasterDSDMeasureList.Contains(Measure))
                    {
                        RetVal.Add(DSDValidationStatus.DSD_Primary_Measure_Invalid.ToString(), Constants.ValidationMessages.Invalid_Primary_Measure + Measure);
                        break;
                    }

                }

            }

            return RetVal;
        }
        private List<string> BindMeasureList(DataStructureComponentsType DSComponents)
        {
            List<string> RetVal;
            int i;
            SDMXObjectModel.Structure.PrimaryMeasureType PrimaryMeasure;
            SDMXObjectModel.Common.ConceptReferenceType ConceptIdentity;

            RetVal = new List<string>();
            for (i = 0; i < DSComponents.Items[2].Items.Count; i++)
            {
                if (DSComponents.Items[2].Items[i] is SDMXObjectModel.Structure.PrimaryMeasureType)
                {
                    PrimaryMeasure = (SDMXObjectModel.Structure.PrimaryMeasureType)(DSComponents.Items[2].Items[i]);
                    ConceptIdentity = PrimaryMeasure.ConceptIdentity;
                    RetVal.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());
                }

            }

            return RetVal;
        }
        private List<string> BindDimensionList(DataStructureComponentsType DSComponents)
        {
            List<string> RetVal;
            int i;
            SDMXObjectModel.Structure.DimensionType Dimension;
            SDMXObjectModel.Structure.TimeDimensionType TimeDimension;
            SDMXObjectModel.Common.ConceptReferenceType ConceptIdentity;

            RetVal = new List<string>();
            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]);
                    ConceptIdentity = Dimension.ConceptIdentity;
                    RetVal.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());
                }
                else
                {

                    TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSComponents.Items[0].Items[i]);
                    ConceptIdentity = TimeDimension.ConceptIdentity;
                    RetVal.Add(((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString());
                }

            }

            return RetVal;
        }
Esempio n. 10
0
    private string BindMSDAttributes_For_MSD_2_1(string DBNId, string MSDId, string lngcodedb)
    {
        string RetVal = string.Empty;
        string ConceptName = string.Empty;
        string ConceptDescription = string.Empty;
        string CategorySchemeName = string.Empty;
        string CategorySchemeDescription = string.Empty;
        string CodelistName = string.Empty;
        string CodelistDescription = string.Empty;
        string ObjectType = string.Empty;
        XmlDocument MSDXml;
        XmlDocument SummaryXml;
        StringBuilder sb;
        StringBuilder sbChild;
        int i, j, k;
        SDMXObjectModel.Structure.MetadataAttributeType MetadataAttribute;
        SDMXObjectModel.Structure.IdentifiableObjectTargetType IdentifiableObjectTarget;
        SDMXObjectModel.Structure.IdentifiableObjectRepresentationType LocalRepresentation;
        SDMXObjectModel.Common.ItemSchemeReferenceType Enumeration;
        SDMXObjectModel.Structure.MetadataTargetType MetadataTarget;
        SDMXObjectModel.Structure.ReportStructureType ReportStructure;
        SDMXObjectModel.Common.ConceptReferenceType ConceptReference;
        SDMXObjectModel.Common.ConceptRefType ConceptRef;

        try
        {
            string MSDPath = "";
            string MSDViewPath = "";
            string MFDPath = "";
            string MFDViewPath = "";
            string ConceptSchemePath = "";
            string ConceptSchemeViewPath = "";
            string MFDId = "";
            string ConceptSchemeId = "";

            MSDPath = Server.MapPath(System.IO.Path.Combine("~", @"stock\\data\\" + DBNId + "\\sdmx\\MSD\\" + MSDId + ".xml"));
            MSDViewPath = "../../stock/data/" + DBNId + "/sdmx/MSD/" + MSDId + ".xml";
            MSDXml = new XmlDocument();
            MSDXml.Load(MSDPath);

            MFDId = MSDId.Replace("MSD", "MFD");
            MFDPath = Server.MapPath(System.IO.Path.Combine("~", @"stock\\data\\" + DBNId + "\\sdmx\\Provisioning Metadata\\" + MFDId + ".xml"));
            MFDViewPath = "../../stock/data/" + DBNId + "/sdmx/Provisioning Metadata/" + MFDId + ".xml";

            ConceptSchemeId = MSDId + "_Concepts";
            ConceptSchemePath = Server.MapPath(System.IO.Path.Combine("~", @"stock\\data\\" + DBNId + "\\sdmx\\Concepts\\" + ConceptSchemeId + ".xml"));
            ConceptSchemeViewPath = "../../stock/data/" + DBNId + "/sdmx/Concepts/" + ConceptSchemeId + ".xml";

            SummaryXml = new XmlDocument();

            SDMXObjectModel.Structure.StructuresType ConceptsObj;

            SDMXObjectModel.Structure.DataStructureComponentsType DSComponents = new DataStructureComponentsType();

            SDMXObjectModel.Message.StructureType SummaryStructure = new SDMXObjectModel.Message.StructureType();
            SummaryXml.Load(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, Constants.FolderName.Data + DBNId + "\\sdmx\\Summary" + DevInfo.Lib.DI_LibSDMX.Constants.XmlExtension));
            SummaryStructure = (SDMXObjectModel.Message.StructureType)SDMXObjectModel.Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), SummaryXml);

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

            SDMXObjectModel.Message.StructureType MSDStructure = new SDMXObjectModel.Message.StructureType();
            MSDStructure = (SDMXObjectModel.Message.StructureType)Deserializer.LoadFromXmlDocument(typeof(SDMXObjectModel.Message.StructureType), MSDXml);
            MetadataTarget = new MetadataTargetType();
            MetadataTarget = (MetadataTargetType)(((SDMXObjectModel.Structure.MetadataStructureComponentsType)MSDStructure.Structures.MetadataStructures[0].Item).Items[0]);
            ReportStructure = new SDMXObjectModel.Structure.ReportStructureType();
            ReportStructure = (SDMXObjectModel.Structure.ReportStructureType)(((SDMXObjectModel.Structure.MetadataStructureComponentsType)MSDStructure.Structures.MetadataStructures[0].Item).Items[1]);
            IdentifiableObjectTarget = ((SDMXObjectModel.Structure.IdentifiableObjectTargetType)(MetadataTarget.Items[0]));
            LocalRepresentation = ((SDMXObjectModel.Structure.IdentifiableObjectRepresentationType)(IdentifiableObjectTarget.LocalRepresentation));
            Enumeration = ((SDMXObjectModel.Common.ItemSchemeReferenceType)(LocalRepresentation.Items[0]));

            sb = new StringBuilder();
            //sb.Append("<div>");
            //sb.Append("<img id=\"imgdivCS\" src=\"../../stock/themes/default/images/expand.png\" alt=\"Expand and Collapse\" onclick=\"ExpandCollapseList('imgdivCS','divCS')\" style=\"margin-top: 10px;margin-right: 4px\" class=\"flt_lft\"/>");
            //sb.Append("<h3 id=\"lang_Concept_Scheme_MSD\" class=\"flt_lft\"></h3>");
            //sb.Append("&nbsp;<img id=\"imghelpConceptScheme\" src=\"../../stock/themes/default/images/help.gif\" alt=\"Help\"  onclick=\"ToggleCallout('divCallout', event,  'divHelpCS')\" style=\"margin-top:10px;cursor:pointer;\" onmouseout=\"HideCallout('divCallout')\";/>");
            //sb.Append("</div>");
            //sb.Append("<br/>");
            //sb.Append("<div id=\"divCS\" style=\"display:none\">");
            //for (i = 0; i < SummaryStructure.Structures.Concepts.Count; i++)
            //{
            //    if (SummaryStructure.Structures.Concepts[i].id == ConceptSchemeId)
            //    {
            //        sb.Append("<div class=\"reg_li_sub_txt\">");
            //        sb.Append("<b>");
            //        sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Name, lngcodedb));
            //        sb.Append("</b>");
            //        sb.Append("<span class=\"reg_li_brac_txt\">(");
            //        sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Description, lngcodedb));
            //        sb.Append(")</span> ");
            //        sb.Append("</div>");
            //        sb.Append("<div>");
            //        sb.Append("<a href=\" " + ConceptSchemeViewPath + "\"  ");
            //        sb.Append(" target=\"_blank\" class=\"reg_li_link_txt\" name=\"lang_View\"></a> | ");
            //        sb.Append("<a href='Download.aspx?fileId=" + ConceptSchemePath + "' class=\"reg_li_link_txt\" name=\"lang_Download\"></a>");
            //        sb.Append("</div>");
            //        sb.Append("<br/>");
            //        sb.Append("<ul>");
            //        for (j = 0; j < SummaryStructure.Structures.Concepts[i].Items.Count; j++)
            //        {
            //            sb.Append("<li>");

            //            sb.Append("<span>");
            //            sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Items[j].Name, lngcodedb));
            //            sb.Append("</span>");
            //            if (!string.IsNullOrEmpty(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Items[j].Description, lngcodedb)))
            //            {
            //                sb.Append("<span class=\"reg_li_brac_txt\">(");
            //                sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Items[j].Description, lngcodedb));
            //                sb.Append(")</span>");
            //            }
            //            sb.Append("</li>");

            //        }
            //        sb.Append("</ul>");
            //        break;
            //    }
            //}
            //sb.Append("</div>");
            sb.Append("<div>");
            sb.Append("<img id=\"imgdivMSD\" src=\"../../stock/themes/default/images/expand.png\" alt=\"Expand and Collapse\" onclick=\"ExpandCollapseList('imgdivMSD','divMSD')\" style=\"margin-top: 10px;margin-right: 4px\" class=\"flt_lft\"/>");
            sb.Append("<h3 id=\"lang_Metadata_Structure_Definition\" class=\"flt_lft\"></h3>");
            sb.Append("&nbsp;<img id=\"imghelpMSD\" src=\"../../stock/themes/default/images/help.gif\" alt=\"Help\" onclick=\"ToggleCallout('divCallout', event, 'divHelpMSD')\" style=\"margin-top:10px;cursor:pointer;\" onmouseout=\"HideCallout('divCallout')\";/>");
            sb.Append("</div>");
            sb.Append("<br/>");
            sb.Append("<div id=\"divMSD\" style=\"display:none\">");
            sb.Append("<div class=\"reg_li_sub_txt\">");
            sb.Append("<b>");
            sb.Append(GetLangSpecificValue_For_Version_2_1(MSDStructure.Structures.MetadataStructures[0].Name, lngcodedb));
            sb.Append("</b>");
            sb.Append("<span class=\"reg_li_brac_txt\">(");
            sb.Append(GetLangSpecificValue_For_Version_2_1(MSDStructure.Structures.MetadataStructures[0].Description, lngcodedb));
            sb.Append(")</span> ");
            sb.Append("</div>");
            sb.Append("<div>");
            sb.Append("<a href=\" " + MSDViewPath + "\"  ");
            sb.Append(" target=\"_blank\" class=\"reg_li_link_txt\" name=\"lang_View\"></a> | ");
            sb.Append("<a href='Download.aspx?fileId=" + MSDPath + "' class=\"reg_li_link_txt\" name=\"lang_Download\"></a>");
            sb.Append("</div>");
            sb.Append("<br/>");
            sb.Append("<h4 id=\"lang_Target\"></h4>");
            if (((SDMXObjectModel.Common.ItemSchemeRefType)(Enumeration.Items[0])).@class == ObjectTypeCodelistType.Codelist)
            {
                for (i = 0; i < SummaryStructure.Structures.Codelists.Count; i++)
                {
                    if (((SDMXObjectModel.Common.ItemSchemeRefType)(Enumeration.Items[0])).id == SummaryStructure.Structures.Codelists[i].id)
                    {
                        sb.Append("<div id=\"divTarget\" class=\"reg_li_sub_txt\">");
                        sb.Append("<ul class=\"reg_nonlst_txt\"><li>");
                        CodelistName = GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Codelists[i].Name, lngcodedb).ToUpper();
                        CodelistDescription = GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Codelists[i].Description, lngcodedb);
                        if (CodelistName != string.Empty)
                        {
                            sb.Append(CodelistName);
                        }
                        if (CodelistDescription != string.Empty)
                        {
                            sb.Append("<span class=\"reg_li_brac_txt\" >(");
                            sb.Append(CodelistDescription);
                            sb.Append(")</span>");
                        }
                        sb.Append("  -  ");
                        sb.Append("<span id=\"lang_Object_Type" + i + "\" ></span>");
                        sb.Append(IdentifiableObjectTarget.objectType.ToString());
                        sb.Append("</li>");
                        sb.Append("</ul>");
                        sb.Append("</div>");
                        break;
                    }
                }
            }
            else if (((SDMXObjectModel.Common.ItemSchemeRefType)(Enumeration.Items[0])).@class == ObjectTypeCodelistType.CategoryScheme)
            {
                for (i = 0; i < SummaryStructure.Structures.CategorySchemes.Count; i++)
                {
                    if (((SDMXObjectModel.Common.ItemSchemeRefType)(Enumeration.Items[0])).id == SummaryStructure.Structures.CategorySchemes[i].id)
                    {
                        sb.Append("<div id=\"divTarget\">");
                        sb.Append("<ul class=\"reg_nonlst_txt\"><li>");
                        CategorySchemeName = GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.CategorySchemes[i].Name, lngcodedb).ToUpper();
                        CategorySchemeDescription = GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.CategorySchemes[i].Description, lngcodedb);
                        if (CategorySchemeName != string.Empty)
                        {
                            sb.Append(CategorySchemeName);
                        }
                        if (CategorySchemeDescription != string.Empty)
                        {
                            sb.Append("<span class=\"reg_li_brac_txt\">(");
                            sb.Append(CategorySchemeDescription);
                            sb.Append(")</span>");
                        }

                        sb.Append("  -  ");
                        sb.Append("<span id=\"lang_Object_Type" + i + "\" ></span>");
                        sb.Append(IdentifiableObjectTarget.objectType.ToString());
                        sb.Append("</li>");
                        sb.Append("</ul>");
                        sb.Append("</div>");
                        break;
                    }
                }
            }

            sb.Append("<h4 id=\"lang_Report_Structure\"></h4>");
            sb.Append("<ul id=\"ulRS\">");
            for (i = 0; i < ReportStructure.Items.Count; i++)
            {
                sb.Append("<li>");
                MetadataAttribute = ((SDMXObjectModel.Structure.MetadataAttributeType)(ReportStructure.Items[i]));
                ConceptReference = MetadataAttribute.ConceptIdentity;
                ConceptRef = ((ConceptRefType)(ConceptReference.Items[0]));
                for (j = 0; j < ConceptsObj.Concepts.Count; j++)
                {
                    if (ConceptRef.maintainableParentID == ConceptsObj.Concepts[j].id)
                    {
                        ConceptSchemeId = ConceptRef.maintainableParentID;
                        for (k = 0; k < ConceptsObj.Concepts[j].Items.Count; k++)
                        {
                            if (ConceptRef.id.ToString() == ConceptsObj.Concepts[j].Items[k].id.ToString())
                            {
                                ConceptName = GetLangSpecificValue_For_Version_2_1(ConceptsObj.Concepts[j].Items[k].Name, lngcodedb).ToUpper();
                                ConceptDescription = GetLangSpecificValue_For_Version_2_1(ConceptsObj.Concepts[j].Items[k].Description, lngcodedb);
                                if (ConceptName != string.Empty)
                                {
                                    sb.Append(ConceptName);
                                }
                                if (ConceptDescription != string.Empty)
                                {
                                    sb.Append("<span class=\"reg_li_brac_txt\">(");
                                    sb.Append(ConceptDescription);
                                    sb.Append(")</span> ");
                                }
                                break;
                            }
                        }
                    }
                }
                sb.Append("<div class=\"reg_li_sub_txt\">");
                sb.Append("<span id=\"lang_Presentational" + i + "\" ></span>");
                if (MetadataAttribute.isPresentational == true)
                {
                    sb.Append("<span id=\"lang_Yes" + i + "\" ></span>");
                }
                else
                {
                    sb.Append("<span id=\"lang_No" + i + "\" ></span>");
                }
                sb.Append("</div>");
                sbChild = new StringBuilder();
                sb.Append(BindChildMetadatAttributes_For_Version_2_1(sbChild, MetadataAttribute, ConceptsObj, lngcodedb));
                sb.Append("</li>");
            }
            sb.Append("</ul>");
            sb.Append("</div>");
            sb.Append("<div>");
            sb.Append("<img id=\"imgdivMFD\" src=\"../../stock/themes/default/images/expand.png\" alt=\"Expand and Collapse\" onclick=\"ExpandCollapseList('imgdivMFD','divMFD')\" style=\"margin-top: 10px;margin-right: 4px\" class=\"flt_lft\"/>");
            sb.Append("<h3 id=\"lang_Metadata_Flow_Definition\" class=\"flt_lft\"></h3>");
            sb.Append("&nbsp;<img id=\"imghelpMFD\" src=\"../../stock/themes/default/images/help.gif\" alt=\"Help\"  onclick=\"ToggleCallout('divCallout', event,  'divHelpMFD')\" style=\"margin-top:10px;cursor:pointer;\" onmouseout=\"HideCallout('divCallout')\";/>");
            sb.Append("</div>");
            sb.Append("<br/>");
            sb.Append("<div id=\"divMFD\" style=\"display:none\">");
            for (i = 0; i < SummaryStructure.Structures.Metadataflows.Count; i++)
            {
                if (MSDStructure.Structures.MetadataStructures[0].id == ((SDMXObjectModel.Common.MetadataStructureRefType)(SummaryStructure.Structures.Metadataflows[i].Structure.Items[0])).id)
                {
                    sb.Append("<div class=\"reg_li_sub_txt\">");
                    sb.Append("<b>");
                    sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Metadataflows[i].Name, lngcodedb));
                    sb.Append("</b>");
                    sb.Append("<span class=\"reg_li_brac_txt\">(");
                    sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Metadataflows[i].Description, lngcodedb));
                    sb.Append(")</span> ");
                    sb.Append("</div>");
                    sb.Append("<div>");
                    sb.Append("<a href=\" " + MFDViewPath + "\"  ");
                    sb.Append(" target=\"_blank\" class=\"reg_li_link_txt\" name=\"lang_View\"></a> | ");
                    sb.Append("<a href='Download.aspx?fileId=" + MFDPath + "' class=\"reg_li_link_txt\" name=\"lang_Download\"></a>");
                    sb.Append("</div>");

                    break;
                }

            }
            //lang_Concept_Scheme changed to lang_Concept_Scheme_MSD
            sb.Append("</div>");
            sb.Append("<div>");
            sb.Append("<img id=\"imgdivCS\" src=\"../../stock/themes/default/images/expand.png\" alt=\"Expand and Collapse\" onclick=\"ExpandCollapseList('imgdivCS','divCS')\" style=\"margin-top: 10px;margin-right: 4px\" class=\"flt_lft\"/>");
            sb.Append("<h3 id=\"lang_Concept_Scheme_MSD\" class=\"flt_lft\"></h3>");
            sb.Append("&nbsp;<img id=\"imghelpConceptScheme\" src=\"../../stock/themes/default/images/help.gif\" alt=\"Help\"  onclick=\"ToggleCallout('divCallout', event,  'divHelpCS')\" style=\"margin-top:10px;cursor:pointer;\" onmouseout=\"HideCallout('divCallout')\";/>");
            sb.Append("</div>");
            sb.Append("<br/>");
            sb.Append("<div id=\"divCS\" style=\"display:none\">");
            for (i = 0; i < SummaryStructure.Structures.Concepts.Count; i++)
            {
                if (SummaryStructure.Structures.Concepts[i].id == ConceptSchemeId)
                {
                    sb.Append("<div class=\"reg_li_sub_txt\">");
                    sb.Append("<b>");
                    sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Name, lngcodedb));
                    sb.Append("</b>");
                    sb.Append("<span class=\"reg_li_brac_txt\">(");
                    sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Description, lngcodedb));
                    sb.Append(")</span> ");
                    sb.Append("</div>");
                    sb.Append("<div>");
                    sb.Append("<a href=\" " + ConceptSchemeViewPath + "\"  ");
                    sb.Append(" target=\"_blank\" class=\"reg_li_link_txt\" name=\"lang_View\"></a> | ");
                    sb.Append("<a href='Download.aspx?fileId=" + ConceptSchemePath + "' class=\"reg_li_link_txt\" name=\"lang_Download\"></a>");
                    sb.Append("</div>");
                    sb.Append("<br/>");
                    sb.Append("<ul>");
                    for (j = 0; j < SummaryStructure.Structures.Concepts[i].Items.Count; j++)
                    {
                        sb.Append("<li>");

                        sb.Append("<span>");
                        sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Items[j].Name, lngcodedb));
                        sb.Append("</span>");
                        if (!string.IsNullOrEmpty(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Items[j].Description, lngcodedb)))
                        {
                            sb.Append("<span class=\"reg_li_brac_txt\">(");
                            sb.Append(GetLangSpecificValue_For_Version_2_1(SummaryStructure.Structures.Concepts[i].Items[j].Description, lngcodedb));
                            sb.Append(")</span>");
                        }
                        sb.Append("</li>");

                    }
                    sb.Append("</ul>");
                    break;
                }
            }
            sb.Append("<div id=\"divMFD\">");
            RetVal = sb.ToString();

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

        return RetVal;
    }
Esempio n. 11
0
        private DIExcel GenerateDSDWorksheet(DIExcel ReportExcel, int SheetIndex, SDMXObjectModel.Message.StructureType CompleteStructure)
        {
            int i, j, k;
            SDMXObjectModel.Structure.DataStructureComponentsType DSComponents;
            IWorksheet DSDWorkSheet = null;
            SDMXObjectModel.Structure.MeasureListType MeasureList;
            SDMXObjectModel.Structure.DimensionType Dimension;
            SDMXObjectModel.Structure.TimeDimensionType TimeDimension;
            SDMXObjectModel.Structure.AttributeType Attribute;
            SDMXObjectModel.Common.ConceptReferenceType ConceptIdentity;
            SDMXObjectModel.Structure.AttributeRelationshipType AttributeRelationship;
            SDMXObjectModel.Common.LocalPrimaryMeasureReferenceType LocalPrimaryMeasureReference;
            SDMXObjectModel.Structure.PrimaryMeasureType PrimaryMeasure;
            string AttributeImportance = string.Empty;

            SDMXObjectModel.Structure.StructuresType ConceptsObj;
            int rowindex = 0;

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

                DSDWorkSheet = ReportExcel.GetWorksheet(0);
                ReportExcel.RenameWorkSheet(0, "DSD");
                rowindex = rowindex + 1;
                this.WriteValueInCell(ReportExcel, "Data Structure Definition", rowindex, 1, 14, true, 30, 0, 0);
                rowindex = rowindex + 2;
                //Binding Dimensions
                this.WriteValueInCell(ReportExcel, "Dimensions", rowindex, 1, 12, true, 30, 0, 0);
                rowindex = rowindex + 2;
                for (i = 0; i < DSComponents.Items[0].Items.Count; i++)
                {

                    if (DSComponents.Items[0].Items[i] is SDMXObjectModel.Structure.TimeDimensionType)
                    {
                        TimeDimension = (SDMXObjectModel.Structure.TimeDimensionType)(DSComponents.Items[0].Items[i]);
                        ConceptIdentity = TimeDimension.ConceptIdentity;
                    }
                    else
                    {
                        Dimension = (SDMXObjectModel.Structure.DimensionType)(DSComponents.Items[0].Items[i]);
                        ConceptIdentity = Dimension.ConceptIdentity;
                    }

                    for (j = 0; j < ConceptsObj.Concepts.Count; j++)
                        if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).maintainableParentID.ToString() == ConceptsObj.Concepts[j].id.ToString())
                        {

                            for (k = 0; k < ConceptsObj.Concepts[j].Items.Count; k++)
                            {
                                if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString() == ConceptsObj.Concepts[j].Items[k].id.ToString())
                                {
                                    this.WriteValueInCell(ReportExcel, GetLangSpecificValue(ConceptsObj.Concepts[j].Items[k].Name, this.Language), rowindex, 1, 10, false, 30, 0, 0);
                                    this.WriteValueInCell(ReportExcel, GetLangSpecificValue(ConceptsObj.Concepts[j].Items[k].Description, this.Language), rowindex, 2, 10, false, 250, 0, 0);
                                    rowindex = rowindex + 1;

                                    break;
                                }
                            }

                        }
                }

                rowindex = rowindex + 2;
                //Binding Attributes
                this.WriteValueInCell(ReportExcel, "Attributes", rowindex, 1, 12, true, 30, 0, 0);

                rowindex = rowindex + 2;
                for (i = 0; i < DSComponents.Items[1].Items.Count; i++)
                {
                    Attribute = (SDMXObjectModel.Structure.AttributeType)(DSComponents.Items[1].Items[i]);
                    ConceptIdentity = Attribute.ConceptIdentity;
                    AttributeRelationship = Attribute.AttributeRelationship;
                    LocalPrimaryMeasureReference = (SDMXObjectModel.Common.LocalPrimaryMeasureReferenceType)(AttributeRelationship.Items[0]);
                    for (j = 0; j < ConceptsObj.Concepts.Count; j++)
                    {
                        if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).maintainableParentID.ToString() == ConceptsObj.Concepts[j].id.ToString())
                        {

                            for (k = 0; k < ConceptsObj.Concepts[j].Items.Count; k++)
                            {
                                if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString() == ConceptsObj.Concepts[j].Items[k].id.ToString())
                                {
                                    this.WriteValueInCell(ReportExcel, GetLangSpecificValue(ConceptsObj.Concepts[j].Items[k].Name, this.Language), rowindex, 1, 10, false, 30, 0, 0);
                                    this.WriteValueInCell(ReportExcel, GetLangSpecificValue(ConceptsObj.Concepts[j].Items[k].Description, this.Language), rowindex, 2, 10, false, 250, 0, 0);
                                    rowindex = rowindex + 1;

                                    this.WriteValueInCell(ReportExcel, "Attachment Level : " + ((SDMXObjectModel.Common.LocalPrimaryMeasureRefType)(LocalPrimaryMeasureReference.Items[0])).id.ToString(), rowindex, 1, 10, false, 30, 0, 0);

                                    if (((UsageStatusType)(Attribute.assignmentStatus)) == UsageStatusType.Mandatory)
                                    {
                                        AttributeImportance = "Mandatory : " + "Yes";
                                    }
                                    else
                                    {
                                        AttributeImportance = "Mandatory : " + "No";
                                    }
                                    this.WriteValueInCell(ReportExcel, AttributeImportance, rowindex, 2, 10, false, 30, 0, 0);
                                    rowindex = rowindex + 2;

                                    break;
                                }
                            }

                        }
                    }

                }

                rowindex = rowindex + 1;

                //Binding Measure
                this.WriteValueInCell(ReportExcel, "Measure", rowindex, 1, 12, true, 30, 0, 0);

                rowindex = rowindex + 1;

                MeasureList = ((SDMXObjectModel.Structure.MeasureListType)((SDMXObjectModel.Structure.DataStructureComponentsType)(DSComponents)).MeasureList);

                for (i = 0; i < DSComponents.Items[2].Items.Count; i++)
                {

                    PrimaryMeasure = (SDMXObjectModel.Structure.PrimaryMeasureType)(DSComponents.Items[2].Items[i]);
                    ConceptIdentity = PrimaryMeasure.ConceptIdentity;
                    for (j = 0; j < ConceptsObj.Concepts.Count; j++)
                    {
                        if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).maintainableParentID.ToString() == ConceptsObj.Concepts[j].id.ToString())
                        {

                            for (k = 0; k < ConceptsObj.Concepts[j].Items.Count; k++)
                            {
                                if (((SDMXObjectModel.Common.ConceptRefType)(ConceptIdentity.Items[0])).id.ToString() == ConceptsObj.Concepts[j].Items[k].id.ToString())
                                {
                                    this.WriteValueInCell(ReportExcel, GetLangSpecificValue(ConceptsObj.Concepts[j].Items[k].Name, this.Language), rowindex, 1, 10, false, 30, 0, 0);
                                    this.WriteValueInCell(ReportExcel, GetLangSpecificValue(ConceptsObj.Concepts[j].Items[k].Description, this.Language), rowindex, 2, 10, false, 250, 0, 0);
                                    rowindex = rowindex + 1;

                                    break;
                                }
                            }

                        }

                    }

                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return ReportExcel;
        }