Exemplo n.º 1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Address;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (UseElement != null)
                {
                    dest.UseElement = (Code <Hl7.Fhir.Model.Address.AddressUse>)UseElement.DeepCopy();
                }
                if (TextElement != null)
                {
                    dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopy();
                }
                if (LineElement != null)
                {
                    dest.LineElement = new List <Hl7.Fhir.Model.FhirString>(LineElement.DeepCopy());
                }
                if (CityElement != null)
                {
                    dest.CityElement = (Hl7.Fhir.Model.FhirString)CityElement.DeepCopy();
                }
                if (StateElement != null)
                {
                    dest.StateElement = (Hl7.Fhir.Model.FhirString)StateElement.DeepCopy();
                }
                if (ZipElement != null)
                {
                    dest.ZipElement = (Hl7.Fhir.Model.FhirString)ZipElement.DeepCopy();
                }
                if (CountryElement != null)
                {
                    dest.CountryElement = (Hl7.Fhir.Model.FhirString)CountryElement.DeepCopy();
                }
                if (Period != null)
                {
                    dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Exemplo n.º 2
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (UseElement != null)
            {
                result.AddRange(UseElement.Validate());
            }
            if (TextElement != null)
            {
                result.AddRange(TextElement.Validate());
            }
            if (LineElement != null)
            {
                LineElement.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (CityElement != null)
            {
                result.AddRange(CityElement.Validate());
            }
            if (StateElement != null)
            {
                result.AddRange(StateElement.Validate());
            }
            if (ZipElement != null)
            {
                result.AddRange(ZipElement.Validate());
            }
            if (CountryElement != null)
            {
                result.AddRange(CountryElement.Validate());
            }
            if (Period != null)
            {
                result.AddRange(Period.Validate());
            }

            return(result);
        }