Ejemplo n.º 1
0
        public NotificationDetails GetNotificationDetailsById(int notificationId)
        {
            NotificationDetails notification = new NotificationDetails(_databaseQueryService.GetNotificationById(notificationId));

            notification.Alert                 = new AlertDetails(_databaseQueryService.GetAlertById(notification.AlertId));
            notification.Alert.Camera          = new CameraDetails(_databaseQueryService.GetCameraById(notification.Alert.CameraId));
            notification.Alert.Camera.Location = new LocationDetails(_databaseQueryService.GetLocationById(notification.Alert.Camera.LocationId));
            return(notification);
        }
Ejemplo n.º 2
0
        public CameraStatistics getCameraStatisticsForNowById(int cameraId)
        {
            DatabaseCamera camera = _dbQueryService.GetCameraById(cameraId);
            DatabaseRoom   room   = null;

            if (camera != null && camera.RoomId != null)
            {
                room = _dbQueryService.GetRoomById(camera.RoomId.Value);
            }
            DatabasePerSecondStat mostRecentStat  = _dbQueryService.GetLatestPerSecondStatForCamera(cameraId);
            GraphStatistics       graphStatistics = _graphStatisticsService.GetLast30MinutesStatistics(cameraId);

            if (camera != null)
            {
                CameraStatistics cameraStatistics = new CameraStatistics
                {
                    CameraInformation                         = new CameraInformation(camera),
                    CameraDetails                             = new CameraDetails(camera),
                    DayTimeOfTheWeekAverageCount              = 0,
                    DayTimeOfTheWeekAverageCountAvailable     = false,
                    DayTimeOfTheWeekAverageCountDisplayString = null,
                    LastUpdatedTime                           = null,
                    MostRecentPeopleCount                     = null,
                    PeriodOfTheDayAverageCount                = 0,
                    PeriodOfTheDayAverageCountAvailable       = false,
                    PeriodOfTheDayAverageCountDisplayString   = null,
                    GraphStatistics                           = graphStatistics,
                    TempImagePath                             = null
                };
                if (room != null)
                {
                    cameraStatistics.CameraDetails.MonitoredArea      = room.RoomName;
                    cameraStatistics.CameraInformation.CameraRoomName = room.RoomName;
                    cameraStatistics.CameraInformation.RoomId         = room.RoomId;
                }

                if (mostRecentStat != null)
                {
                    cameraStatistics.LastUpdatedTime       = mostRecentStat.DateTime;
                    cameraStatistics.MostRecentPeopleCount = mostRecentStat.NumDetectedObjects;
                }
                if (camera.LocationId != null)
                {
                    cameraStatistics.CameraDetails.Location = new LocationDetails(_dbQueryService.GetLocationById(camera.LocationId.Value));
                }

                cameraStatistics.CameraInformation.TempImagePath = GetTempPathFromFullPath(camera.ImagePath);

                return(cameraStatistics);
            }

            return(null);
        }
Ejemplo n.º 3
0
        private AlertTriggeredEmailInformation GetAlertTriggeredInformation(DatabaseAlert alert,
                                                                            DatabasePerSecondStat earliestStatThatTriggersAlert, DatabaseUser user)
        {
            DatabaseCamera camera = _databaseQueryService.GetCameraById(alert.CameraId);
            AlertTriggeredEmailInformation alertEmailInformation = new AlertTriggeredEmailInformation
            {
                CameraName    = camera.CameraName,
                AlertName     = alert.AlertName,
                DateTriggered = earliestStatThatTriggersAlert.DateTime
            };

            alertEmailInformation.Name = GetUserName(user);

            if (camera.LocationId != null)
            {
                alertEmailInformation.LocationName = _databaseQueryService.GetLocationById(camera.LocationId.Value).LocationName;
            }

            return(alertEmailInformation);
        }