//public PagedResult<GPSPoint> GetGPSCoordinates(Token token, Guid entryId, PartialRetrievingInfo pageInfo) //{ // var securityInfo = SecurityManager.EnsureAuthentication(token); // var service = new GPSTrackerService(Session, securityInfo, Configuration); // return service.GetGPSCoordinates(entryId, pageInfo); //} public GPSCoordinatesDTO GetGPSCoordinates(GetGPSCoordinatesParam param) { var securityInfo = SecurityManager.EnsureAuthentication(param); var service = new GPSTrackerService(Session, securityInfo, Configuration); return(service.GetGPSCoordinates(param)); }
static async public Task <List <GPSPoint> > GetGPSCoordinatesAsync(Guid gpsTrackerEntryId) { var test = exceptionHandling((client) => { GetGPSCoordinatesParam param = new GetGPSCoordinatesParam(); OperationContext.Current.OutgoingMessageHeaders.Add(MessageHeader.CreateHeader("SessionId", "http://MYBASERVICE.TK/", ApplicationState.Current.SessionData.Token.SessionId)); OperationContext.Current.OutgoingMessageHeaders.Add(MessageHeader.CreateHeader("GPSTrackerEntryId", "http://MYBASERVICE.TK/", gpsTrackerEntryId)); return(Task <GPSCoordinatesDTO> .Factory.FromAsync(client.BeginGetGPSCoordinates, client.EndGetGPSCoordinates, param, null)); }); var result = await test; var unzipped = result.Stream.FromZip(); var json = UTF8Encoding.UTF8.GetString(unzipped, 0, unzipped.Length); var points = JsonConvert.DeserializeObject <List <GPSPoint> >(json); return(points); }
public GPSCoordinatesDTO GetGPSCoordinates(GetGPSCoordinatesParam param) { Log.WriteWarning("GetGPSCoordinates:Username={0},entryId={1}", SecurityInfo.SessionData.Profile.UserName, param.GPSTrackerEntryId); var dto = new GPSCoordinatesDTO(); var dbProfile = Session.Load <Profile>(SecurityInfo.SessionData.Profile.GlobalId); var res = Session.QueryOver <GPSTrackerEntry>().Fetch(x => x.TrainingDay).Eager.Fetch(x => x.Coordinates).Eager.Where(x => x.GlobalId == param.GPSTrackerEntryId).SingleOrDefault(); if (res.TrainingDay.Profile != dbProfile) { throw new CrossProfileOperationException(); } var gps = res.Coordinates; if (gps == null) { throw new ObjectNotFoundException("This entry doesn't have gps coordinates"); } MemoryStream memoryStream = new MemoryStream(gps.Content); memoryStream.Seek(0, SeekOrigin.Begin); dto.Stream = memoryStream; return(dto); }
public GPSCoordinatesDTO GetGPSCoordinates(GetGPSCoordinatesParam param) { return(exceptionHandling(null, () => InternalService.GetGPSCoordinates(param))); }