Пример #1
0
        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);
        }
Пример #2
0
        public bool DoesNotificationNeedImage(DatabaseAlert dbAlert, DatabaseNotification dbNotification)
        {
            if (DateTime.Now.Subtract(dbNotification.TriggerDateTime).TotalMinutes <= 30)
            {
                //does notification have an image associated with it?
                List <DatabasePerSecondStat> perSecondStatsWithImageForNotification =
                    _databaseQueryService.GetPerSecondStatsWithFrmTriggeringAlert(dbAlert,
                                                                                  dbNotification.TriggerDateTime, dbNotification.TriggerDateTime.AddMinutes(30));
                return(perSecondStatsWithImageForNotification.IsNullOrEmpty());
            }

            return(false);
        }