当前位置: 首页>>代码示例>>C#>>正文


C# ErrorList.Add方法代码示例

本文整理汇总了C#中ErrorList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorList.Add方法的具体用法?C# ErrorList.Add怎么用?C# ErrorList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorList的用法示例。


在下文中一共展示了ErrorList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseTags

        internal static IList<Tag> ParseTags(XmlReader xr, ErrorList errors)
        {
            xr.MoveToContent();

            try
            {
                var taglist = (XElement)XElement.ReadFrom(xr);

                if (taglist.Name == BundleXmlParser.XFHIRNS + TagListSerializer.TAGLIST_ROOT)
                {
                    if (taglist.Elements().All(xe => xe.Name == BundleXmlParser.XFHIRNS + BundleXmlParser.XATOM_CATEGORY))
                        return ParseTags(taglist.Elements());
                    else
                        errors.Add("TagList contains unexpected child elements");
                }
                else
                    errors.Add(String.Format("Unexpected element name {0} found at start of TagList", taglist.Name));
            }
            catch (Exception exc)
            {
                errors.Add("Exception while loading taglist: " + exc.Message);
            }

            return null;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:25,代码来源:TagListParser.cs

示例2: ValidateRules

        internal override ErrorList ValidateRules()
        {
            var result = new ErrorList();
            result.AddRange(base.ValidateRules());

            if (Content == null)
                result.Add("Entry must contain (possibly 0-length) data");

            if (ContentType == null)
                result.Add("Entry must contain a contentType");

            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:13,代码来源:Binary.cs

示例3: ValidateRules

        internal override ErrorList ValidateRules()
        {
            var result = new ErrorList();

            if (Value.IsAbsoluteUri)
            {
                string dummy; string dummy2;
                var urnValue = Value.ToString();

                if (urnValue.StartsWith("urn:oid:") && !Oid.TryParseValue(urnValue, out dummy))
                    result.Add(String.Format("Uri is an urn:oid, but the oid {0} is incorrect",urnValue));

                else if (urnValue.StartsWith("urn:uuid:") && !Uuid.TryParseValue(urnValue, out dummy2))
                    result.Add(String.Format("Uri is an urn:uuid, but the uuid {0} is incorrect", urnValue));
            }

            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:18,代码来源:FhirUri.cs

示例4: ValidateRules

        internal override ErrorList ValidateRules()
        {
            var result = new ErrorList();

            if (Value == null)
                result.Add("Uuid values cannot be empty");
            else
            {
                Uuid dummy;

                if (!TryParse(Value, out dummy))
                    result.Add("Not an correctly formatted uuid value");
            }

            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:16,代码来源:Uuid.cs

示例5: ParseBase64Binary

        /// <summary>
        /// Parse base64Binary
        /// </summary>
        public static Hl7.Fhir.Model.Base64Binary ParseBase64Binary(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Base64Binary existingInstance = null )
        {
            Hl7.Fhir.Model.Base64Binary result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Base64Binary();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element value
                else if( atName == "value" )
                    result.Value = Base64Binary.Parse(reader.ReadPrimitiveContents(typeof(Base64Binary))).Value;

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:43,代码来源:Base64BinaryParser.cs

示例6: ShouldBeAbleToGetErrorInfoByFieldName

 public void ShouldBeAbleToGetErrorInfoByFieldName()
 {
     ErrorList errors = new ErrorList();
     errors.Add(new ErrorInfo("Name", "Can't be blank"));
     Assert.AreEqual("Name can't be blank", errors["Name"].ToString());
 }
开发者ID:jskswamy,项目名称:ConsoleMailer,代码行数:6,代码来源:ErrorListTest.cs

示例7: HasErrorShouldBeTrue

 public void HasErrorShouldBeTrue()
 {
     ErrorList errors = new ErrorList();
     errors.Add(new ErrorInfo("Name"));
     Assert.IsTrue(errors.HasErrors);
 }
开发者ID:jskswamy,项目名称:ConsoleMailer,代码行数:6,代码来源:ErrorListTest.cs

示例8: ParseConformanceSoftwareComponent

        /// <summary>
        /// Parse ConformanceSoftwareComponent
        /// </summary>
        public static Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent ParseConformanceSoftwareComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent existingInstance = null )
        {
            Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element name
                else if( atName == "name" )
                    result.NameElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element version
                else if( atName == "version" )
                    result.VersionElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element releaseDate
                else if( atName == "releaseDate" )
                    result.ReleaseDateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors);

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:51,代码来源:ConformanceParser.cs

示例9: ParseConformanceRestResourceSearchParamComponent

        /// <summary>
        /// Parse ConformanceRestResourceSearchParamComponent
        /// </summary>
        public static Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent ParseConformanceRestResourceSearchParamComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent existingInstance = null )
        {
            Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element name
                else if( atName == "name" )
                    result.NameElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element source
                else if( atName == "source" )
                    result.SourceElement = FhirUriParser.ParseFhirUri(reader, errors);

                // Parse element type
                else if( atName == "type" )
                    result.TypeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.SearchParamType>(reader, errors);

                // Parse element documentation
                else if( atName == "documentation" )
                    result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element xpath
                else if( atName == "xpath" )
                    result.XpathElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element target
                else if( atName == "target" )
                {
                    result.TargetElement = new List<Hl7.Fhir.Model.Code>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "target") )
                        result.TargetElement.Add(CodeParser.ParseCode(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element chain
                else if( atName == "chain" )
                {
                    result.ChainElement = new List<Hl7.Fhir.Model.FhirString>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "chain") )
                        result.ChainElement.Add(FhirStringParser.ParseFhirString(reader, errors));

                    reader.LeaveArray();
                }

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:83,代码来源:ConformanceParser.cs

示例10: ParseConformance

        /// <summary>
        /// Parse Conformance
        /// </summary>
        public static Hl7.Fhir.Model.Conformance ParseConformance(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance existingInstance = null )
        {
            Hl7.Fhir.Model.Conformance result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element language
                else if( atName == "language" )
                    result.LanguageElement = CodeParser.ParseCode(reader, errors);

                // Parse element text
                else if( atName == "text" )
                    result.Text = NarrativeParser.ParseNarrative(reader, errors);

                // Parse element contained
                else if( atName == "contained" )
                {
                    result.Contained = new List<Hl7.Fhir.Model.Resource>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "contained") )
                        result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element identifier
                else if( atName == "identifier" )
                    result.IdentifierElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element version
                else if( atName == "version" )
                    result.VersionElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element name
                else if( atName == "name" )
                    result.NameElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element publisher
                else if( atName == "publisher" )
                    result.PublisherElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element telecom
                else if( atName == "telecom" )
                {
                    result.Telecom = new List<Hl7.Fhir.Model.Contact>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "telecom") )
                        result.Telecom.Add(ContactParser.ParseContact(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element description
                else if( atName == "description" )
                    result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element status
                else if( atName == "status" )
                    result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.ConformanceStatementStatus>(reader, errors);

                // Parse element experimental
                else if( atName == "experimental" )
                    result.ExperimentalElement = FhirBooleanParser.ParseFhirBoolean(reader, errors);

                // Parse element date
                else if( atName == "date" )
                    result.DateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors);

                // Parse element software
                else if( atName == "software" )
                    result.Software = ConformanceParser.ParseConformanceSoftwareComponent(reader, errors);

                // Parse element implementation
                else if( atName == "implementation" )
                    result.Implementation = ConformanceParser.ParseConformanceImplementationComponent(reader, errors);

//.........这里部分代码省略.........
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:101,代码来源:ConformanceParser.cs

示例11: ParseConformanceMessagingEventComponent

        /// <summary>
        /// Parse ConformanceMessagingEventComponent
        /// </summary>
        public static Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent ParseConformanceMessagingEventComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent existingInstance = null )
        {
            Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element code
                else if( atName == "code" )
                    result.CodeElement = CodeParser.ParseCode(reader, errors);

                // Parse element mode
                else if( atName == "mode" )
                    result.ModeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.ConformanceEventMode>(reader, errors);

                // Parse element protocol
                else if( atName == "protocol" )
                {
                    result.Protocol = new List<Hl7.Fhir.Model.Coding>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "protocol") )
                        result.Protocol.Add(CodingParser.ParseCoding(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element focus
                else if( atName == "focus" )
                    result.FocusElement = CodeParser.ParseCode(reader, errors);

                // Parse element request
                else if( atName == "request" )
                    result.Request = ResourceReferenceParser.ParseResourceReference(reader, errors);

                // Parse element response
                else if( atName == "response" )
                    result.Response = ResourceReferenceParser.ParseResourceReference(reader, errors);

                // Parse element documentation
                else if( atName == "documentation" )
                    result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors);

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:75,代码来源:ConformanceParser.cs

示例12: ParseEncounterParticipantComponent

        /// <summary>
        /// Parse EncounterParticipantComponent
        /// </summary>
        public static Hl7.Fhir.Model.Encounter.EncounterParticipantComponent ParseEncounterParticipantComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Encounter.EncounterParticipantComponent existingInstance = null )
        {
            Hl7.Fhir.Model.Encounter.EncounterParticipantComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Encounter.EncounterParticipantComponent();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element type
                else if( atName == "type" )
                {
                    result.TypeElement = new List<Code<Hl7.Fhir.Model.Encounter.ParticipantType>>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "type") )
                        result.TypeElement.Add(CodeParser.ParseCode<Hl7.Fhir.Model.Encounter.ParticipantType>(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element practitioner
                else if( atName == "practitioner" )
                    result.Practitioner = ResourceReferenceParser.ParseResourceReference(reader, errors);

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:55,代码来源:EncounterParser.cs

示例13: ParseEncounterHospitalizationComponent

        /// <summary>
        /// Parse EncounterHospitalizationComponent
        /// </summary>
        public static Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent ParseEncounterHospitalizationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent existingInstance = null )
        {
            Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element preAdmissionIdentifier
                else if( atName == "preAdmissionIdentifier" )
                    result.PreAdmissionIdentifier = IdentifierParser.ParseIdentifier(reader, errors);

                // Parse element origin
                else if( atName == "origin" )
                    result.Origin = ResourceReferenceParser.ParseResourceReference(reader, errors);

                // Parse element admitSource
                else if( atName == "admitSource" )
                    result.AdmitSource = CodeableConceptParser.ParseCodeableConcept(reader, errors);

                // Parse element period
                else if( atName == "period" )
                    result.Period = PeriodParser.ParsePeriod(reader, errors);

                // Parse element accomodation
                else if( atName == "accomodation" )
                {
                    result.Accomodation = new List<Hl7.Fhir.Model.Encounter.EncounterHospitalizationAccomodationComponent>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "accomodation") )
                        result.Accomodation.Add(EncounterParser.ParseEncounterHospitalizationAccomodationComponent(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element diet
                else if( atName == "diet" )
                    result.Diet = CodeableConceptParser.ParseCodeableConcept(reader, errors);

                // Parse element specialCourtesy
                else if( atName == "specialCourtesy" )
                {
                    result.SpecialCourtesy = new List<Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "specialCourtesy") )
                        result.SpecialCourtesy.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element specialArrangement
                else if( atName == "specialArrangement" )
                {
                    result.SpecialArrangement = new List<Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "specialArrangement") )
                        result.SpecialArrangement.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element destination
                else if( atName == "destination" )
                    result.Destination = ResourceReferenceParser.ParseResourceReference(reader, errors);

                // Parse element dischargeDisposition
                else if( atName == "dischargeDisposition" )
                    result.DischargeDisposition = CodeableConceptParser.ParseCodeableConcept(reader, errors);

                // Parse element reAdmission
                else if( atName == "reAdmission" )
                    result.ReAdmissionElement = FhirBooleanParser.ParseFhirBoolean(reader, errors);

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
//.........这里部分代码省略.........
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:101,代码来源:EncounterParser.cs

示例14: ParseHumanName

        /// <summary>
        /// Parse HumanName
        /// </summary>
        public static Hl7.Fhir.Model.HumanName ParseHumanName(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.HumanName existingInstance = null )
        {
            Hl7.Fhir.Model.HumanName result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.HumanName();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element use
                else if( atName == "use" )
                    result.UseElement = CodeParser.ParseCode<Hl7.Fhir.Model.HumanName.NameUse>(reader, errors);

                // Parse element text
                else if( atName == "text" )
                    result.TextElement = FhirStringParser.ParseFhirString(reader, errors);

                // Parse element family
                else if( atName == "family" )
                {
                    result.FamilyElement = new List<Hl7.Fhir.Model.FhirString>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "family") )
                        result.FamilyElement.Add(FhirStringParser.ParseFhirString(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element given
                else if( atName == "given" )
                {
                    result.GivenElement = new List<Hl7.Fhir.Model.FhirString>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "given") )
                        result.GivenElement.Add(FhirStringParser.ParseFhirString(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element prefix
                else if( atName == "prefix" )
                {
                    result.PrefixElement = new List<Hl7.Fhir.Model.FhirString>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "prefix") )
                        result.PrefixElement.Add(FhirStringParser.ParseFhirString(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element suffix
                else if( atName == "suffix" )
                {
                    result.SuffixElement = new List<Hl7.Fhir.Model.FhirString>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "suffix") )
                        result.SuffixElement.Add(FhirStringParser.ParseFhirString(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element period
                else if( atName == "period" )
                    result.Period = PeriodParser.ParsePeriod(reader, errors);

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return result;
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:99,代码来源:HumanNameParser.cs

示例15: ParseMedicationAdministration

        /// <summary>
        /// Parse MedicationAdministration
        /// </summary>
        public static Hl7.Fhir.Model.MedicationAdministration ParseMedicationAdministration(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.MedicationAdministration existingInstance = null )
        {
            Hl7.Fhir.Model.MedicationAdministration result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.MedicationAdministration();
            string currentElementName = reader.CurrentElementName;
            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if( atName == "extension" )
                {
                    result.Extension = new List<Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "extension") )
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element language
                else if( atName == "language" )
                    result.LanguageElement = CodeParser.ParseCode(reader, errors);

                // Parse element text
                else if( atName == "text" )
                    result.Text = NarrativeParser.ParseNarrative(reader, errors);

                // Parse element contained
                else if( atName == "contained" )
                {
                    result.Contained = new List<Hl7.Fhir.Model.Resource>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "contained") )
                        result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors));

                    reader.LeaveArray();
                }

                // Parse element _id
                else if( atName == "_id" )
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));

                // Parse element identifier
                else if( atName == "identifier" )
                {
                    result.Identifier = new List<Hl7.Fhir.Model.Identifier>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "identifier") )
                        result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element status
                else if( atName == "status" )
                    result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatus>(reader, errors);

                // Parse element patient
                else if( atName == "patient" )
                    result.Patient = ResourceReferenceParser.ParseResourceReference(reader, errors);

                // Parse element practitioner
                else if( atName == "practitioner" )
                    result.Practitioner = ResourceReferenceParser.ParseResourceReference(reader, errors);

                // Parse element encounter
                else if( atName == "encounter" )
                    result.Encounter = ResourceReferenceParser.ParseResourceReference(reader, errors);

                // Parse element prescription
                else if( atName == "prescription" )
                    result.Prescription = ResourceReferenceParser.ParseResourceReference(reader, errors);

                // Parse element wasNotGiven
                else if( atName == "wasNotGiven" )
                    result.WasNotGivenElement = FhirBooleanParser.ParseFhirBoolean(reader, errors);

                // Parse element reasonNotGiven
                else if( atName == "reasonNotGiven" )
                {
                    result.ReasonNotGiven = new List<Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

                    while( ParserUtils.IsAtArrayElement(reader, "reasonNotGiven") )
                        result.ReasonNotGiven.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors));

                    reader.LeaveArray();
                }

                // Parse element whenGiven
                else if( atName == "whenGiven" )
                    result.WhenGiven = PeriodParser.ParsePeriod(reader, errors);

//.........这里部分代码省略.........
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:101,代码来源:MedicationAdministrationParser.cs


注:本文中的ErrorList.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。