/// <summary> /// Validates this IAnatomicalSiteExtended Site /// </summary> /// <param name="path">The path to this object as a string</param> /// <param name="messages">the validation messages to date, these may be added to within this method</param> void IAnatomicalSiteExtended.Validate(string path, List <ValidationMessage> messages) { var vb = new ValidationBuilder(path, messages); if (SpecificLocation != null) { SpecificLocation.Validate(vb.Path + "AnatomicalLocation", messages); var choice1 = new Dictionary <string, object>() { { "AnatomicalLocation.NameOfLocation", SpecificLocation.NameOfLocation }, { "Description", Description } }; var choice2 = new Dictionary <string, object>() { { "AnatomicalLocation.Side", SpecificLocation.Side }, { "Description", Description } }; vb.ChoiceCheck(choice1); vb.ChoiceCheck(choice2); } }
/// <summary> /// Validates this Anatomical Site /// </summary> /// <param name="path">The path to this object as a string</param> /// <param name="messages">the validation messages to date, these may be added to within this method</param> public void Validate(string path, List <ValidationMessage> messages) { var vb = new ValidationBuilder(path, messages); if (SpecificLocation != null) { SpecificLocation.Validate(vb.Path + "AnatomicalLocation", messages); if (SpecificLocation.NameOfLocation != null && !SpecificLocation.NameOfLocation.HasCodeSystem) { if (SpecificLocation.Side != null) { vb.AddValidationMessage(vb.PathName, null, "Can not have only a NameOfLocation (original text) and a Side"); } } } if (!Description.IsNullOrEmptyWhitespace()) { if (SpecificLocation != null && SpecificLocation.Side != null) { vb.AddValidationMessage(vb.PathName, null, "Can not have a description (original text) and a Side"); } } // ReSharper disable once AssignNullToNotNullAttribute if ((new StackTrace()).GetFrames().Any(t => t.GetMethod().Name.Contains(CDADocumentType.EventSummary.ToString()))) { // Only for EventSummary at this point eventually the if statement above will be removed var choice1 = new Dictionary <string, object> { { "AnatomicalLocation", SpecificLocation }, { "Description", Description } }; vb.ChoiceCheck(choice1); } ; if (Images != null && Images.Any()) { foreach (var image in Images) { if (image != null) { if ( image.ExternalDataMediaType == MediaType.GIF || image.ExternalDataMediaType == MediaType.JPEG || image.ExternalDataMediaType == MediaType.PNG ) { image.Validate(vb.Path + "Images", messages); } else { vb.AddValidationMessage(vb.PathName, null, "The image must be of a type GIF, JPEG or a PNG"); } } } } }