// Public Methods //====================================================================== public override Collection MakeCollection(CollectionRequestContext context) { try { var crashes = db.Crashes .Include(c => c.Light) .Include(c => c.Weather) .Include(c => c.CrashLocation) .Include(c => c.SurfCondition) .Include(c => c.CrashClass) .Include(c => c.VehCollision) .Include(c => c.ObjectStruck) .Include(c => c.RoadCharacter) .Include(c => c.ContFactor1) .Include(c => c.ContFactor2) .Include(c => c.CrashCategory); Collection collection = new Collection(); collection.Name = "NPS Crashes"; foreach (var crash in crashes.Take(maxItems)) { ItemImage image = null; collection.AddItem(crash.IncidentNo, null, null, image, GetFacets(crash)); } return collection; } catch (Exception ex) { return ErrorCollection.FromException(ex); } }
// Public Methods //====================================================================== public override Collection MakeCollection(CollectionRequestContext context) { try { var crashes = db.Crashes .Include(c => c.Light) .Include(c => c.Weather) .Include(c => c.CrashLocation) .Include(c => c.SurfCondition) .Include(c => c.CrashClass) .Include(c => c.VehCollision) .Include(c => c.ObjectStruck) .Include(c => c.RoadCharacter) .Include(c => c.ContFactor1) .Include(c => c.ContFactor2) .Include(c => c.CrashCategory); Collection collection = new Collection(); collection.Name = "NPS Crashes"; foreach (var crash in crashes.Take(maxItems)) { string imgFolder = HttpRuntime.BinDirectory.Substring(0, HttpRuntime.BinDirectory.Length - 5); string imgName = GetImageName(crash.Category); ItemImage image = null; if (imgName != null) { image = new ItemImage(string.Format(@"{0}\Images\{1}", imgFolder, imgName)); } collection.AddItem(crash.IncidentNo, null, null, image, GetFacets(crash)); } // Set facet display properties collection.SetFacetDisplay("Park Alpha", true, true, true); collection.SetFacetDisplay("State", true, true, false); collection.SetFacetDisplay("Crash Year", true, true, false); collection.SetFacetDisplay("Crash Date", false, true, false); collection.SetFacetDisplay("Crash Time", false, true, false); collection.SetFacetDisplay("Route ID", true, true, true); collection.SetFacetDisplay("Road Name", false, true, true); collection.SetFacetDisplay("Node Distance (Ft)", false, true, false); collection.SetFacetDisplay("Node Distance (Mi)", false, true, false); collection.SetFacetDisplay("Node Direction", false, true, false); collection.SetFacetDisplay("Node Number", false, true, false); collection.SetFacetDisplay("Node MP", false, true, false); collection.SetFacetDisplay("Crash MP", true, true, false); collection.SetFacetDisplay("Light Condition", true, true, false); collection.SetFacetDisplay("Weather Condition", true, true, false); collection.SetFacetDisplay("Crash Location", true, true, false); collection.SetFacetDisplay("Surface Condition", true, true, false); collection.SetFacetDisplay("Crash Class", true, true, false); collection.SetFacetDisplay("Vehicle Collision", true, true, false); collection.SetFacetDisplay("Fixed Object Struck", true, true, false); collection.SetFacetDisplay("Road Character", true, true, false); collection.SetFacetDisplay("Contributing Factor 1", true, true, false); collection.SetFacetDisplay("Contributing Factor 2", true, true, false); collection.SetFacetDisplay("Contributing Factor 3", false, true, false); collection.SetFacetDisplay("Contributing Factor 4", false, true, false); collection.SetFacetDisplay("Contributing Factor 5", false, true, false); collection.SetFacetDisplay("Contributing Factor 6", false, true, false); collection.SetFacetDisplay("Category", true, true, false); collection.SetFacetDisplay("Hit & Run", false, true, false); collection.SetFacetDisplay("Fatal", false, true, false); collection.SetFacetDisplay("Injured", false, true, false); collection.SetFacetDisplay("Pedestrian Fatal", false, true, false); collection.SetFacetDisplay("Pedestrian Injured", false, true, false); collection.SetFacetDisplay("Bikers Fatal", false, true, false); collection.SetFacetDisplay("Bikers Injured", false, true, false); collection.SetFacetDisplay("Pedestrian", true, true, false); collection.SetFacetDisplay("Comments", false, true, true); collection.SetFacetDisplay("Spatial Location", true, true, false); //collection.SetFacetDisplay("Case Number", false, true, false); //collection.SetFacetDisplay("Location", false, true, false); //collection.SetFacetDisplay("USPP/NPS Veh. Inv.", false, true, false); //collection.SetFacetDisplay("Park Property Dest.", false, true, false); //collection.SetFacetDisplay("Data Source", false, true, false); //collection.SetFacetDisplay("Latitude", false, true, false); //collection.SetFacetDisplay("Longitude", false, true, false); //collection.SetFacetDisplay("Save Date", false, true, false); //collection.SetFacetDisplay("RIP Cycle", false, true, false); // Set facet formats //collection.SetFacetFormat("List price", "$#,0.00"); return collection; } catch (Exception ex) { return ErrorCollection.FromException(ex); } }
public override Collection MakeCollection(CollectionRequestContext context) { return MakeCollection(); }