Exemplo n.º 1
0
        public virtual void GetLastValues_for_sensorType_filters_on_station_and_sensor()
        {
            var dataPoint = CreateDataPoint("s1", "st1");

            _repository.Save(dataPoint);
            _repository.Save(CreateDataPoint("s2", "st1"));
            _repository.Save(CreateDataPoint("s1", "st2"));

            var foundDataPoint = _repository.GetLastValues("s1", "st1");

            DataPoint.IdentityEquals(dataPoint, foundDataPoint).Should().BeTrue();
        }
Exemplo n.º 2
0
 private List <DataPoint> GetLatestDataPoints(string stationId)
 {
     if (stationId == null)
     {
         return(new List <DataPoint>());
     }
     return(_repository.GetLastValues(stationId));
 }
Exemplo n.º 3
0
        public GetDataPointsResponse GetLastStationDataPoints(string stationId)
        {
            var lastValues = _repository.GetLastValues(stationId);

            return(new GetDataPointsResponse
            {
                DataPoints = lastValues.Select(ToDataPointApi).ToList()
            });
        }
        public JsonResult <StationLastValues> GetStationLastValues(string stationId)
        {
            var lastValues = _repository.GetLastValues(stationId);

            var stationData = new StationLastValues
            {
                StationId  = stationId,
                LastValues = ToLastValues(lastValues)
            };

            return(ToJson(stationData));
        }
Exemplo n.º 5
0
        // GET: Sensor
        public ActionResult Details(string stationId, string sensorType, int size = 300, int?reloadSeconds = null)
        {
            var dataPoint = _repository.GetLastValues(stationId, sensorType);

            var model = new SensorDetailsModel
            {
                StationId      = stationId,
                SensorType     = sensorType,
                GuageHtml      = CreateTempratureGuageHtml(dataPoint, size),
                Timestamp      = dataPoint.SensorTimestampUtc.ToString("s"),
                ReloadTimeSpan = GetReloadTimeSpan(reloadSeconds)
            };

            return(View(model));
        }