Пример #1
0
        public void EscalateAlert(Alert alert)
        {
            if (alert == null || !_ongoingAlerts.Any(a => a.Id.Equals(alert.Id)))
            {
                throw new Exception("Alert not found");
            }

            var escalatePerson = _scheduleManager.GetEscalatePerson();

            if (escalatePerson == null)
            {
                JanelObserver.EventManager.Dispatch(new ErrorOccurred($"No one responded to alert {alert.Id}"));
            }
            else
            {
                alert.Status    = StatusType.Escalated;
                alert.UpdatedAt = _dateTimeManager.GetNow();

                _unitOfWork.AlertRepository.Update(alert);

                JanelObserver.EventManager.Dispatch(new AlertEscalated(alert, escalatePerson));
            }
        }