public bool DisableAlert(AlertDisablingInformation alertDisablingInformation) { DatabaseAlert dbAlert = _dbQueryService.GetAlertById(alertDisablingInformation.AlertId); DateTime disabledUntilDateTime = DateTime.MaxValue; if (!alertDisablingInformation.DisableForever && alertDisablingInformation.DisabledUntil != null) { disabledUntilDateTime = alertDisablingInformation.DisabledUntil.Value; } else if (!alertDisablingInformation.DisableForever && alertDisablingInformation.DisabledUntil == null) { throw new InvalidDataException("Told to disable alert temporarily but no end date"); } dbAlert.DisabledUntil = disabledUntilDateTime; return(_dbQueryService.PersistExistingAlert(dbAlert)); }
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); }
public JpgStatFrameList GetTriggeringStatsFrameList(int notificationId) { DatabaseNotification dbNotification = _dbQueryService.GetNotificationById(notificationId); DatabaseAlert dbAlert = _dbQueryService.GetAlertById(dbNotification.AlertId); List <DatabasePerSecondStat> statsForCamera = _dbQueryService.GetPerSecondStatsWithFrmTriggeringAlert(dbAlert, dbNotification.TriggerDateTime, dbNotification.TriggerDateTime.AddMinutes(30)); JpgStatFrameList frmList = new JpgStatFrameList(); frmList.JpgFramePathList = new List <FrameInformation>(); foreach (DatabasePerSecondStat stat in statsForCamera) { if (!stat.FrameJpgPath.IsNullOrEmpty()) { FrameInformation frmInfo = new FrameInformation(stat); if (frmInfo.FrmJpgRelPath.IsNullOrEmpty() == false) { frmList.JpgFramePathList.Add(frmInfo); } } } return(frmList); }