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

                result.AddRange(base.Validate());

                if (Medication != null)
                {
                    result.AddRange(Medication.Validate());
                }
                if (ValidityPeriod != null)
                {
                    result.AddRange(ValidityPeriod.Validate());
                }
                if (NumberOfRepeatsAllowedElement != null)
                {
                    result.AddRange(NumberOfRepeatsAllowedElement.Validate());
                }
                if (Quantity != null)
                {
                    result.AddRange(Quantity.Validate());
                }
                if (ExpectedSupplyDuration != null)
                {
                    result.AddRange(ExpectedSupplyDuration.Validate());
                }

                return(result);
            }
Esempio n. 2
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as MedicationPrescriptionDispenseComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (Medication != null)
                    {
                        dest.Medication = (Hl7.Fhir.Model.ResourceReference)Medication.DeepCopy();
                    }
                    if (ValidityPeriod != null)
                    {
                        dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopy();
                    }
                    if (NumberOfRepeatsAllowedElement != null)
                    {
                        dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.Integer)NumberOfRepeatsAllowedElement.DeepCopy();
                    }
                    if (Quantity != null)
                    {
                        dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopy();
                    }
                    if (ExpectedSupplyDuration != null)
                    {
                        dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)ExpectedSupplyDuration.DeepCopy();
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }