Example #1
0
        public async Task <List <RegionSeries> > GetAllLocalEmployment(int yearStart, int yearEnd)
        {
            List <State> allStates    = States.AllStatesAndTerritoriesLA();
            var          seriesResult = await GetLocalUnemployment(allStates, yearStart, yearEnd);

            List <RegionSeries> returnSeries             = new List <RegionSeries>();
            Dictionary <string, RegionSeries> sortSeries = new Dictionary <string, RegionSeries>();
            LocalUnemploymentParser           lup        = new LocalUnemploymentParser();

            foreach (Series s in seriesResult)
            {
                BlsSeries newSeries = new BlsSeries(s);
                newSeries.Params = lup.ParseSeriesID(newSeries.seriesID);
                string regionString = States.Dictionary[newSeries.Params.Region].Description;
                if (!sortSeries.ContainsKey(regionString))
                {
                    sortSeries[regionString] = new RegionSeries()
                    {
                        RegionName = regionString
                    };
                }

                if (newSeries.Params.Measure == EmploymentMeasure.Employment)
                {
                    sortSeries[regionString].Employment = newSeries;
                }
                else if (newSeries.Params.Measure == EmploymentMeasure.Unemployment)
                {
                    sortSeries[regionString].Unemployment = newSeries;
                }
                else if (newSeries.Params.Measure == EmploymentMeasure.UnemploymentRate)
                {
                    sortSeries[regionString].UnemploymentRate = newSeries;
                }
                else if (newSeries.Params.Measure == EmploymentMeasure.LaborForce)
                {
                    sortSeries[regionString].LaborForce = newSeries;
                }
            }

            foreach (KeyValuePair <string, RegionSeries> kvp in sortSeries)
            {
                returnSeries.Add(kvp.Value);
            }

            var sortedSeries = from series in returnSeries
                               orderby series.RegionName ascending
                               select series;

            return(sortedSeries.ToList());
        }
Example #2
0
        public static List <List <string> > GetRowHeaders(BlsSeries bs, List <List <string> > outputFile)
        {
            if (outputFile.Count < 2)
            {
                foreach (BLSDataPoint data in bs.data)
                {
                    List <string> row = new List <string>();
                    row.Add(data.period.Substring(1, 2) + "/" + data.year);
                    outputFile.Add(row);
                }
            }

            return(outputFile);
        }