//----------------------------------------------------------------------------------------------------------- private Orchestrator.WebUI.Services.PointGeofence GetGeofenceForWebService(int pointID) { Orchestrator.Facade.IPoint facPoint = new Orchestrator.Facade.Point(); Orchestrator.WebUI.Services.PointGeofence pg = new PointGeofence(); DataSet dsPointGeofence = facPoint.GetPointGeofenceInfo(pointID); if (dsPointGeofence.Tables[0].Rows.Count > 0) { DataRow dr = dsPointGeofence.Tables[0].Rows[0]; pg.PointID = Convert.ToInt32(dr["PointId"]); pg.Description = dr["Description"].ToString(); pg.Latitude = dr["Latitude"] == DBNull.Value ? 0 : Convert.ToDouble(dr["Latitude"]); pg.Longitude = dr["Longitude"] == DBNull.Value ? 0 : Convert.ToDouble(dr["Longitude"]); pg.Radius = dr["Radius"] == DBNull.Value ? new int?() : (int)dr["Radius"]; pg.GeofencePoints = new List <LatLong>(); SqlGeography geofence = (SqlGeography)dr["Geofence"]; string points = string.Empty; for (int i = 0; i < geofence.STNumPoints(); i++) { SqlGeography point = geofence.STPointN(i + 1); LatLong latLon = new LatLong() { Latitude = (double)point.Lat, Longitude = (double)point.Long }; pg.GeofencePoints.Add(latLon); } } return(pg); }
public static Orchestrator.WebUI.Services.PointGeofence LoadPoint(int pointID) { if (pointID < 0) { return(null); } Services.GeoManagement geomanagement = new Services.GeoManagement(); Orchestrator.WebUI.Services.PointGeofence point = geomanagement.GetPointGeofence(pointID); Orchestrator.WebUI.Services.PointGeofence retVal = null; if (point != null) { retVal = point; } return(retVal); }
public static bool UpdatePoint(Orchestrator.WebUI.Services.PointGeofence point) { bool retval = true; try { Services.GeoManagement geomanagement = new Services.GeoManagement(); var p = geomanagement.UpdatePointGeofence(point, System.Threading.Thread.CurrentPrincipal.Identity.Name); var pin = geomanagement.GetPoint(point.PointID); // Make sure we update the points central location pin.Latitide = point.Latitude; pin.Longitude = point.Longitude; geomanagement.UpdatePoint(pin, System.Threading.Thread.CurrentPrincipal.Identity.Name); } catch { retval = false; } return(retval); }