/// <summary> /// A thread-safe method for testing alerts /// </summary> /// <param name="subject"></param> /// <param name="context"></param> /// <returns>A list of alert notifications on this subject</returns> public IList <AlertNotification> Test(Entity subject, IPersistenceContext context) { var alertNotifications = new List <AlertNotification>(); if (subject.Is <Patient>()) { foreach (var test in _patientAlertTests) { var result = test.Test(subject.Downcast <Patient>(), context); if (result != null) { alertNotifications.Add(result); } } } else if (subject.Is <PatientProfile>()) { foreach (var test in _patientProfileAlertTests) { AlertNotification result = test.Test(subject.Downcast <PatientProfile>(), context); if (result != null) { alertNotifications.Add(result); } } } else if (subject.Is <Order>()) { foreach (var test in _orderAlertTests) { var result = test.Test(subject.Downcast <Order>(), context); if (result != null) { alertNotifications.Add(result); } } } else if (subject.Is <ExternalPractitioner>()) { foreach (var test in _externalPractitionerAlertTests) { var result = test.Test(subject.Downcast <ExternalPractitioner>(), context); if (result != null) { alertNotifications.Add(result); } } } return(alertNotifications); }
public AlertNotificationDetail CreateAlertNotification(AlertNotification alertNotification) { return new AlertNotificationDetail( alertNotification.AlertId, new List<string>(alertNotification.Reasons)); }