Ejemplo n.º 1
0
        public GraphStatistics GetYearlyGraphStatistics(int cameraId)
        {
            GraphStatistics graphStatistics = new GraphStatistics();
            List <string[]> maxStats        = new List <string[]>();
            //using a placeholder time right now since we dont have data coming in at the same time.
            //Ideally the end datetime should be the current datetime and the add seconds should be bigger for yearly
            DateTime end   = new DateTime(2018, 4, 11, 14, 53, 18);
            DateTime start = end.AddSeconds(-5);

            for (int i = 0; i < 200; i++)
            {
                DatabaseGraphStat value = _databaseQueryService.getGraphStatByTimeInterval(cameraId, start, end);
                int epoch = (int)(value.End - new DateTime(1970, 1, 1)).TotalSeconds;
                maxStats.Add(new string[2] {
                    epoch.ToString(), value.MaximumDetectedObjects.ToString()
                });
                start = start.AddSeconds(5);
                end   = end.AddSeconds(5);
            }
            graphStatistics.Stats = maxStats.ToArray();

            return(graphStatistics);
        }