Пример #1
0
        public List <AlertSummary> GetAllActiveAlertsForCameraKey(string cameraKey)
        {
            int cameraId = _dbQueryService.GetCameraIdFromKey(cameraKey);
            List <DatabaseAlert> dbAlerts  = _dbQueryService.GetAlertsByCameraId(cameraId);
            List <AlertSummary>  alertList = new List <AlertSummary>();

            foreach (var dbAlert in dbAlerts)
            {
                if (dbAlert.DisabledUntil.GetValueOrDefault(DateTime.MinValue) < DateTime.Now &&
                    (dbAlert.StartTime.IsNullOrEmpty() || dbAlert.StartTime.ToDateTime() < DateTime.Now) &&
                    (dbAlert.EndTime.IsNullOrEmpty() || dbAlert.EndTime.ToDateTime() > DateTime.Now))
                {
                    AlertSummary alertSummary = new AlertSummary(dbAlert);
                    alertSummary.NeedsImage = DoesAlertNeedsFrameImage(dbAlert);
                    alertList.Add(alertSummary);
                }
            }

            return(alertList);
        }