예제 #1
0
 public ActionResult Bands(long industryId, long boundingGeographicLocationId, int bands, Core.DataLayer.Granularity granularity, string contentType = "*/*")
 {
     // contentType arg should also be checked for application/json and application/javascript,
     // but those seem to be inferred by other code like APIContext.IsJsonp, alluded to in
     // Controller.Json, and etc. For now we'll leave those alone and just check for:
     if ("text/html".Equals(contentType))
     {
         using (var context = ContextFactory.SizeUpContext)
         {
             Expression <Func <SizeUp.Data.IndustryData, bool> >             filter = i => i.AverageRevenue != null;
             Expression <Func <SizeUp.Data.IndustryData, Kpi.LabeledValue> > selector;
             selector = i => new Kpi.LabeledValue
             {
                 Label = i.GeographicLocation.LongName,
                 Value = i.AverageRevenue
             };
             Kpi.GetKpiModel(
                 ViewBag, context,
                 industryId, boundingGeographicLocationId, granularity,
                 filter, selector, "Average Annual Revenue", "${0}", bands
                 );
             return(View("Heatmap"));
         }
     }
     else
     {
         using (var context = ContextFactory.SizeUpContext)
         {
             var data = Core.DataLayer.AverageRevenue.Bands(context, industryId, boundingGeographicLocationId, bands, granularity);
             return(Json(data, JsonRequestBehavior.AllowGet));
         }
     }
 }
예제 #2
0
 public ActionResult Bands(
     long industryId, long boundingGeographicLocationId, int bands,
     Core.DataLayer.Granularity granularity, string contentType = "*/*"
     )
 {
     using (var context = ContextFactory.SizeUpContext)
     {
         if ("text/html".Equals(contentType))
         {
             Expression <Func <SizeUp.Data.IndustryData, bool> >             filter = i => i.TotalRevenue != null;
             Expression <Func <SizeUp.Data.IndustryData, Kpi.LabeledValue> > selector;
             selector = i => new Kpi.LabeledValue
             {
                 Label = i.GeographicLocation.LongName,
                 Value = i.TotalRevenue
             };
             Kpi.GetKpiModel(
                 ViewBag, context,
                 industryId, boundingGeographicLocationId, granularity,
                 filter, selector, "Total Revenue", "${0}", bands
                 );
             return(View("Heatmap"));
         }
         else
         {
             var data = Core.DataLayer.TotalRevenue.Bands(context, industryId, boundingGeographicLocationId, bands, granularity);
             return(Json(data, JsonRequestBehavior.AllowGet));
         }
     }
 }