Esempio n. 1
0
        /// <summary>
        /// Validates this Adverse Substance Reaction
        /// </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 (AdverseSubstanceReaction != null)
            {
                for (var x = 0; x < AdverseSubstanceReaction.Count; x++)
                {
                    AdverseSubstanceReaction[x].Validate(vb.Path + string.Format("AdverseSubstanceReaction[{0}]", x), vb.Messages);
                }
            }

            // Adverse reactions exclusion statement choice
            var adverseChoice = new Dictionary <string, object>()
            {
                { "AdverseSubstanceReaction", AdverseSubstanceReaction },
                { "GeneralStatement", ExclusionStatement }
            };

            vb.ChoiceCheck(adverseChoice);

            // Validate exclusion statement
            if (ExclusionStatement != null)
            {
                ExclusionStatement.Validate(vb.Path + "GeneralStatement", vb.Messages);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Validates this medications object as a reviewed medications
        /// </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 IMedications.Validate(string path, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            var medicationsList = ((IMedications)this).Medications;

            if (medicationsList != null)
            {
                for (var x = 0; x < medicationsList.Count; x++)
                {
                    medicationsList[x].Validate(vb.Path + string.Format("MedicationsList[{0}]", x), vb.Messages);
                }
            }

            // Medications exclusion statement choice
            var adverseChoice = new Dictionary <string, object>()
            {
                { "Medications", medicationsList },
                { "GeneralStatement", ExclusionStatement }
            };

            vb.ChoiceCheck(adverseChoice);

            // Validate exclusion statement
            if (ExclusionStatement != null)
            {
                ExclusionStatement.Validate(vb.Path + "GeneralStatement", vb.Messages);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Validates this Adverse Substance Reaction
        /// </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 IAdverseReactionsWithoutExclusions.Validate(string path, List <ValidationMessage> messages)
        {
            var vb = new ValidationBuilder(path, messages);

            if (AdverseSubstanceReaction != null)
            {
                for (var x = 0; x < AdverseSubstanceReaction.Count; x++)
                {
                    AdverseSubstanceReaction[x].Validate(vb.Path + string.Format("AdverseSubstanceReaction[{0}]", x), vb.Messages);
                }
            }

            // AdverseSubstanceReaction
            if (AdverseSubstanceReaction == null || !AdverseSubstanceReaction.Any())
            {
                vb.AddValidationMessage(vb.PathName + ".AdverseSubstanceReaction", null, "At least one AdverseSubstanceReaction must be specified");
            }

            // Validate exclusion statement
            if (ExclusionStatement != null)
            {
                ExclusionStatement.Validate(vb.Path + "GeneralStatement", vb.Messages);
            }
        }