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

            result.AddRange(base.Validate());

            if (Identifier != null)
            {
                Identifier.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (DateWrittenElement != null)
            {
                result.AddRange(DateWrittenElement.Validate());
            }
            if (StatusElement != null)
            {
                result.AddRange(StatusElement.Validate());
            }
            if (Patient != null)
            {
                result.AddRange(Patient.Validate());
            }
            if (Prescriber != null)
            {
                result.AddRange(Prescriber.Validate());
            }
            if (Encounter != null)
            {
                result.AddRange(Encounter.Validate());
            }
            if (ReasonForPrescribing != null)
            {
                result.AddRange(ReasonForPrescribing.Validate());
            }
            if (Medication != null)
            {
                result.AddRange(Medication.Validate());
            }
            if (DosageInstruction != null)
            {
                DosageInstruction.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Dispense != null)
            {
                result.AddRange(Dispense.Validate());
            }
            if (Substitution != null)
            {
                result.AddRange(Substitution.Validate());
            }

            return(result);
        }
Example #2
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicationOrder;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (DateWrittenElement != null)
                {
                    dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)DateWrittenElement.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationOrder.MedicationOrderStatus>)StatusElement.DeepCopy();
                }
                if (DateEndedElement != null)
                {
                    dest.DateEndedElement = (Hl7.Fhir.Model.FhirDateTime)DateEndedElement.DeepCopy();
                }
                if (ReasonEnded != null)
                {
                    dest.ReasonEnded = (Hl7.Fhir.Model.CodeableConcept)ReasonEnded.DeepCopy();
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (Prescriber != null)
                {
                    dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)Prescriber.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (Reason != null)
                {
                    dest.Reason = (Hl7.Fhir.Model.Element)Reason.DeepCopy();
                }
                if (NoteElement != null)
                {
                    dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy();
                }
                if (Medication != null)
                {
                    dest.Medication = (Hl7.Fhir.Model.Element)Medication.DeepCopy();
                }
                if (DosageInstruction != null)
                {
                    dest.DosageInstruction = new List <Hl7.Fhir.Model.MedicationOrder.MedicationOrderDosageInstructionComponent>(DosageInstruction.DeepCopy());
                }
                if (DispenseRequest != null)
                {
                    dest.DispenseRequest = (Hl7.Fhir.Model.MedicationOrder.MedicationOrderDispenseRequestComponent)DispenseRequest.DeepCopy();
                }
                if (Substitution != null)
                {
                    dest.Substitution = (Hl7.Fhir.Model.MedicationOrder.MedicationOrderSubstitutionComponent)Substitution.DeepCopy();
                }
                if (PriorPrescription != null)
                {
                    dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)PriorPrescription.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicationDispense;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus>)StatusElement.DeepCopy();
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (Dispenser != null)
                {
                    dest.Dispenser = (Hl7.Fhir.Model.ResourceReference)Dispenser.DeepCopy();
                }
                if (AuthorizingPrescription != null)
                {
                    dest.AuthorizingPrescription = new List <Hl7.Fhir.Model.ResourceReference>(AuthorizingPrescription.DeepCopy());
                }
                if (Type != null)
                {
                    dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                }
                if (Quantity != null)
                {
                    dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopy();
                }
                if (DaysSupply != null)
                {
                    dest.DaysSupply = (Hl7.Fhir.Model.Quantity)DaysSupply.DeepCopy();
                }
                if (Medication != null)
                {
                    dest.Medication = (Hl7.Fhir.Model.ResourceReference)Medication.DeepCopy();
                }
                if (WhenPreparedElement != null)
                {
                    dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)WhenPreparedElement.DeepCopy();
                }
                if (WhenHandedOverElement != null)
                {
                    dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopy();
                }
                if (Destination != null)
                {
                    dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopy();
                }
                if (Receiver != null)
                {
                    dest.Receiver = new List <Hl7.Fhir.Model.ResourceReference>(Receiver.DeepCopy());
                }
                if (NoteElement != null)
                {
                    dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy();
                }
                if (DosageInstruction != null)
                {
                    dest.DosageInstruction = new List <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDosageInstructionComponent>(DosageInstruction.DeepCopy());
                }
                if (Substitution != null)
                {
                    dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.MedicationDispenseSubstitutionComponent)Substitution.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }