Esempio n. 1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Invoice;

            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 = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.Invoice.InvoiceStatus>)StatusElement.DeepCopy();
            }
            if (CancelledReasonElement != null)
            {
                dest.CancelledReasonElement = (Hl7.Fhir.Model.FhirString)CancelledReasonElement.DeepCopy();
            }
            if (Type != null)
            {
                dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (Recipient != null)
            {
                dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopy();
            }
            if (DateElement != null)
            {
                dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
            }
            if (Participant != null)
            {
                dest.Participant = new List <Hl7.Fhir.Model.Invoice.ParticipantComponent>(Participant.DeepCopy());
            }
            if (Issuer != null)
            {
                dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopy();
            }
            if (Account != null)
            {
                dest.Account = (Hl7.Fhir.Model.ResourceReference)Account.DeepCopy();
            }
            if (LineItem != null)
            {
                dest.LineItem = new List <Hl7.Fhir.Model.Invoice.LineItemComponent>(LineItem.DeepCopy());
            }
            if (TotalPriceComponent != null)
            {
                dest.TotalPriceComponent = new List <Hl7.Fhir.Model.Invoice.PriceComponentComponent>(TotalPriceComponent.DeepCopy());
            }
            if (TotalNet != null)
            {
                dest.TotalNet = (Hl7.Fhir.Model.Money)TotalNet.DeepCopy();
            }
            if (TotalGross != null)
            {
                dest.TotalGross = (Hl7.Fhir.Model.Money)TotalGross.DeepCopy();
            }
            if (PaymentTerms != null)
            {
                dest.PaymentTerms = (Hl7.Fhir.Model.Markdown)PaymentTerms.DeepCopy();
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            return(dest);
        }
Esempio n. 2
0
        /// <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 !);
            }


            ((Fhir.R4.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 (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

            if (_Status != null)
            {
                writer.WritePropertyName("_status");
                _Status.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(CancelledReason))
            {
                writer.WriteString("cancelledReason", (string)CancelledReason !);
            }

            if (_CancelledReason != null)
            {
                writer.WritePropertyName("_cancelledReason");
                _CancelledReason.SerializeJson(writer, options);
            }

            if (Type != null)
            {
                writer.WritePropertyName("type");
                Type.SerializeJson(writer, options);
            }

            if (Subject != null)
            {
                writer.WritePropertyName("subject");
                Subject.SerializeJson(writer, options);
            }

            if (Recipient != null)
            {
                writer.WritePropertyName("recipient");
                Recipient.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Date))
            {
                writer.WriteString("date", (string)Date !);
            }

            if (_Date != null)
            {
                writer.WritePropertyName("_date");
                _Date.SerializeJson(writer, options);
            }

            if ((Participant != null) && (Participant.Count != 0))
            {
                writer.WritePropertyName("participant");
                writer.WriteStartArray();

                foreach (InvoiceParticipant valParticipant in Participant)
                {
                    valParticipant.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Issuer != null)
            {
                writer.WritePropertyName("issuer");
                Issuer.SerializeJson(writer, options);
            }

            if (Account != null)
            {
                writer.WritePropertyName("account");
                Account.SerializeJson(writer, options);
            }

            if ((LineItem != null) && (LineItem.Count != 0))
            {
                writer.WritePropertyName("lineItem");
                writer.WriteStartArray();

                foreach (InvoiceLineItem valLineItem in LineItem)
                {
                    valLineItem.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((TotalPriceComponent != null) && (TotalPriceComponent.Count != 0))
            {
                writer.WritePropertyName("totalPriceComponent");
                writer.WriteStartArray();

                foreach (InvoiceLineItemPriceComponent valTotalPriceComponent in TotalPriceComponent)
                {
                    valTotalPriceComponent.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (TotalNet != null)
            {
                writer.WritePropertyName("totalNet");
                TotalNet.SerializeJson(writer, options);
            }

            if (TotalGross != null)
            {
                writer.WritePropertyName("totalGross");
                TotalGross.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(PaymentTerms))
            {
                writer.WriteString("paymentTerms", (string)PaymentTerms !);
            }

            if (_PaymentTerms != null)
            {
                writer.WritePropertyName("_paymentTerms");
                _PaymentTerms.SerializeJson(writer, options);
            }

            if ((Note != null) && (Note.Count != 0))
            {
                writer.WritePropertyName("note");
                writer.WriteStartArray();

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }