private bool IsEventMilestoneMatched(EventMilestone eventMilestone, PeriodEventsFilterInputInfo periodEventsFilterInput) { if ((periodEventsFilterInput == null)) { return(true); } var daysToBreachAt = eventMilestone.GetDaysToBreachAt(_clock.TodayDate); var isEventMilestoneMatched = (String.IsNullOrEmpty(periodEventsFilterInput.Specialty) || eventMilestone.CompletedEvent.Clinician.Specialty.Name.ToLowerInvariant().Contains(periodEventsFilterInput.Specialty.ToLowerInvariant())) && (periodEventsFilterInput.TargetYear == null || (eventMilestone.BreachDate != null && eventMilestone.BreachDate.Value.Year == periodEventsFilterInput.TargetYear)) && (periodEventsFilterInput.ActualYear == null) && (string.IsNullOrEmpty(periodEventsFilterInput.EventDescription) || eventMilestone.Name.Description.Contains(periodEventsFilterInput.EventDescription)); if (periodEventsFilterInput.Breaches == null) { return(isEventMilestoneMatched); } if (daysToBreachAt == null) { return(false); } if (periodEventsFilterInput.Breaches < 0) { return(isEventMilestoneMatched && (((int)daysToBreachAt) < 0)); } if (periodEventsFilterInput.Breaches == FourDaysToBreach) { return(isEventMilestoneMatched && (((int)daysToBreachAt) >= FourDaysToBreach)); } return(isEventMilestoneMatched && daysToBreachAt == periodEventsFilterInput.Breaches); }
private bool IsCompletedEventMatched(CompletedEvent completedEvent, PeriodEventsFilterInputInfo periodEventsFilterInput) { if (periodEventsFilterInput == null) { return(true); } var isCompletedEventMatched = (String.IsNullOrEmpty(periodEventsFilterInput.Specialty) || completedEvent.Clinician.Specialty.Name.ToLowerInvariant().Contains(periodEventsFilterInput.Specialty.ToLowerInvariant())) && (periodEventsFilterInput.TargetYear == null || (completedEvent.TargetDate != null && completedEvent.TargetDate.Value.Year == periodEventsFilterInput.TargetYear)) && (periodEventsFilterInput.ActualYear == null || completedEvent.EventDate.Year == periodEventsFilterInput.ActualYear) && (string.IsNullOrEmpty(periodEventsFilterInput.EventDescription) || completedEvent.Name.Description.Contains(periodEventsFilterInput.EventDescription)); if (periodEventsFilterInput.Breaches == null) { return(isCompletedEventMatched); } if (periodEventsFilterInput.Breaches < 0) { return(isCompletedEventMatched && completedEvent.PostBreachDays != null && completedEvent.PostBreachDays.Value > 0); } return(false); }