private static List <Dictionary <string, string> > GetWijmoCallGrid() { if (AllCalls.Any()) { var calls = AllCalls.OrderByDescending(p => p.DateCreated).Select(activeCall => new Dictionary <string, string> { { "Number", CensorPhoneNumber(activeCall.From) }, { "Status", GetCallStatus(activeCall) }, { "Duration", string.Format("{0} seconds", GetCallDuration(activeCall)) }, { "Date", activeCall.DateCreated.ToString() }, { "City", activeCall.City }, { "State", activeCall.State }, { "Zip Code", activeCall.ZipCode }, { "Country", activeCall.Country } }); return(calls.ToList()); } else { return(new List <Dictionary <string, string> >()); } }
private static void BroadcastAreaCodes() { var context = GlobalHost.ConnectionManager.GetHubContext("DashboardHub"); var areaCodeCounts = new Dictionary <string, int>(); foreach (var areaCode in AllCalls.OrderByDescending(p => p.DateCreated).Select(call => ExtractAreaCode(call.From))) { if (areaCodeCounts.ContainsKey(areaCode)) { areaCodeCounts[areaCode] += 1; } else { areaCodeCounts[areaCode] = 1; } } List <WijPieChartSeriesItem> areaCodeList; if (areaCodeCounts.Any()) { areaCodeList = areaCodeCounts.Select(keyValuePair => new WijPieChartSeriesItem() { data = keyValuePair.Value, label = keyValuePair.Key, legendEntry = true }).ToList(); } else { areaCodeList = new List <WijPieChartSeriesItem>() { new WijPieChartSeriesItem() { data = 1, label = "None", legendEntry = false } }; } context.Clients.updateAreaCodeChart(areaCodeList); }