public void UpdateLatestStatus(TypeTrain type, IStatus status) { var entity = new StatusEntity() { LineType = type, Status = status.Status, LastUpdate = status.LastUpdate.UtcDateTime }; _dao.Upsert(entity); }
public async Task <TrainStatus> GetStatusAsync(TypeTrain type) { var st = _container.GetLatestStatus(type); ILineTrainService service = type.GetLineTrainService(); var status = await service.GetStatusAsync(); //TODO:状態保管するしくみを作成 var tstatus = new TrainStatus(status, DateTimeOffset.Now, true);; _container.UpdateLatestStatus(type, tstatus); return(tstatus); }
public static ILineTrainService GetLineTrainService(this TypeTrain type) { return(SERVICES[type]); }
public static int GetEntityId(this TypeTrain type) { return(IDS[type]); }
public IStatus GetLatestStatus(TypeTrain type) { var entity = _dao.GetLatestStatus(type); return(entity == null ? null : new StatusImpl(entity.Status, DateTime.SpecifyKind(entity.LastUpdate, DateTimeKind.Utc))); }