public void SetupBasicGMapDisplay(int office_id) { RepositionMap(office_id); GMap.enableHookMouseWheelToZoom = true; GMap.addControl(new GControl(GControl.preBuilt.LargeMapControl)); GMap.addControl(new GControl(GControl.preBuilt.MapTypeControl)); GMap.addControl(new GControl(GControl.preBuilt.GOverviewMapControl)); GMap.addMapType(GMapType.GTypes.Physical); GMap.mapType = GMapType.GTypes.Physical; GMap.resetMarkers(); }
protected void GridViewEvents_OnRowCommand(object sender, GridViewCommandEventArgs e) { //// Only handle our custom commands here! if (e.CommandName.Equals("Handle") || e.CommandName.Equals("Position") || e.CommandName.Equals("DownloadRecording")) { int index = Convert.ToInt32(e.CommandArgument); GridViewRow gvRow = ((GridView)sender).Rows[index]; Int32 eventID = (Int32)GridViewEvents.DataKeys[index].Value; using (braceletEntities context = new braceletEntities()) { switch (e.CommandName) { case "Handle": Event ev = context.Events.Where(o => o.ID == eventID).First(); ev.Status = (byte)CommonNames.EventStatus.Handled; ev.Note = ((TextBox)gvRow.FindControl("TextBoxHandle")).Text; context.SaveChanges(); GridViewEvents.DataBind(); GridViewPanel.Update(); break; case "Position": Event evSelected = context.Events.Where(o => o.ID == eventID).First(); GMapHolder.Visible = true; // Set selected row GridView gv = (GridView)sender; gv.SelectedIndex = index; // Add GUI controls GMap.addGMapUI(new GMapUI()); // Set center point if (evSelected.PositionLatitude != null && evSelected.PositionLongitude != null) { GMap.setCenter(new GLatLng(evSelected.PositionLatitude.Value, evSelected.PositionLongitude.Value)); } // Set zoom level GMap.GZoom = 15; // Add center marker GMap.resetMarkers(); if (evSelected.PositionLatitude != null && evSelected.PositionLongitude != null) { GMap.addGMarker(new GMarker(new GLatLng(evSelected.PositionLatitude.Value, evSelected.PositionLongitude.Value))); } break; case "DownloadRecording": if (HttpContext.Current.User.IsInRole("Administrator")) { Recording rec = context.Recordings.Where(o => o.EventID == eventID).FirstOrDefault(); if (rec != null) { FileStream fStream = null; try { String fileName = "C:\\BraceletRecordings\\" + rec.FileName; HttpResponse r = HttpContext.Current.Response; Response.ContentType = "audio/mpeg"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + rec.FileName); fStream = new FileStream(fileName, FileMode.Open); fStream.CopyTo(Response.OutputStream); Response.End(); } catch (IOException ex) { throw new IOException("Cannot find the selected recording.", ex); } finally { // Always close the fileStream if (fStream != null) { fStream.Close(); } } } } break; default: break; } } } // End of If(e.commandName.Equals("..") || ...) }