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"); } }
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 (SuppliedItem != null) { result.AddRange(SuppliedItem.Validate()); } if (Supplier != null) { result.AddRange(Supplier.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())); } return(result); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as SupplyDelivery; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (BasedOn != null) { dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy()); } if (PartOf != null) { dest.PartOf = new List <Hl7.Fhir.Model.ResourceReference>(PartOf.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 (SuppliedItem != null) { dest.SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)SuppliedItem.DeepCopy(); } if (Occurrence != null) { dest.Occurrence = (Hl7.Fhir.Model.Element)Occurrence.DeepCopy(); } if (Supplier != null) { dest.Supplier = (Hl7.Fhir.Model.ResourceReference)Supplier.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); }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Identifier != null) && (Identifier.Count != 0)) { writer.WritePropertyName("identifier"); writer.WriteStartArray(); foreach (Identifier valIdentifier in Identifier) { valIdentifier.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((BasedOn != null) && (BasedOn.Count != 0)) { writer.WritePropertyName("basedOn"); writer.WriteStartArray(); foreach (Reference valBasedOn in BasedOn) { valBasedOn.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((PartOf != null) && (PartOf.Count != 0)) { writer.WritePropertyName("partOf"); writer.WriteStartArray(); foreach (Reference valPartOf in PartOf) { valPartOf.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Status)) { writer.WriteString("status", (string)Status !); } if (_Status != null) { writer.WritePropertyName("_status"); _Status.SerializeJson(writer, options); } if (Patient != null) { writer.WritePropertyName("patient"); Patient.SerializeJson(writer, options); } if (Type != null) { writer.WritePropertyName("type"); Type.SerializeJson(writer, options); } if (SuppliedItem != null) { writer.WritePropertyName("suppliedItem"); SuppliedItem.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(OccurrenceDateTime)) { writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !); } if (_OccurrenceDateTime != null) { writer.WritePropertyName("_occurrenceDateTime"); _OccurrenceDateTime.SerializeJson(writer, options); } if (OccurrencePeriod != null) { writer.WritePropertyName("occurrencePeriod"); OccurrencePeriod.SerializeJson(writer, options); } if (OccurrenceTiming != null) { writer.WritePropertyName("occurrenceTiming"); OccurrenceTiming.SerializeJson(writer, options); } if (Supplier != null) { writer.WritePropertyName("supplier"); Supplier.SerializeJson(writer, options); } if (Destination != null) { writer.WritePropertyName("destination"); Destination.SerializeJson(writer, options); } if ((Receiver != null) && (Receiver.Count != 0)) { writer.WritePropertyName("receiver"); writer.WriteStartArray(); foreach (Reference valReceiver in Receiver) { valReceiver.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }