public IHttpActionResult GetOnlineNewestGGAByAccount(string account) { GGAHistoryEntity ggaEntity = new GGAHistoryEntity(); ResultEntity result = new ResultEntity(); try { //找到指定账号的最近gga信息 GGAHistory temp = dal.FindGGAHistoriesByAccount(account)[0]; //判断GGA相关会话是否在线 if (temp.SessionHistory.ConnectionEnd == null) { ggaEntity = temp.ToGGAHistoryEntity(); ggaEntity.Session = temp.SessionHistory.ToSessionHistoryEntity(); } } catch (Exception e) { result.Message = e.Message; NtripProxyLogger.LogExceptionIntoFile("调用接口api/GGAHistory/GetOnlineNewestGGAByAccount异常,异常信息为:" + e.Message); } result.IsSuccess = result.Message == null; result.Data = ggaEntity; return(Json <ResultEntity>(result)); }
public IHttpActionResult GetGGAHistoryByAccount(string account) { List <GGAHistoryEntity> ggaEntityList = new List <GGAHistoryEntity>(); ResultEntity result = new ResultEntity(); try { List <GGAHistory> temp = dal.FindGGAHistoriesByAccount(account); foreach (var ggaHistory in temp) { GGAHistoryEntity item = ggaHistory.ToGGAHistoryEntity(); item.Session = ggaHistory.SessionHistory.ToSessionHistoryEntity(); ggaEntityList.Add(item); } } catch (Exception e) { result.Message = e.Message; NtripProxyLogger.LogExceptionIntoFile("调用接口api/GGAHistory/GetGGAHistoryByAccount异常,异常信息为:" + e.Message); } result.IsSuccess = result.Message == null; result.Data = ggaEntityList; return(Json <ResultEntity>(result)); }
/// <summary> /// 模型GGAHistory类扩展方法,转换基础信息到GGAHistoryEntity /// </summary> /// <param name="gga">DAL层概略位置</param> /// <returns>WebApi层概略位置实体</returns> public static GGAHistoryEntity ToGGAHistoryEntity(this GGAHistory gga) { GGAHistoryEntity ggaHistoryEntity = new GGAHistoryEntity { ID = gga.ID, Account = gga.Account, AccountType = gga.AccountType, AccountSYS = gga.AccountSYS, FixedTime = (DateTime)gga.FixedTime, Lng = (double)gga.Lng, Lat = (double)gga.Lat, Status = (int)gga.Status, GGAInfo = gga.GGAInfo }; return(ggaHistoryEntity); }