public IEnumerable <IPosition> GetPositionsForToday(IAuthentificationToken pToken, IVehicule pVehicule) { if (pToken == null) { throw new ArgumentNullException("pToken"); } var token = new Token() { Value = pToken.Value }; var now = DateTime.Now; var startDate = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, DateTimeKind.Utc); var endDate = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59, DateTimeKind.Utc); var eventRequest = new EventRequest() { UnsafeToken = token, Vehicles = new[] { pVehicule.ID }, StartDateTime = startDate, EndDateTime = endDate }; var response = _client.GetPositionEvent(eventRequest); if (response == null) { return(Enumerable.Empty <IPosition>()); } return(response.ConvertToPositions().ToList()); }
private void LoginToETL() { using (var service = ServiceFactories.CreateETLService()) { service.ErrorOccured += OnErrorOccured; Token = service.Login(Username, Password); } }
public IEnumerable <IVehicule> GetVehicules(IAuthentificationToken pToken) { if (CheckIsDisposed()) { return(null); } try { return(_staticService.GetVehicules(pToken)); } catch (Exception exception) { SendError(exception.Message); return(Enumerable.Empty <IVehicule>()); } }
public IEnumerable <IPosition> GetPositions(IAuthentificationToken pToken, IVehicule pVehicule) { if (CheckIsDisposed()) { return(null); } try { return(_eventService.GetPositionsForToday(pToken, pVehicule)); } catch (Exception exception) { SendError(exception.Message); return(Enumerable.Empty <IPosition>()); } }
public void CloseSession(IAuthentificationToken pToken) { if (pToken == null) { throw new ArgumentNullException("pToken"); } if (CheckIsDisposed()) { return; } try { _authentificationService.Close(pToken); } catch (Exception exception) { SendError(exception.Message); } }
public bool Close(IAuthentificationToken pToken) { if (pToken == null) { throw new ArgumentNullException("pToken"); } var token = new Token() { Value = pToken.Value }; var authenticateRequest = new AuthenticatedRequest() { UnsafeToken = token }; _client.CloseSession(authenticateRequest); return(true); }
public IEnumerable <IVehicule> GetVehicules(IAuthentificationToken pToken) { if (pToken == null) { throw new ArgumentNullException("pToken"); } var token = new Token() { Value = pToken.Value }; var authenticatedRequest = new AuthenticatedRequest() { UnsafeToken = token }; var response = _client.GetVehicles(authenticatedRequest); if (response == null) { return(Enumerable.Empty <IVehicule>()); } return(response.ConvertToVehicules().ToList()); }