public static Event GetEvent(string externalId) { EventHistory eh; using (var service = new EventHistoryService()) { eh = service.GetWhere(EventHistoryService.ExternalIdCol == externalId).FirstOrDefault(); } if (eh == null) { throw new ArgumentException("Invalid external id: " + externalId); } return(eh.Event); }
private static List <Event> GetOpenSMSEventsFor(string fromNumber) { List <Event> events; //add filter with one week ago when Jon adds date comparisons to CRUDService DateTime oneWeekAgo = DateTime.Today.AddDays(-7); using (var eventService = new EventService()) using (var patientService = new PatientService()) using (var service = new EventHistoryService()) { events = service.GetWhere( (PatientService.PhoneCol.In("Event") == fromNumber) & (PatientService.ContactPreferenceCol.In("Event") == ContactPreference.TEXT & EventService.StatusCol == EventStatus.Sent & EventHistoryService.DateCol >= oneWeekAgo)).Select(hist => hist.Event).ToList(); } return(events); }