/// <summary> /// Validates this diagnostic investigation /// </summary> /// <param name="path">The path to this object as a string</param> /// <param name="messages">the validation messages, these may be added to within this method</param> public void Validate(string path, List <ValidationMessage> messages) { var vb = new ValidationBuilder(path, messages); if (PathologyTestResult != null && PathologyTestResult.Any()) { PathologyTestResult.ForEach(pathologyTestResult => pathologyTestResult.Validate(path + ".PathologyTestResult", messages)); } if (ImagingExaminationResult != null && ImagingExaminationResult.Any()) { ImagingExaminationResult.ForEach(imagingExaminationResult => imagingExaminationResult.Validate(path + ".ImagingExaminationResult", messages)); } if (RequestedService != null && RequestedService.Any()) { RequestedService.ForEach(requestedService => requestedService.Validate(path + ".RequestedService", messages)); } if (RequestedService == null && ImagingExaminationResult == null && PathologyTestResult == null && OtherTestResult == null) { vb.AddValidationMessage(vb.PathName, null, "Each instance of this Diagnostic Investigations section SHALL have at least one instance of 'PATHOLOGY TEST RESULT' OR 'IMAGING EXAMINATION RESULT' OR 'REQUESTED SERVICE OR 'OTHER TEST RESULT'"); } if (OtherTestResult != null && OtherTestResult.Any()) { OtherTestResult.ForEach(otherTestResult => otherTestResult.Validate(path + ".OtherTestResult", messages)); } }
/// <summary> /// Validates this diagnostic investigation /// </summary> /// <param name="path">The path to this object as a string</param> /// <param name="messages">the validation messages, these may be added to within this method</param> public void Validate(string path, List <ValidationMessage> messages) { var vb = new ValidationBuilder(path, messages); if (PathologyTestResult != null && PathologyTestResult.Any()) { PathologyTestResult.ForEach(pathologyTestResult => pathologyTestResult.Validate(path + ".PathologyTestResult", messages)); } if (ImagingExaminationResult != null && ImagingExaminationResult.Any()) { ImagingExaminationResult.ForEach(imagingExaminationResult => imagingExaminationResult.Validate(path + ".ImagingExaminationResult", messages)); } if (RequestedService != null && RequestedService.Any()) { if (vb.ArgumentRequiredCheck("RequestedService", RequestedService)) { for (var x = 0; x < RequestedService.Count; x++) { RequestedService[x].Validate(vb.Path + string.Format(".RequestedService[{0}]", x), vb.Messages); } } } if (RequestedService == null && ImagingExaminationResult == null && PathologyTestResult == null) { vb.AddValidationMessage(vb.PathName, null, "Each instance of this Diagnostic Investigations section SHALL have at least one instance of 'PATHOLOGY TEST RESULT' OR 'IMAGING EXAMINATION RESULT' OR 'REQUESTED SERVICE'"); } }
/// <summary> /// Validates this diagnostic investigation for a Discharge Summary /// </summary> /// <param name="path">The path to this object as a string</param> /// <param name="messages">the validation messages, these may be added to within this method</param> void IDiagnosticInvestigationsDischargeSummary.Validate(string path, List <ValidationMessage> messages) { if (PathologyTestResult != null && PathologyTestResult.Any()) { PathologyTestResult.ForEach(pathologyTestResult => pathologyTestResult.Validate(path + ".PathologyTestResult", messages)); } if (((IDiagnosticInvestigationsDischargeSummary)this).ImagingExaminationResult != null && ((IDiagnosticInvestigationsDischargeSummary)this).ImagingExaminationResult.Any()) { ((IDiagnosticInvestigationsDischargeSummary)this).ImagingExaminationResult.ForEach(imagingExaminationResult => imagingExaminationResult.Validate(path + ".ImagingExaminationResult", messages)); } if (ClinicalSynopsis != null && ClinicalSynopsis.Any()) { ClinicalSynopsis.ForEach(clinicalSynopsis => clinicalSynopsis.Validate(path + ".ClinicalSynopsis", messages)); } if (OtherTestResult != null && OtherTestResult.Any()) { OtherTestResult.ForEach(otherTestResult => otherTestResult.Validate(path + ".OtherTestResult", messages)); } }