//解析原生返回数据 public static void ResolverForNativeMsg(string content) { // Debug.Log($"ResolverForNativeMsg::{content}"); NativeMessage nativeMessage = JsonHelper.FromJson <NativeMessage>(content); NativeCallType type = (NativeCallType)nativeMessage.type; switch (type) { case NativeCallType.GetSafeArea: //适配刘海屏 SafeArea safeArea = JsonHelper.FromJson <SafeArea>(nativeMessage.content); NativeManager.Instance.safeArea = safeArea; break; case NativeCallType.AwakeByURL: //URL唤醒 string awakeContent = nativeMessage.content; // Debug.Log($"游戏被唤起,参数为:{awakeContent}"); Game.Hotfix.OnAwakeByURL?.Invoke(awakeContent); break; case NativeCallType.GetGPS: //获取GPS定位 GPSInfo gPSInfo = JsonHelper.FromJson <GPSInfo>(nativeMessage.content); // Debug.Log($"获取GPS信息返回:statue={gPSInfo.status},lan={gPSInfo.latitude},long={gPSInfo.longitude},name={gPSInfo.locationName}"); Game.Hotfix.OnGetGPS?.Invoke(string.Format("{0},{1},{2},{3}", gPSInfo.status, gPSInfo.longitude, gPSInfo.latitude, gPSInfo.locationName)); break; case NativeCallType.TakeHeadImage: //获取头像图片路径 // Debug.Log("ongetHead"); Game.Hotfix.OnGetHeadImagePath?.Invoke(nativeMessage.content); break; case NativeCallType.InAppPurchase: InAppPurchaseInfo purchaseInfo = JsonHelper.FromJson <InAppPurchaseInfo>(nativeMessage.content); Game.Hotfix.OnInAppPurchaseCallBack?.Invoke(string.Format("{0},{1},{2},{3},{4}", purchaseInfo.status, purchaseInfo.productId, purchaseInfo.orderId, purchaseInfo.transactionId, purchaseInfo.receiptData)); break; case NativeCallType.IMMes: Game.Hotfix.OnGroupMes?.Invoke(nativeMessage.content); break; case NativeCallType.IMOpearteMes: Game.Hotfix.OnOpearteMes?.Invoke(nativeMessage.content); break; case NativeCallType.IMServerMes: Game.Hotfix.OnServerMes?.Invoke(nativeMessage.content); break; case NativeCallType.EMULATORINFO: Game.Hotfix.OnEmulatorInfo?.Invoke(nativeMessage.content); break; default: Debug.Log($"error nativeMessage.type {nativeMessage.type} content = {nativeMessage.content}"); break; } }
/// <summary> /// 保存位置信息 /// </summary> /// <param name="obj"></param> private long SaveGpsInfo(GPSInfo obj, TB_Equipment equipment, string terminal, string type) { //if (!obj.Available) return -1; using (var bll = new PositionBLL()) { TB_Data_Position pos = bll.GetObject(); pos.Altitude = obj.Altitude; pos.Direction = obj.Direction; pos.Equipment = null == equipment ? (int?)null : equipment.id; pos.EW = obj.EW[0]; pos.GpsTime = obj.GPSTime; pos.Latitude = obj.Latitude; pos.Longitude = obj.Longitude; pos.NS = obj.NS[0]; pos.ReceiveTime = DateTime.Now; pos.Speed = obj.Speed; pos.StoreTimes = null == equipment ? 0 : equipment.StoreTimes; pos.Terminal = terminal; pos.Type = type; pos = bll.Add(pos); // 更新定位信息 ShowUnhandledMessage("position: " + pos.id); return(pos.id); } //HandleGpsAddress(pos); }
public void Handle(ShowStructureInfo message) { switch (message.Id) { case (int)TypeId.GPS: //UpdateGpsView(message); gpsInfo = message.Info as GPSInfo; gpstime = DateTime.Now; break; case (int)TypeId.Pose: //UpdatePoseView(message); poseture = message.Info as PosetureInfo; posetime = DateTime.Now; break; case (int)TypeId.RawPos: break; case (int)TypeId.AjustPos: //UpdatePositionView(message); if (UnitCore.Instance.ajustPosition == null) { UnitCore.Instance.ajustPosition = new Dictionary <DateTime, AjustPositionInfo>(); } ajusttime = DateTime.Now; UnitCore.Instance.ajustPosition.Add(ajusttime, message.Info as AjustPositionInfo); break; default: break; } }
private static async Task <GoogleAddressResult> GetAddress(GPSInfo gps) { try { using (var httpClient = new HttpClient()) { var lat = gps.LatRef == 'N' ? gps.Lat : -gps.Lat; var lng = gps.LonRef == 'E' ? gps.Lon : -gps.Lon; var url = string.Format("https://maps.googleapis.com/maps/api/geocode/json?latlng={0},{1}&key={2}", lat, lng, API_KEY); var response = await httpClient.GetStreamAsync(url).ConfigureAwait(false); using (var reader = new StreamReader(response)) { var addressString = reader.ReadToEnd(); return(JsonConvert.DeserializeObject <GoogleAddressResult>(addressString)); } } } catch (Exception e) { Console.WriteLine(string.Format("Failed to call google map API: {0}", e.Message)); return(new GoogleAddressResult()); } }
void Instance_GPSComeHandler(object sender, GPSInfo e) { string sql = string.Format("insert into DtuGps(dev_number,recv_time,longitude,latitude) values('{0}','{1}',{2},{3})", e.imei, e.recvTime, e.longitude, e.latitude); accessHelper.ExcuteSql(sql); }
protected int OnGPSInfo(ref GPSInfo gpsInfo, IntPtr userData)//GPS实时数据回调 { Task.Factory.StartNew((info) => { _gpsprase.AddGpsInfo((GPSInfo)info); }, gpsInfo); return(0); }
public string GetLocation(out GPSInfo info) { info = m_Info.Clone(); if (m_Info.HaveSatData) { return(m_Info.CleanPositionString); } else { return(null); } }
private void UpdateGpsView(GPSInfo info) { var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); gpsTitle = "GPS-" + epoch.AddSeconds(info.GPSSecond).AddMilliseconds(info.GPSMicSecond).ToString(); gpsStatus = info.GPSStatus; Satelites = info.SatNum; gpsSpeed = info.Velocity; shipLong = info.Long; shipLat = info.Lat; UpdateLatLong(info); }
public GPSInfo Clone() { lock (this) { GPSInfo newInfo = new GPSInfo(); newInfo.HaveSatData = this.HaveSatData; if (this._GoogleMapString == null) { newInfo._GoogleMapString = null; } else { newInfo._GoogleMapString = this._GoogleMapString.ToString(); } if (this._NMEA0183String == null) { newInfo._NMEA0183String = null; } else { newInfo._NMEA0183String = this._NMEA0183String.ToString(); } if (this._Latitude == null) { newInfo._Latitude = null; } else { newInfo._Latitude = this._Latitude; } if (this._Longitude == null) { newInfo._Longitude = null; } else { newInfo._Longitude = this._Longitude; } newInfo._HaveSatData = this._HaveSatData; newInfo._DetectedReceiver = this._DetectedReceiver; return(newInfo); } }
/// <summary> /// 追加GPS信息到文件中 /// </summary> /// <param name="info">GPS信息</param> public static void AppendGPSInfoToFile(GPSInfo info) { string dir = Path.Combine(PathUtils.GPS_DATA_DEFAULT_PATH, info.ID); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string gpsFile = Path.Combine(dir, info.Time.Split(' ')[0].Replace('/', '-') + ".txt"); using (StreamWriter sw = new StreamWriter(gpsFile, true)) { sw.WriteLine(info.ToString()); } }
public void SaveGPS(GPSInfo gpsInfo) { if (Path == null) { return; } if (GpsFile == null) { GpsFile = new ADFile("GPS", "dat"); GpsFile.SetFileSizeLimit(GPSFileSize); GpsFile.SetPath(new DirectoryInfo(Path)); GpsFile.Create(); } if (GpsFile.Write(gpsInfo.SavePackage()) == 0) { throw new Exception("创建GPS文件失败!"); } }
/// <summary> /// 保存位置信息 /// </summary> /// <param name="obj"></param> private void SaveGpsInfo(GPSInfo obj, TB_Equipment equipment, string terminal, string type) { TB_Data_Position pos = PositionInstance.GetObject(); pos.Altitude = obj.Altitude; pos.Direction = obj.Direction; pos.Equipment = null == equipment ? (int?)null : equipment.id; pos.EW = obj.EW[0]; pos.GpsTime = obj.GPSTime; pos.Latitude = obj.Latitude; pos.Longitude = obj.Longitude; pos.NS = obj.NS[0]; pos.ReceiveTime = DateTime.Now; pos.Speed = obj.Speed; pos.StoreTimes = null == equipment ? 0 : equipment.StoreTimes; pos.Terminal = terminal; pos.Type = type; PositionInstance.Add(pos); }
private GPSInfo ReadGPSInfo(long offset) { try { var gps = new GPSInfo(); var position = stream.Position; stream.Position = offset + APP1_START_POSITION; var count = Convert2BytesToUShort(ReadBytes(2)); for (ushort i = 0; i < count; i++) { var tagId = Convert2BytesToTag(ReadBytes(2)); var tagType = ParseTagType(ReadBytes(2)); var length = Convert4BytesToInt(ReadBytes(4)); var valueBuffer = ReadBytes(4); if (tagId == ExifTagId.GPSLatRef) { gps.LatRef = Convert.ToChar(valueBuffer[0]); } else if (tagId == ExifTagId.GPSLonRef) { gps.LonRef = Convert.ToChar(valueBuffer[0]); } else if (tagId == ExifTagId.GPSLat) { gps.Lat = ReadGPSValue(Convert4BytesToInt(valueBuffer)); } else if (tagId == ExifTagId.GPSLon) { gps.Lon = ReadGPSValue(Convert4BytesToInt(valueBuffer)); } } stream.Position = position; return(gps); } catch (Exception e) { Console.WriteLine(string.Format("Error reading GPS: {0}", e.Message)); return(new GPSInfo()); } }
public GPSDev(string commPort, NotifyDeviceFailure notifyDeviceFailure, APPLICATION_DATA appData) { m_Info = new GPSInfo(); m_Info.HaveSatData = false; m_AppData = appData; m_AppData.AddOnClosing(Close, APPLICATION_DATA.CLOSE_ORDER.FIRST); m_NotifyDeviceFailure = notifyDeviceFailure; m_Info.CleanPositionString = m_NoPositionAvailable; m_Info.Latitude = m_NoPositionAvailable; m_Info.Longitude = m_NoPositionAvailable; m_Info.GoogleMapString = m_NoPositionAvailable; m_Info.HaveSatData = false; m_Info.DetectedReceiver = false; // m_CommPort = string.Format("COM{0:0}", m_Info.commport); m_CommPort = commPort; m_Stop = false; m_sport = new SerialPortControl(this); m_sport.Open(); // is there a receiver there spewing data? Thread.Sleep(100); if (m_sport.BytesToRead() == 0) { // we failed to find the device _OpenSucess = false; m_sport.Close(); return; } _OpenSucess = true; m_Info.DetectedReceiver = true; m_PollDevice = new Thread(PollLoop); m_PollDevice.Start(); }
/// <summary> /// 接收到GPS信号事件 /// </summary> /// <param name="gpsInfo">GPS信息</param> private void PGPSUDPListener_OnReceiveGPSInfo(GPSInfo gpsInfo) { MeshAllInfo mesh = mMeshAllInfo.Find(m => m.PlanInfo.Model265ID == gpsInfo.ID); //如果ID不存在,则退出 if (mesh == null) { return; } if (mesh.PlanInfo != null) { GPSInfo gi = mesh.MeshGPSInfo; gi.Time = gpsInfo.Time; gi.Lat = gpsInfo.Lat; gi.Lon = gpsInfo.Lon; mesh.MeshGPSInfo = gi; BMeshPoint bmp = mesh.BuddyBMeshPoint; bmp.IsOnline = true; bmp.ReceiveGPSDT = DateTime.Now; bmp.Location = new LatLngPoint(gpsInfo.Lon, gpsInfo.Lat); mesh.BuddyBMeshPoint = bmp; } if (mesh.BuddyNode != null) { doUpdateAdvTreeMeshList(mesh.DeviceInfo.IPV4, "在线", "GPS在线"); } //如果之前没有在地图上显示该设备则添加显示 BMeshPoint p = mBMeshPoints.Find(b => b.IPV4 == mesh.PlanInfo.MeshIP); if (p != null) { p.Location = new LatLngPoint(gpsInfo.Lon, gpsInfo.Lat); if (BuddyBMapControl != null) { BuddyBMapControl.AddMeshDevicePlaces(mBMeshPoints); } } }
void ProcessStepCheckBroadcastMessages() { if (this.BroadcastListener.HasPendingMessage) { EchoR("Received broadcast message"); MyIGCMessage message = this.BroadcastListener.AcceptMessage(); try { var data = message.As <MyTuple <long, string, Vector3D, string> >(); GPSInfo gpsmessage = new GPSInfo() { ID = data.Item1, Name = data.Item2, Position = data.Item3, Created = DateTime.Now }; CelestialMap.AddGPSPosition(gpsmessage.Name, gpsmessage.Position); } catch { } } }
private static bool TryGetLocation(GPSInfo gps, out GoogleAddressInfo address) { var result = false; address = new GoogleAddressInfo(); foreach (var info in addressCache) { result = gps.Lat <= info.geometry.bounds.northeast.lat && gps.Lat >= info.geometry.bounds.southwest.lat && gps.Lon <= info.geometry.bounds.northeast.lng && gps.Lon >= info.geometry.bounds.southwest.lng; if (result) { address = info; } } return(result); }
public void AddGpsInfo(GPSInfo info) { // info.dataTime,info.devisionEw,info.devisionNs,info.longitude.ToString("0.00"), // info.latitude.ToString("0.00"),info.direction.ToString("0.00"), info.speed.ToString("0.00"), info.sateNum.ToString()}, -1); try { SqlParameter[] sp = new SqlParameter[5]; sp[0] = new SqlParameter("@deviceIndexcode", info.deviceIndexcode); sp[1] = new SqlParameter("@elementId", info.elementId); sp[2] = new SqlParameter("@latitude", info.longitude); sp[3] = new SqlParameter("@longitude", info.latitude); sp[4] = new SqlParameter("@sdataTime", info.dataTime); DbComponent.SQLHelper.ExecuteNonQuery(CommandType.StoredProcedure, "GPS_INSERT", sp); } catch (Exception ex) { log.Error(ex.ToString()); } finally { } }
private void UpdateLatLong(GPSInfo gpsInfo) { longbottom0 = LongOffset(gpsInfo.Long, gpsInfo.Lat, 1500); longbottom1 = LongOffset(gpsInfo.Long, gpsInfo.Lat, 3000); longbottom2 = LongOffset(gpsInfo.Long, gpsInfo.Lat, 4500); longbottom3 = LongOffset(gpsInfo.Long, gpsInfo.Lat, 6000); longTop0 = LongOffset(gpsInfo.Long, gpsInfo.Lat, -1500); longTop1 = LongOffset(gpsInfo.Long, gpsInfo.Lat, -3000); longTop2 = LongOffset(gpsInfo.Long, gpsInfo.Lat, -4500); longTop3 = LongOffset(gpsInfo.Long, gpsInfo.Lat, -6000); latleft0 = LatOffset(gpsInfo.Lat, -1500); latleft1 = LatOffset(gpsInfo.Lat, -3000); latleft2 = LatOffset(gpsInfo.Lat, -4500); latleft3 = LatOffset(gpsInfo.Lat, -6000); latTop0 = LatOffset(gpsInfo.Lat, 1500); latTop1 = LatOffset(gpsInfo.Lat, 3000); latTop2 = LatOffset(gpsInfo.Lat, 4500); latTop3 = LatOffset(gpsInfo.Lat, 6000); }
private static bool IsLocationExcluded(GPSInfo gps) { var result = false; var lat = gps.LatRef == 'N' ? gps.Lat : -gps.Lat; var lon = gps.LonRef == 'E' ? gps.Lon : -gps.Lon; foreach (var area in config.ExcludedArea) { //Console.WriteLine(string.Format("[PhotoHelper]###################### IsLocationExcluded location: {0}", JsonConvert.SerializeObject(area))); var latTest = lat <= area.Norteast.Lat && lat >= area.Southwest.Lat; var lonTest = lon <= area.Norteast.Lng && lon >= area.Southwest.Lng; if (latTest && lonTest) { result = true; //Console.WriteLine(string.Format("[PhotoHelper]###################### exclude location: {0}", JsonConvert.SerializeObject(gps))); break; } } return(result); }
/// <summary> /// 单击节点,跳转到设备所在的位置。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void advTreeMeshList_NodeClick(object sender, TreeNodeMouseEventArgs e) { DevComponents.AdvTree.Node selectNode = advTreeMeshList.SelectedNode; //设备不在线,不执行后续操作 if (selectNode == null || selectNode.Level != 1) { return; } Cell selectCell = selectNode.GetCellAt(e.X, e.Y); if (selectCell == null) { return; } if (selectNode.Level == 1 && selectCell.Images != null) { MeshAllInfo mai = (MeshAllInfo)selectNode.Tag; GPSInfo vp = mai.MeshGPSInfo; //GPS坐标为(0,0),不能执行定位操作 if (selectCell.Images.ImageIndex == 9 && BuddyBMapControl != null) {//点中了离线设备 BuddyBMapControl.SelectMeshDevice(null); } if (selectCell.Images.ImageIndex == 10 && vp.Lat != 0 && vp.Lon != 0 && BuddyBMapControl != null) { //地图上跳转到设备所在的位置 BuddyBMapControl.Center = new LatLngPoint(vp.Lon, vp.Lat); BuddyBMapControl.Locate(false); //选中目标Mesh设备 BuddyBMapControl.SelectMeshDevice(mai.BuddyBMeshPoint); } else if (selectCell.Images.ImageIndex == 11) { MessageBox.Show("设备不在线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (selectCell.Images.ImageIndex == 12 && selectNode.Cells[1].Text.Equals("在线")) { if (BuddyBMapControl != null) { BuddyBMapControl_OnOpenVideo(mai.BuddyBMeshPoint); } else if (BuddyGrid != null) { VideoInject inject = new VideoInject(mFormMain.AllApplicationSetting[ApplicationSettingKey.VideoServerIPV4], mFormMain.AllApplicationSetting[ApplicationSettingKey.VideoServerUserName], mFormMain.AllApplicationSetting[ApplicationSettingKey.VideoServerPassword]); Panel panel = BuddyGrid.GetNextAvailablePanel(); Process process = inject.injectPanel(panel, mFormMain.GetVideoFullScreenLocation(), BuddyGrid.GetFullScreenPanel(), mai.PlanInfo.Model265ID, "0"); BuddyGrid.BindPanelProcess(panel, process); mFormMain.VideoProcesses.Add(process); logger.Info(string.Format("在第{0}个Panel中打开了视频。", panel.Tag.ToString())); } } else if (selectCell.Images.ImageIndex == 13 && BuddyBMapControl != null) { bool isDrawingRoute = (bool)selectCell.Tag; if (isDrawingRoute) {//已经绘制,再次点击的时候隐藏已绘制的轨迹 BuddyBMapControl.DeleteDeviceRoute(mai.PlanInfo.Model265ID); selectCell.Tag = false; } else { //在地图上绘制轨迹记录 FGPSTimeSelect fgpsts = new FGPSTimeSelect(); fgpsts.StartDateTime = DateTime.Today.Subtract(new TimeSpan(1, 0, 0, 0)); fgpsts.StopDateTime = DateTime.Today; if (DialogResult.OK == fgpsts.ShowDialog() && BuddyBMapControl != null) { BMeshRoute bmr = FileUtils.ReadMeshRouteFromGPSLogs( mai.PlanInfo.Model265ID, fgpsts.StartDateTime, fgpsts.StopDateTime); if (bmr.DeviceLocationList.Count > 0) { BuddyBMapControl.AddDeviceRoute(bmr); //地图上跳转到设备所在的位置 BuddyBMapControl.Center = bmr.DeviceLocationList[0]; BuddyBMapControl.Locate(false); BuddyBMapControl.Zoom = 16; selectCell.Tag = true; //标识已经绘制了路径 logger.Info(string.Format("查看{0}设备的GPS轨迹记录,供{1}条GPS记录。", mai.PlanInfo.Model265ID, bmr.DeviceLocationList.Count)); } else { MessageBox.Show("无历史轨迹记录。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } } } } }
/// <summary> /// GPS取得処理ワーカー /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetGPS_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = (BackgroundWorker)sender; // 緯度 double latitude = 0; // 経度 double longitude = 0; // 結果 bool ret = false; //コントロールの表示を変更する bw.ReportProgress(90, null); // GPS入力の開始 using (GPSInfo gps = new GPSInfo()) { // 位置情報を取得 ret = gps.GetLocation(ref latitude, ref longitude, Settings.Default.GpsWaitTimer); // GP入力の終了 gps.Dispose(); } //コントロールの表示を変更する bw.ReportProgress(100, null); //結果を設定する e.Result = new object[3] { ret, latitude, longitude }; }
public void SaveGPS(GPSInfo gpsInfo) { TraceFile.Instance.SaveGPS(gpsInfo); }
public String UploadFile([Bind(Prefix = "ID")] int FlightID = 0, int DroneID = 0, String DocumentType = "Regulator Approval", String CreatedOn = "") { DateTime FileCreatedOn = DateTime.MinValue; String UploadPath = Server.MapPath(Url.Content(RootUploadDir)); //send information in JSON Format always StringBuilder JsonText = new StringBuilder(); GPSInfo GPS = new GPSInfo(); Response.ContentType = "text/json"; try { FileCreatedOn = DateTime.ParseExact(CreatedOn, "ddd, d MMM yyyy HH:mm:ss GMT", CultureInfo.InvariantCulture); string FileCreated_ON = FileCreatedOn.ToString(); } catch { } //when there are files in the request, save and return the file information try { var TheFile = Request.Files[0]; String FileName = System.Guid.NewGuid() + "~" + TheFile.FileName.ToLower(); String DroneName = Util.getDroneNameByFlight(FlightID); DroneID = Util.GetDroneIdFromFlight(FlightID); String UploadDir = UploadPath + DroneName + "\\" + FlightID + "\\"; String FileURL = FileName; String FullName = UploadDir + FileName; String GPSFixName = UploadDir + "GPS-" + FileName; //Save the file to Disk if (!Directory.Exists(UploadDir)) Directory.CreateDirectory(UploadDir); TheFile.SaveAs(FullName); //Do the calculation for GPS if (DocumentType == "Geo Tag" && System.IO.Path.GetExtension(FullName).ToLower() == ".jpg") { //here find the code to find the GPS Cordinate ExifLib GeoTag = new ExifLib(FullName, GPSFixName); GPS = GeoTag.getGPS(FlightID, FileCreatedOn); GeoTag.setGPS(GPS); GeoTag.SetThumbnail(100); //System.IO.File.Delete(FullName); FullName = GPSFixName; FileURL = "GPS-" + FileName; } JsonText.Append("{"); JsonText.Append(Util.Pair("status", "success", true)); JsonText.Append(Util.Pair("url", "/upload/drone/" + DroneName + "/" + FlightID + "/" + FileURL, true)); JsonText.Append("\"GPS\":{"); JsonText.Append("\"Info\":\""); JsonText.Append(GPS.getInfo()); JsonText.Append("\","); JsonText.Append("\"Latitude\":"); JsonText.Append(GPS.Latitude); JsonText.Append(","); JsonText.Append("\"Longitude\":"); JsonText.Append(GPS.Longitude); JsonText.Append(","); JsonText.Append("\"Altitude\":"); JsonText.Append(GPS.Altitude); JsonText.Append(","); JsonText.Append(Util.Pair("CreatedDate", FileCreatedOn.ToString("dd-MMM-yyyy hh:mm"), false)); JsonText.Append(","); JsonText.Append("\"FlightID\":"); JsonText.Append(FlightID); JsonText.Append("},"); JsonText.Append("\"addFile\":["); JsonText.Append(Util.getFileInfo(FullName, FileURL)); JsonText.Append("]}"); //now add the uploaded file to the database String SQL = "INSERT INTO DroneDocuments(\n" + " DroneID, FlightID, DocumentType, DocumentName, UploadedDate,DocumentDate, UploadedBy,\n" + " Latitude, Longitude, Altitude \n" + ") VALUES (\n" + " '" + DroneID + "',\n" + " '" + FlightID + "',\n" + " '" + DocumentType + "',\n" + " '" + FileURL + "',\n" + " GETDATE(),\n" + " '" + FileCreatedOn + "'," + " " + Util.getLoginUserID() + ",\n" + " " + GPS.Latitude + ", " + GPS.Longitude + ", " + GPS.Altitude + "\n" + ")"; int DocumentID = Util.InsertSQL(SQL); } catch (Exception ex) { JsonText.Clear(); JsonText.Append("{"); JsonText.Append(Util.Pair("status", "error", true)); JsonText.Append(Util.Pair("message", ex.Message, false)); JsonText.Append("}"); }//catch return JsonText.ToString(); }//UploadFile()