Exemplo n.º 1
0
        public void UpdateLatestStatus(TypeTrain type, IStatus status)
        {
            var entity = new StatusEntity()
            {
                LineType = type, Status = status.Status, LastUpdate = status.LastUpdate.UtcDateTime
            };

            _dao.Upsert(entity);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public static ILineTrainService GetLineTrainService(this TypeTrain type)
 {
     return(SERVICES[type]);
 }
 public static int GetEntityId(this TypeTrain type)
 {
     return(IDS[type]);
 }
Exemplo n.º 5
0
        public IStatus GetLatestStatus(TypeTrain type)
        {
            var entity = _dao.GetLatestStatus(type);

            return(entity == null ? null : new StatusImpl(entity.Status, DateTime.SpecifyKind(entity.LastUpdate, DateTimeKind.Utc)));
        }