private static ICodelistMutableObject BuildMutable(int size) { var codelist = new CodelistMutableCore() { Id = "TEST", AgencyId = "TEST_AGENCY", Version = "1.0" }; codelist.AddName("en", "Test name"); string lastCode = null; for (int i = 0; i < size; i++) { string codeId = string.Format(CultureInfo.InvariantCulture, "ID{0}", i); var code = codelist.CreateItem(codeId, codeId); if (lastCode != null && (i % 2) == 0) { code.ParentCode = lastCode; } if ((i % 6) == 0) { lastCode = codeId; } } return codelist; }
/// <summary> /// The build indicator codelist. /// </summary> /// <returns> /// The <see cref="ICodelistObject"/>. /// </returns> public ICodelistObject BuildIndicatorCodelist() { ICodelistMutableObject codelistMutable = new CodelistMutableCore(); codelistMutable.AgencyId = "SDMXSOURCE"; codelistMutable.Id = "CL_INDICATOR"; codelistMutable.Version = "1.0"; codelistMutable.AddName("en", "World Developement Indicators"); ICodeMutableObject code; codelistMutable.CreateItem("E", "Environment"); code = codelistMutable.CreateItem("E_A", "Agriculture land"); code.ParentCode = "E"; code = codelistMutable.CreateItem("E_P", "Population"); code.ParentCode = "E"; codelistMutable.CreateItem("H", "HEALTH"); code = codelistMutable.CreateItem("H_B", "Birth Rate"); code.ParentCode = "H"; code = codelistMutable.CreateItem("H_C", "Children (0-14) living with HIV"); code.ParentCode = "H"; return codelistMutable.ImmutableInstance; }
/// <summary> /// Builds the country codelist. /// </summary> /// <returns> /// The <see cref="ICodelistObject" />. /// </returns> public ICodelistObject BuildCountryCodelist() { ICodelistMutableObject codelistMutable = new CodelistMutableCore(); codelistMutable.AgencyId = "SDMXSOURCE"; codelistMutable.Id = "CL_COUNTRY"; codelistMutable.Version = "1.0"; codelistMutable.AddName("en", "Country"); codelistMutable.CreateItem("UK", "United Kingdom"); codelistMutable.CreateItem("FR", "France"); codelistMutable.CreateItem("DE", "Germany"); return codelistMutable.ImmutableInstance; }