private Boolean CheckMedicationStartDateWithNoEndDateBeforeStart(int conceptId, DateTime startDate, long patientMedicationId) { if (patientMedicationId > 0) { return(PatientMedications .OrderBy(pc => pc.StartDate) .Where(pc => pc.Id != patientMedicationId && pc.Concept?.Id == conceptId && startDate < pc.StartDate && pc.Archived == false) .Any()); } else { return(PatientMedications .OrderBy(pc => pc.StartDate) .Where(pc => pc.Concept?.Id == conceptId && startDate < pc.StartDate && pc.Archived == false) .Any()); } }
private Boolean CheckMedicationEndDateWithinRange(int conceptId, DateTime endDate, long patientMedicationId) { if (patientMedicationId > 0) { return(PatientMedications .OrderBy(pc => pc.StartDate) .Where(pc => pc.Id != patientMedicationId && pc.Concept?.Id == conceptId && endDate >= pc.StartDate && endDate <= pc.EndDate && pc.Archived == false) .Any()); } else { return(PatientMedications .OrderBy(pc => pc.StartDate) .Where(pc => pc.Concept?.Id == conceptId && endDate >= pc.StartDate && endDate <= pc.EndDate && pc.Archived == false) .Any()); } }