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

            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.SupplyDelivery.SupplyDeliveryStatus>)StatusElement.DeepCopy();
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (Type != null)
                {
                    dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                }
                if (Quantity != null)
                {
                    dest.Quantity = (Hl7.Fhir.Model.SimpleQuantity)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 (TimeElement != null)
                {
                    dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.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");
            }
        }
Exemple #2
0
            public override ErrorList Validate()
            {
                var result = new ErrorList();

                result.AddRange(base.Validate());

                if (Identifier != null)
                {
                    result.AddRange(Identifier.Validate());
                }
                if (StatusElement != null)
                {
                    result.AddRange(StatusElement.Validate());
                }
                if (Type != null)
                {
                    result.AddRange(Type.Validate());
                }
                if (Quantity != null)
                {
                    result.AddRange(Quantity.Validate());
                }
                if (Medication != null)
                {
                    result.AddRange(Medication.Validate());
                }
                if (WhenPrepared != null)
                {
                    result.AddRange(WhenPrepared.Validate());
                }
                if (WhenHandedOver != null)
                {
                    result.AddRange(WhenHandedOver.Validate());
                }
                if (Destination != null)
                {
                    result.AddRange(Destination.Validate());
                }
                if (Receiver != null)
                {
                    Receiver.ForEach(elem => result.AddRange(elem.Validate()));
                }
                if (Dosage != null)
                {
                    Dosage.ForEach(elem => result.AddRange(elem.Validate()));
                }

                return(result);
            }