/// <summary> /// Converts map class to string for csv /// </summary> /// <param name="sb"></param> /// <param name="map"></param> /// <returns></returns> private StringBuilder OutputMap(StringBuilder sb, MapChart map) { sb.Append("Map: " + map.MapType + Environment.NewLine); sb.Append("State, Value" + Environment.NewLine); bool hasCounties = false; foreach (var state in map.States) { sb.Append(state.Name); sb.Append(","); sb.Append(state.Value); sb.Append(Environment.NewLine); if (state.Counties != null) { hasCounties = true; } } if (hasCounties) { sb.Append(Environment.NewLine); sb.Append("County, State, Value" + Environment.NewLine); foreach (var state in map.States) { if (state.Counties != null) { foreach (var county in state.Counties) { sb.Append(county.Name); sb.Append(","); sb.Append(state.Name); sb.Append(","); sb.Append(county.Value); sb.Append(Environment.NewLine); } } } } return(sb); }
/// <summary> /// Converts CDC Data to string for csv /// </summary> /// <param name="sb"></param> /// <param name="map"></param> /// <returns></returns> private StringBuilder OutputComparisonData(StringBuilder sb, MapChart map) { sb.Append("CDC Data: " + map.MapType + Environment.NewLine); sb.Append("State, Category, Value" + Environment.NewLine); foreach (var state in map.States) { foreach (var obs in state.CDCValue) { sb.Append(state.Name); sb.Append(","); sb.Append(obs.Name); sb.Append(","); sb.Append(obs.Value); sb.Append(Environment.NewLine); } } return(sb); }