예제 #1
0
 public IEnumerable <MessageViewModel> Messages()
 {
     return(_eventLogBusiness.GetMessages()
            .Select(message => new MessageViewModel
     {
         Id = message.Id,
         Title = message.Title,
         Date = message.Date,
         Type = message.Type
     }));
 }
예제 #2
0
        private void Notify(object state)
        {
            var messages = _eventLogBusiness.GetMessages(_lastNotifyTime);

            //_logHub.Notify();
            if (messages.Any() == false)
            {
                return;
            }
            _logHub.MessageUpdate(messages);


            if (messages.Any(message => message.Type == MessageType.Error))
            {
                var currentHourErrors = _eventLogBusiness.GetErrorsBySource(DateTime.Now.Date, DateTime.Now.Hour);
                _logHub.HourlyErrorUpdate(currentHourErrors);
            }

            //var lastHour = DateTime.Now.AddHours(-1);
            //var lastHourErrors = _eventLogBusiness.GetErrorsBySource(lastHour, lastHour.Hour);

            _lastNotifyTime = DateTime.Now;
        }