예제 #1
0
        /// <summary>
        /// Validates this specimen detail
        /// </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 validationBuilder = new ValidationBuilder(path, messages);

            validationBuilder.ArgumentRequiredCheck("CollectionDateTime", CollectionDateTime);

            if (AnatomicalSite != null && AnatomicalSite.Any())
            {
                AnatomicalSite.ForEach(anatomicalSite => anatomicalSite.Validate(path + ".AnatomicalSite", messages));
            }

            if (PhysicalDetails != null && PhysicalDetails.Any())
            {
                PhysicalDetails.ForEach(physicalDetail => physicalDetail.Validate(path + ".PhysicalDetails", messages));

                if (PhysicalDetails.Count > 1)
                {
                    validationBuilder.AddValidationMessage(path + ".physicalDetails", null, "Only one physical details item can be specified");
                }
            }

            if (SpecimenTissueType != null)
            {
                SpecimenTissueType.Validate(path + ".SpecimenTissueType", messages);
            }

            if (CollectionProcedure != null)
            {
                CollectionProcedure.Validate(path + ".CollectionProcedure", messages);
            }

            if (SamplingPreconditions != null)
            {
                SamplingPreconditions.Validate(path + ".SamplingPreconditions", messages);
            }

            if (SpecimenIdentifier != null)
            {
                SpecimenIdentifier.Validate(path + ".SpecimenIdentifier", messages);
            }

            if (ParentSpecimenIdentifier != null)
            {
                ParentSpecimenIdentifier.Validate(path + ".ParentSpecimenIdentifier", messages);
            }

            if (ContainerIdentifier != null)
            {
                ContainerIdentifier.Validate(path + ".ContainerIdentifier", messages);
            }
        }
예제 #2
0
        /// <summary>
        /// Validates this specimen detail with a PIT narrative
        /// </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>
        /// <param name="xPreNarrative">Indicate whether an xPreNarrative is used for this validation</param>
        public void Validate(string path, List <ValidationMessage> messages, Boolean xPreNarrative)
        {
            var validationBuilder = new ValidationBuilder(path, messages);

            Validate(path, messages);

            if (xPreNarrative)
            {
                if (AnatomicalSite != null && AnatomicalSite.Any())
                {
                    foreach (var anatomicalSite in AnatomicalSite)
                    {
                        if (anatomicalSite.Images != null && anatomicalSite.Images.Any())
                        {
                            foreach (var images in anatomicalSite.Images)
                            {
                                if (images != null)
                                {
                                    validationBuilder.AddValidationMessage(path + ".Images", null, "AnatomicalSite Images can not be included where PathologyTestResult - xPreNarrative is specified");
                                }
                            }
                        }
                    }
                }

                if (PhysicalDetails != null && PhysicalDetails.Any())
                {
                    foreach (var physicalDetails in PhysicalDetails)
                    {
                        if (physicalDetails.Image != null)
                        {
                            validationBuilder.AddValidationMessage(path + ".Images", null, "PhysicalDetails - Image can not be included where PathologyTestResult - xPreNarrative is specified");
                        }
                    }
                }
            }
        }