예제 #1
0
        private static void addIndicators(DbConnection conn, Provider p, IEnumerable<ExtendedSubTheme> subthemes, INEService.Statistics ine)
        {
            Console.WriteLine(":::::::::: Adding indicatores :::::::::");

            var indicatorDAO = new IndicatorDAO(conn);

            foreach (var subtheme in subthemes)
            {
                INEService.IndicatorPlus indicators = ine.GetIndicatorsByTheme(GEOVERSION, subtheme.SourceThemeCode, LANGUAGE, 2, 1, 10000);
                foreach (var indicator in indicators.Indicators)
                {
                    Console.WriteLine("... Adding indicator: {0} ....", subtheme.NameAbbr);

                    Indicator convertedIndicator = new Indicator
                    {
                        Name = indicator.Designation,
                        NameAbbr = indicator.Abbreviation,
                        Provider = p,
                        SourceID = indicator.Code,
                        SubThemeID = subtheme.ID,
                        ThemeID = subtheme.ThemeID
                    };
                    convertedIndicator.ID = indicatorDAO.AddIndicator(convertedIndicator);

                    addConfiguration(conn, convertedIndicator, indicator.GeoLevelCode);
                }
            }
        }
        private IEnumerable<DimensionFilter> GetDimensionFilters(INEService.IndicatorValue value, IEnumerable<DimensionFilter> projectedDimensions, Evaluate eval)
        {
            foreach (var d in value.Dimensions)
            {
                DimensionFilter filter = projectedDimensions.Where(proj => d.Order.ToString() == proj.DimensionID).FirstOrDefault();
                if (eval(filter)) yield return d.ToDimensionFilter();
            }

            yield break;
        }
예제 #3
0
        static IEnumerable<ExtendedSubTheme> AddThemes(DbConnection conn, Provider p, INEService.Statistics ine)
        {
            Console.WriteLine(":::::::::: Adding themes :::::::::");

            var themesDAO = new ThemesDAO(conn);

            var insertedThemes = new List<ExtendedTheme>();
            var insertedSubThemes = new List<ExtendedSubTheme>();

            INEService.Theme[] themes = ine.GetThemes(GEOVERSION, 2, LANGUAGE, 1, 100000);
            var filteredThemes = themes.Where(t => t.ThemeLevel == 2);
            foreach (var theme in filteredThemes)
            {
                Console.WriteLine("... Adding theme: {0} ....", theme.Designation);

                ExtendedTheme t = new ExtendedTheme
                {
                    Name = theme.Designation,
                    NameAbbr = theme.Designation,
                    ProviderID = p.ID,
                    SourceThemeCode = theme.Code
                };
                t.ID = themesDAO.AddTheme(t);

                insertedThemes.Add(t);
            }

            // subthemes
            var filteredSubThemes = themes.Where(t => t.ThemeLevel == 3);
            foreach (var subtheme in filteredSubThemes)
            {
                Console.WriteLine("... Adding subtheme: {0} ....", subtheme.Designation);

                ExtendedSubTheme sub = new ExtendedSubTheme
                {
                    Name = subtheme.Designation,
                    NameAbbr = subtheme.Designation,
                    ProviderID = p.ID,
                    ThemeID = insertedThemes.Where(it => it.SourceThemeCode == subtheme.ParentCode).First().ID,
                    SourceThemeCode = subtheme.Code
                };

                sub.ID = themesDAO.AddSubTheme(sub);
                insertedSubThemes.Add(sub);
            }

            return insertedSubThemes;
        }
예제 #4
0
 public static void SetGeographicLevel(INEService.DimensionFilter geoDimensionFilter, String geolevel)
 {
     GeographicLevels level = (GeographicLevels)Enum.Parse(typeof(GeographicLevels), geolevel, true);
     geoDimensionFilter.AllFromLevel = (int)level;
     geoDimensionFilter.Codes = null;
 }