當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。