public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (Identifier != null)
            {
                Identifier.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (StatusElement != null)
            {
                result.AddRange(StatusElement.Validate());
            }
            if (Patient != null)
            {
                result.AddRange(Patient.Validate());
            }
            if (Practitioner != null)
            {
                result.AddRange(Practitioner.Validate());
            }
            if (Encounter != null)
            {
                result.AddRange(Encounter.Validate());
            }
            if (Prescription != null)
            {
                result.AddRange(Prescription.Validate());
            }
            if (WasNotGivenElement != null)
            {
                result.AddRange(WasNotGivenElement.Validate());
            }
            if (ReasonNotGiven != null)
            {
                ReasonNotGiven.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (WhenGiven != null)
            {
                result.AddRange(WhenGiven.Validate());
            }
            if (Medication != null)
            {
                result.AddRange(Medication.Validate());
            }
            if (AdministrationDevice != null)
            {
                AdministrationDevice.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Dosage != null)
            {
                Dosage.ForEach(elem => result.AddRange(elem.Validate()));
            }

            return(result);
        }
Пример #2
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicationStatement;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (WasNotGivenElement != null)
                {
                    dest.WasNotGivenElement = (Hl7.Fhir.Model.FhirBoolean)WasNotGivenElement.DeepCopy();
                }
                if (ReasonNotGiven != null)
                {
                    dest.ReasonNotGiven = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonNotGiven.DeepCopy());
                }
                if (WhenGiven != null)
                {
                    dest.WhenGiven = (Hl7.Fhir.Model.Period)WhenGiven.DeepCopy();
                }
                if (Medication != null)
                {
                    dest.Medication = (Hl7.Fhir.Model.ResourceReference)Medication.DeepCopy();
                }
                if (Device != null)
                {
                    dest.Device = new List <Hl7.Fhir.Model.ResourceReference>(Device.DeepCopy());
                }
                if (Dosage != null)
                {
                    dest.Dosage = new List <Hl7.Fhir.Model.MedicationStatement.MedicationStatementDosageComponent>(Dosage.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }