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

                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.Supply.SupplyDispenseStatus>)StatusElement.DeepCopy();
                    }
                    if (Type != null)
                    {
                        dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                    }
                    if (Quantity != null)
                    {
                        dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopy();
                    }
                    if (SuppliedItem != null)
                    {
                        dest.SuppliedItem = (Hl7.Fhir.Model.ResourceReference)SuppliedItem.DeepCopy();
                    }
                    if (Supplier != null)
                    {
                        dest.Supplier = (Hl7.Fhir.Model.ResourceReference)Supplier.DeepCopy();
                    }
                    if (WhenPrepared != null)
                    {
                        dest.WhenPrepared = (Hl7.Fhir.Model.Period)WhenPrepared.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());
                    }
                    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");
            }
        }