Example #1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Schedule;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Type != null)
                {
                    dest.Type = new List <Hl7.Fhir.Model.CodeableConcept>(Type.DeepCopy());
                }
                if (Actor != null)
                {
                    dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopy();
                }
                if (PlanningHorizon != null)
                {
                    dest.PlanningHorizon = (Hl7.Fhir.Model.Period)PlanningHorizon.DeepCopy();
                }
                if (CommentElement != null)
                {
                    dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Example #2
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Schedule;

            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 (ActiveElement != null)
            {
                dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopy();
            }
            if (ServiceCategory != null)
            {
                dest.ServiceCategory = new List <Hl7.Fhir.Model.CodeableConcept>(ServiceCategory.DeepCopy());
            }
            if (ServiceType != null)
            {
                dest.ServiceType = new List <Hl7.Fhir.Model.CodeableConcept>(ServiceType.DeepCopy());
            }
            if (Specialty != null)
            {
                dest.Specialty = new List <Hl7.Fhir.Model.CodeableConcept>(Specialty.DeepCopy());
            }
            if (Actor != null)
            {
                dest.Actor = new List <Hl7.Fhir.Model.ResourceReference>(Actor.DeepCopy());
            }
            if (PlanningHorizon != null)
            {
                dest.PlanningHorizon = (Hl7.Fhir.Model.Period)PlanningHorizon.DeepCopy();
            }
            if (CommentElement != null)
            {
                dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopy();
            }
            return(dest);
        }
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 (Active != null)
            {
                writer.WriteBoolean("active", (bool)Active !);
            }

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

                foreach (CodeableConcept valServiceCategory in ServiceCategory)
                {
                    valServiceCategory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valServiceType in ServiceType)
                {
                    valServiceType.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valSpecialty in Specialty)
                {
                    valSpecialty.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valActor in Actor)
                {
                    valActor.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

            if (!string.IsNullOrEmpty(Comment))
            {
                writer.WriteString("comment", (string)Comment !);
            }

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

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