Example #1
0
 public decimal Value(Date date)
 {
     if (EffectivePeriod.Contains(date))
     {
         return(Properties[date].Units * Stock.GetPrice(date));
     }
     else
     {
         return(0.00m);
     }
 }
        public void Change(Date date, int unitChange, decimal amountChange, decimal costBaseChange, IPortfolioTransaction transaction)
        {
            if (!EffectivePeriod.Contains(date))
            {
                throw new EffectiveDateException("The parcel is not effective at that date");
            }

            var parcelProperties = _Properties[date];

            var newUnits    = parcelProperties.Units + unitChange;
            var newAmount   = parcelProperties.Amount + amountChange;
            var newCostBase = parcelProperties.CostBase + costBaseChange;

            if (newUnits < 0)
            {
                throw new ArgumentException("Units cannot be changed to be less than 0");
            }
            if (newAmount < 0)
            {
                throw new ArgumentException("Amount cannot be changed to be less than 0");
            }
            if (newCostBase < 0)
            {
                throw new ArgumentException("Costbase cannot be changed to be less than 0");
            }

            ParcelProperties newParcelProperties;

            if (newUnits == 0)
            {
                End(date);
                newParcelProperties = new ParcelProperties(0, 0.00m, 0.00m);
            }
            else
            {
                newParcelProperties = new ParcelProperties(newUnits, newAmount, newCostBase);
            }

            _Properties.Change(date, newParcelProperties);

            _Audit.Add(new ParcelAudit(date, unitChange, costBaseChange, amountChange, transaction));
        }
Example #3
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 !);
            }


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

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

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

                foreach (CodeableConcept valCategory in Category)
                {
                    valCategory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

            if (!string.IsNullOrEmpty(EffectiveDateTime))
            {
                writer.WriteString("effectiveDateTime", (string)EffectiveDateTime !);
            }

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

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

            if (!string.IsNullOrEmpty(Issued))
            {
                writer.WriteString("issued", (string)Issued !);
            }

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

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

                foreach (Reference valPerformer in Performer)
                {
                    valPerformer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valResultsInterpreter in ResultsInterpreter)
                {
                    valResultsInterpreter.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valSpecimen in Specimen)
                {
                    valSpecimen.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valResult in Result)
                {
                    valResult.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valImagingStudy in ImagingStudy)
                {
                    valImagingStudy.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (DiagnosticReportMedia valMedia in Media)
                {
                    valMedia.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Conclusion))
            {
                writer.WriteString("conclusion", (string)Conclusion !);
            }

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

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

                foreach (CodeableConcept valConclusionCode in ConclusionCode)
                {
                    valConclusionCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Attachment valPresentedForm in PresentedForm)
                {
                    valPresentedForm.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Example #4
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as EventDefinition;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (UrlElement != null)
            {
                dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopy();
            }
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (VersionElement != null)
            {
                dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopy();
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (TitleElement != null)
            {
                dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy();
            }
            if (SubtitleElement != null)
            {
                dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.PublicationStatus>)StatusElement.DeepCopy();
            }
            if (ExperimentalElement != null)
            {
                dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopy();
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopy();
            }
            if (DateElement != null)
            {
                dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
            }
            if (PublisherElement != null)
            {
                dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopy();
            }
            if (Contact != null)
            {
                dest.Contact = new List <Hl7.Fhir.Model.ContactDetail>(Contact.DeepCopy());
            }
            if (Description != null)
            {
                dest.Description = (Hl7.Fhir.Model.Markdown)Description.DeepCopy();
            }
            if (UseContext != null)
            {
                dest.UseContext = new List <Hl7.Fhir.Model.UsageContext>(UseContext.DeepCopy());
            }
            if (Jurisdiction != null)
            {
                dest.Jurisdiction = new List <Hl7.Fhir.Model.CodeableConcept>(Jurisdiction.DeepCopy());
            }
            if (Purpose != null)
            {
                dest.Purpose = (Hl7.Fhir.Model.Markdown)Purpose.DeepCopy();
            }
            if (UsageElement != null)
            {
                dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopy();
            }
            if (Copyright != null)
            {
                dest.Copyright = (Hl7.Fhir.Model.Markdown)Copyright.DeepCopy();
            }
            if (ApprovalDateElement != null)
            {
                dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopy();
            }
            if (LastReviewDateElement != null)
            {
                dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopy();
            }
            if (EffectivePeriod != null)
            {
                dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopy();
            }
            if (Topic != null)
            {
                dest.Topic = new List <Hl7.Fhir.Model.CodeableConcept>(Topic.DeepCopy());
            }
            if (Author != null)
            {
                dest.Author = new List <Hl7.Fhir.Model.ContactDetail>(Author.DeepCopy());
            }
            if (Editor != null)
            {
                dest.Editor = new List <Hl7.Fhir.Model.ContactDetail>(Editor.DeepCopy());
            }
            if (Reviewer != null)
            {
                dest.Reviewer = new List <Hl7.Fhir.Model.ContactDetail>(Reviewer.DeepCopy());
            }
            if (Endorser != null)
            {
                dest.Endorser = new List <Hl7.Fhir.Model.ContactDetail>(Endorser.DeepCopy());
            }
            if (RelatedArtifact != null)
            {
                dest.RelatedArtifact = new List <Hl7.Fhir.Model.RelatedArtifact>(RelatedArtifact.DeepCopy());
            }
            if (Trigger != null)
            {
                dest.Trigger = new List <Hl7.Fhir.Model.TriggerDefinition>(Trigger.DeepCopy());
            }
            return(dest);
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as CatalogEntry;

            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 (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (TypeElement != null)
            {
                dest.TypeElement = (Code <Hl7.Fhir.Model.CatalogEntry.CatalogEntryType>)TypeElement.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.CatalogEntry.CatalogEntryStatus>)StatusElement.DeepCopy();
            }
            if (EffectivePeriod != null)
            {
                dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopy();
            }
            if (OrderableElement != null)
            {
                dest.OrderableElement = (Hl7.Fhir.Model.FhirBoolean)OrderableElement.DeepCopy();
            }
            if (ReferencedItem != null)
            {
                dest.ReferencedItem = (Hl7.Fhir.Model.ResourceReference)ReferencedItem.DeepCopy();
            }
            if (RelatedEntry != null)
            {
                dest.RelatedEntry = new List <Hl7.Fhir.Model.CatalogEntry.RelatedEntryComponent>(RelatedEntry.DeepCopy());
            }
            if (UpdatedBy != null)
            {
                dest.UpdatedBy = (Hl7.Fhir.Model.ResourceReference)UpdatedBy.DeepCopy();
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            if (EstimatedDuration != null)
            {
                dest.EstimatedDuration = (Hl7.Fhir.Model.Duration)EstimatedDuration.DeepCopy();
            }
            if (BillingCode != null)
            {
                dest.BillingCode = new List <Hl7.Fhir.Model.CodeableConcept>(BillingCode.DeepCopy());
            }
            if (BillingSummaryElement != null)
            {
                dest.BillingSummaryElement = (Hl7.Fhir.Model.FhirString)BillingSummaryElement.DeepCopy();
            }
            if (ScheduleSummaryElement != null)
            {
                dest.ScheduleSummaryElement = (Hl7.Fhir.Model.FhirString)ScheduleSummaryElement.DeepCopy();
            }
            if (LimitationSummaryElement != null)
            {
                dest.LimitationSummaryElement = (Hl7.Fhir.Model.FhirString)LimitationSummaryElement.DeepCopy();
            }
            if (RegulatorySummaryElement != null)
            {
                dest.RegulatorySummaryElement = (Hl7.Fhir.Model.FhirString)RegulatorySummaryElement.DeepCopy();
            }
            return(dest);
        }
Example #6
0
 public virtual bool IsActive(DateTime onDatetime)
 {
     return(EffectivePeriod != null && EffectivePeriod.IsEffectiveOn(onDatetime) &&
            (SuspendedPeriod == null || SuspendedPeriod.IsEffectiveOn(onDatetime)));
 }
        /// <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 ((Instantiates != null) && (Instantiates.Count != 0))
            {
                writer.WritePropertyName("instantiates");
                writer.WriteStartArray();

                foreach (string valInstantiates in Instantiates)
                {
                    writer.WriteStringValue(valInstantiates);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Instantiates in _Instantiates)
                {
                    val_Instantiates.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 ((StatusReason != null) && (StatusReason.Count != 0))
            {
                writer.WritePropertyName("statusReason");
                writer.WriteStartArray();

                foreach (CodeableConcept valStatusReason in StatusReason)
                {
                    valStatusReason.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

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

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

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

                foreach (Reference valSupportingInformation in SupportingInformation)
                {
                    valSupportingInformation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(EffectiveDateTime))
            {
                writer.WriteString("effectiveDateTime", (string)EffectiveDateTime !);
            }

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

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

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

                foreach (MedicationAdministrationPerformer valPerformer in Performer)
                {
                    valPerformer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (Reference valDevice in Device)
                {
                    valDevice.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                writer.WriteEndArray();
            }

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

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

                foreach (Reference valEventHistory in EventHistory)
                {
                    valEventHistory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Example #8
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 (!string.IsNullOrEmpty(Url))
            {
                writer.WriteString("url", (string)Url !);
            }

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

            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(Version))
            {
                writer.WriteString("version", (string)Version !);
            }

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

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

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

            if (!string.IsNullOrEmpty(Title))
            {
                writer.WriteString("title", (string)Title !);
            }

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

            if (!string.IsNullOrEmpty(ShortTitle))
            {
                writer.WriteString("shortTitle", (string)ShortTitle !);
            }

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

            if (!string.IsNullOrEmpty(Subtitle))
            {
                writer.WriteString("subtitle", (string)Subtitle !);
            }

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

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

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

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

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

            if (!string.IsNullOrEmpty(Publisher))
            {
                writer.WriteString("publisher", (string)Publisher !);
            }

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

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

                foreach (ContactDetail valContact in Contact)
                {
                    valContact.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

            if (_Description != null)
            {
                writer.WritePropertyName("_description");
                _Description.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 ((UseContext != null) && (UseContext.Count != 0))
            {
                writer.WritePropertyName("useContext");
                writer.WriteStartArray();

                foreach (UsageContext valUseContext in UseContext)
                {
                    valUseContext.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valJurisdiction in Jurisdiction)
                {
                    valJurisdiction.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Copyright))
            {
                writer.WriteString("copyright", (string)Copyright !);
            }

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

            if (!string.IsNullOrEmpty(ApprovalDate))
            {
                writer.WriteString("approvalDate", (string)ApprovalDate !);
            }

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

            if (!string.IsNullOrEmpty(LastReviewDate))
            {
                writer.WriteString("lastReviewDate", (string)LastReviewDate !);
            }

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

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

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

                foreach (CodeableConcept valTopic in Topic)
                {
                    valTopic.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valAuthor in Author)
                {
                    valAuthor.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valEditor in Editor)
                {
                    valEditor.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valReviewer in Reviewer)
                {
                    valReviewer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valEndorser in Endorser)
                {
                    valEndorser.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (RelatedArtifact valRelatedArtifact in RelatedArtifact)
                {
                    valRelatedArtifact.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (Reference valExposureVariant in ExposureVariant)
                {
                    valExposureVariant.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valOutcome in Outcome)
                {
                    valOutcome.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Example #9
0
 public bool IsEffectiveDuring(DateRange dateRange)
 {
     return(EffectivePeriod.Overlaps(dateRange));
 }
Example #10
0
 public bool IsEffectiveAt(Date date)
 {
     return(EffectivePeriod.Contains(date));
 }
Example #11
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 !);
            }


            ((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 ((StatusReason != null) && (StatusReason.Count != 0))
            {
                writer.WritePropertyName("statusReason");
                writer.WriteStartArray();

                foreach (CodeableConcept valStatusReason in StatusReason)
                {
                    valStatusReason.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

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

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

            if (!string.IsNullOrEmpty(EffectiveDateTime))
            {
                writer.WriteString("effectiveDateTime", (string)EffectiveDateTime !);
            }

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

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

            if (!string.IsNullOrEmpty(DateAsserted))
            {
                writer.WriteString("dateAsserted", (string)DateAsserted !);
            }

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

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

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

                foreach (Reference valDerivedFrom in DerivedFrom)
                {
                    valDerivedFrom.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                writer.WriteEndArray();
            }

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

                foreach (Dosage valDosage in Dosage)
                {
                    valDosage.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Example #12
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 !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if (!string.IsNullOrEmpty(Url))
            {
                writer.WriteString("url", (string)Url !);
            }

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

            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(Version))
            {
                writer.WriteString("version", (string)Version !);
            }

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

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

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

            if (!string.IsNullOrEmpty(Title))
            {
                writer.WriteString("title", (string)Title !);
            }

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

            if (!string.IsNullOrEmpty(ShortTitle))
            {
                writer.WriteString("shortTitle", (string)ShortTitle !);
            }

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

            if (!string.IsNullOrEmpty(Subtitle))
            {
                writer.WriteString("subtitle", (string)Subtitle !);
            }

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

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

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

            if (Experimental != null)
            {
                writer.WriteBoolean("experimental", (bool)Experimental !);
            }

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

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

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

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

            if (!string.IsNullOrEmpty(Publisher))
            {
                writer.WriteString("publisher", (string)Publisher !);
            }

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

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

                foreach (ContactDetail valContact in Contact)
                {
                    valContact.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

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

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

                foreach (string valComment in Comment)
                {
                    writer.WriteStringValue(valComment);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Comment in _Comment)
                {
                    val_Comment.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (UsageContext valUseContext in UseContext)
                {
                    valUseContext.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valJurisdiction in Jurisdiction)
                {
                    valJurisdiction.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Purpose))
            {
                writer.WriteString("purpose", (string)Purpose !);
            }

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

            if (!string.IsNullOrEmpty(Usage))
            {
                writer.WriteString("usage", (string)Usage !);
            }

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

            if (!string.IsNullOrEmpty(Copyright))
            {
                writer.WriteString("copyright", (string)Copyright !);
            }

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

            if (!string.IsNullOrEmpty(ApprovalDate))
            {
                writer.WriteString("approvalDate", (string)ApprovalDate !);
            }

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

            if (!string.IsNullOrEmpty(LastReviewDate))
            {
                writer.WriteString("lastReviewDate", (string)LastReviewDate !);
            }

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

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

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

                foreach (CodeableConcept valTopic in Topic)
                {
                    valTopic.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valAuthor in Author)
                {
                    valAuthor.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valEditor in Editor)
                {
                    valEditor.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valReviewer in Reviewer)
                {
                    valReviewer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valEndorser in Endorser)
                {
                    valEndorser.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (RelatedArtifact valRelatedArtifact in RelatedArtifact)
                {
                    valRelatedArtifact.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (string valLibrary in Library)
                {
                    writer.WriteStringValue(valLibrary);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Library in _Library)
                {
                    val_Library.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

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

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Example #13
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 (StatusReason != null)
            {
                writer.WritePropertyName("statusReason");
                StatusReason.SerializeJson(writer, options);
            }

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

            if (!string.IsNullOrEmpty(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

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

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

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

            if (!string.IsNullOrEmpty(EffectiveDateTime))
            {
                writer.WriteString("effectiveDateTime", (string)EffectiveDateTime !);
            }

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

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

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

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

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

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

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

                foreach (Reference valProblem in Problem)
                {
                    valProblem.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ClinicalImpressionInvestigation valInvestigation in Investigation)
                {
                    valInvestigation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (string valProtocol in Protocol)
                {
                    writer.WriteStringValue(valProtocol);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Protocol in _Protocol)
                {
                    val_Protocol.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Summary))
            {
                writer.WriteString("summary", (string)Summary !);
            }

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

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

                foreach (ClinicalImpressionFinding valFinding in Finding)
                {
                    valFinding.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valPrognosisCodeableConcept in PrognosisCodeableConcept)
                {
                    valPrognosisCodeableConcept.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valPrognosisReference in PrognosisReference)
                {
                    valPrognosisReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valSupportingInfo in SupportingInfo)
                {
                    valSupportingInfo.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            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();
            }
        }