Example #1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicationAdministration;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationAdministrationStatus>)StatusElement.DeepCopy();
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (Practitioner != null)
                {
                    dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)Practitioner.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (Prescription != null)
                {
                    dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.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 (ReasonGiven != null)
                {
                    dest.ReasonGiven = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonGiven.DeepCopy());
                }
                if (EffectiveTime != null)
                {
                    dest.EffectiveTime = (Hl7.Fhir.Model.Element)EffectiveTime.DeepCopy();
                }
                if (Medication != null)
                {
                    dest.Medication = (Hl7.Fhir.Model.Element)Medication.DeepCopy();
                }
                if (Device != null)
                {
                    dest.Device = new List <Hl7.Fhir.Model.ResourceReference>(Device.DeepCopy());
                }
                if (NoteElement != null)
                {
                    dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy();
                }
                if (Dosage != null)
                {
                    dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)Dosage.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Example #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 (InformationSource != null)
                {
                    dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopy();
                }
                if (DateAssertedElement != null)
                {
                    dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatus>)StatusElement.DeepCopy();
                }
                if (WasNotTakenElement != null)
                {
                    dest.WasNotTakenElement = (Hl7.Fhir.Model.FhirBoolean)WasNotTakenElement.DeepCopy();
                }
                if (ReasonNotTaken != null)
                {
                    dest.ReasonNotTaken = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonNotTaken.DeepCopy());
                }
                if (ReasonForUse != null)
                {
                    dest.ReasonForUse = (Hl7.Fhir.Model.Element)ReasonForUse.DeepCopy();
                }
                if (Effective != null)
                {
                    dest.Effective = (Hl7.Fhir.Model.Element)Effective.DeepCopy();
                }
                if (NoteElement != null)
                {
                    dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy();
                }
                if (SupportingInformation != null)
                {
                    dest.SupportingInformation = new List <Hl7.Fhir.Model.ResourceReference>(SupportingInformation.DeepCopy());
                }
                if (Medication != null)
                {
                    dest.Medication = (Hl7.Fhir.Model.Element)Medication.DeepCopy();
                }
                if (Dosage != null)
                {
                    dest.Dosage = new List <Hl7.Fhir.Model.MedicationStatement.DosageComponent>(Dosage.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }