public void Test_Poco() { var serializer = new TypeSerializer(new ManualByteConverter()); var value = new Person {Name = "jeff"}; var bytes = serializer.Serialize(value); var actual = serializer.Deserialize<Person>(new ArraySegment<byte>(bytes), 0, bytes.Length); Assert.AreEqual(value.Name, actual.Name); }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } ExternalAccessionIdentifier = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[1], false, seps) : null; AccessionIdentifier = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[2], false, seps) : null; ContainerIdentifier = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[3], false, seps) : null; PrimaryParentContainerIdentifier = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[4], false, seps) : null; EquipmentContainerIdentifier = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[5], false, seps) : null; SpecimenSource = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <SpecimenSource>(segments[6], false, seps) : null; RegistrationDateTime = segments.Length > 7 && segments[7].Length > 0 ? segments[7].ToNullableDateTime() : null; ContainerStatus = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[8], false, seps) : null; CarrierType = segments.Length > 9 && segments[9].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[9], false, seps) : null; CarrierIdentifier = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[10], false, seps) : null; PositionInCarrier = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize <NumericArray>(segments[11], false, seps) : null; TrayTypeSac = segments.Length > 12 && segments[12].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[12], false, seps) : null; TrayIdentifier = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[13], false, seps) : null; PositionInTray = segments.Length > 14 && segments[14].Length > 0 ? TypeSerializer.Deserialize <NumericArray>(segments[14], false, seps) : null; Location = segments.Length > 15 && segments[15].Length > 0 ? segments[15].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; ContainerHeight = segments.Length > 16 && segments[16].Length > 0 ? segments[16].ToNullableDecimal() : null; ContainerDiameter = segments.Length > 17 && segments[17].Length > 0 ? segments[17].ToNullableDecimal() : null; BarrierDelta = segments.Length > 18 && segments[18].Length > 0 ? segments[18].ToNullableDecimal() : null; BottomDelta = segments.Length > 19 && segments[19].Length > 0 ? segments[19].ToNullableDecimal() : null; ContainerHeightDiameterDeltaUnits = segments.Length > 20 && segments[20].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[20], false, seps) : null; ContainerVolume = segments.Length > 21 && segments[21].Length > 0 ? segments[21].ToNullableDecimal() : null; AvailableSpecimenVolume = segments.Length > 22 && segments[22].Length > 0 ? segments[22].ToNullableDecimal() : null; InitialSpecimenVolume = segments.Length > 23 && segments[23].Length > 0 ? segments[23].ToNullableDecimal() : null; VolumeUnits = segments.Length > 24 && segments[24].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[24], false, seps) : null; SeparatorType = segments.Length > 25 && segments[25].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[25], false, seps) : null; CapType = segments.Length > 26 && segments[26].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[26], false, seps) : null; Additive = segments.Length > 27 && segments[27].Length > 0 ? segments[27].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenComponent = segments.Length > 28 && segments[28].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[28], false, seps) : null; DilutionFactor = segments.Length > 29 && segments[29].Length > 0 ? TypeSerializer.Deserialize <StructuredNumeric>(segments[29], false, seps) : null; Treatment = segments.Length > 30 && segments[30].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[30], false, seps) : null; Temperature = segments.Length > 31 && segments[31].Length > 0 ? TypeSerializer.Deserialize <StructuredNumeric>(segments[31], false, seps) : null; HemolysisIndex = segments.Length > 32 && segments[32].Length > 0 ? segments[32].ToNullableDecimal() : null; HemolysisIndexUnits = segments.Length > 33 && segments[33].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[33], false, seps) : null; LipemiaIndex = segments.Length > 34 && segments[34].Length > 0 ? segments[34].ToNullableDecimal() : null; LipemiaIndexUnits = segments.Length > 35 && segments[35].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[35], false, seps) : null; IcterusIndex = segments.Length > 36 && segments[36].Length > 0 ? segments[36].ToNullableDecimal() : null; IcterusIndexUnits = segments.Length > 37 && segments[37].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[37], false, seps) : null; FibrinIndex = segments.Length > 38 && segments[38].Length > 0 ? segments[38].ToNullableDecimal() : null; FibrinIndexUnits = segments.Length > 39 && segments[39].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[39], false, seps) : null; SystemInducedContaminants = segments.Length > 40 && segments[40].Length > 0 ? segments[40].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; DrugInterference = segments.Length > 41 && segments[41].Length > 0 ? segments[41].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; ArtificialBlood = segments.Length > 42 && segments[42].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[42], false, seps) : null; SpecialHandlingCode = segments.Length > 43 && segments[43].Length > 0 ? segments[43].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; OtherEnvironmentalFactors = segments.Length > 44 && segments[44].Length > 0 ? segments[44].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } NotificationReferenceNumber = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableDecimal() : null; NotificationDateTime = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDateTime() : null; NotificationAlertSeverity = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[3], false, seps) : null; NotificationCode = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[4], false, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } ItemIdentifier = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[1], false, seps) : null; ItemDescription = segments.Length > 2 && segments[2].Length > 0 ? segments[2] : null; ItemStatus = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[3], false, seps) : null; ItemType = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null; ItemCategory = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[5], false, seps) : null; SubjectToExpirationIndicator = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[6], false, seps) : null; ManufacturerIdentifier = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[7], false, seps) : null; ManufacturerName = segments.Length > 8 && segments[8].Length > 0 ? segments[8] : null; ManufacturerCatalogNumber = segments.Length > 9 && segments[9].Length > 0 ? segments[9] : null; ManufacturerLabelerIdentificationCode = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[10], false, seps) : null; PatientChargeableIndicator = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[11], false, seps) : null; TransactionCode = segments.Length > 12 && segments[12].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[12], false, seps) : null; TransactionAmountUnit = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <CompositePrice>(segments[13], false, seps) : null; StockedItemIndicator = segments.Length > 14 && segments[14].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[14], false, seps) : null; SupplyRiskCodes = segments.Length > 15 && segments[15].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[15], false, seps) : null; ApprovingRegulatoryAgency = segments.Length > 16 && segments[16].Length > 0 ? segments[16].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(x, false, seps)) : null; LatexIndicator = segments.Length > 17 && segments[17].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[17], false, seps) : null; RulingAct = segments.Length > 18 && segments[18].Length > 0 ? segments[18].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; ItemNaturalAccountCode = segments.Length > 19 && segments[19].Length > 0 ? segments[19] : null; ApprovedToBuyQuantity = segments.Length > 20 && segments[20].Length > 0 ? segments[20].ToNullableDecimal() : null; ApprovedToBuyPrice = segments.Length > 21 && segments[21].Length > 0 ? TypeSerializer.Deserialize <Money>(segments[21], false, seps) : null; TaxableItemIndicator = segments.Length > 22 && segments[22].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[22], false, seps) : null; FreightChargeIndicator = segments.Length > 23 && segments[23].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[23], false, seps) : null; ItemSetIndicator = segments.Length > 24 && segments[24].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[24], false, seps) : null; ItemSetIdentifier = segments.Length > 25 && segments[25].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[25], false, seps) : null; TrackDepartmentUsageIndicator = segments.Length > 26 && segments[26].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[26], false, seps) : null; ProcedureCode = segments.Length > 27 && segments[27].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[27], false, seps) : null; ProcedureCodeModifier = segments.Length > 28 && segments[28].Length > 0 ? segments[28].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithNoExceptions>(x, false, seps)) : null; SpecialHandlingCode = segments.Length > 29 && segments[29].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[29], false, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SequenceNumberTestObservationMasterFile = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableDecimal() : null; ProducersServiceTestObservationId = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[2], false, seps) : null; PermittedDataTypes = segments.Length > 3 && segments[3].Length > 0 ? segments[3].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; SpecimenRequired = segments.Length > 4 && segments[4].Length > 0 ? segments[4] : null; ProducerId = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[5], false, seps) : null; ObservationDescription = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <Text>(segments[6], false, seps) : null; OtherServiceTestObservationIdsForTheObservation = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[7], false, seps) : null; OtherNames = segments.Length > 8 && segments[8].Length > 0 ? segments[8].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; PreferredReportNameForTheObservation = segments.Length > 9 && segments[9].Length > 0 ? segments[9] : null; PreferredShortNameOrMnemonicForTheObservation = segments.Length > 10 && segments[10].Length > 0 ? segments[10] : null; PreferredLongNameForTheObservation = segments.Length > 11 && segments[11].Length > 0 ? segments[11] : null; Orderability = segments.Length > 12 && segments[12].Length > 0 ? segments[12] : null; IdentityOfInstrumentUsedToPerformThisStudy = segments.Length > 13 && segments[13].Length > 0 ? segments[13].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; CodedRepresentationOfMethod = segments.Length > 14 && segments[14].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[14], false, seps) : null; PortableDeviceIndicator = segments.Length > 15 && segments[15].Length > 0 ? segments[15] : null; ObservationProducingDepartmentSection = segments.Length > 16 && segments[16].Length > 0 ? segments[16].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; TelephoneNumberOfSection = segments.Length > 17 && segments[17].Length > 0 ? TypeSerializer.Deserialize <ExtendedTelecommunicationNumber>(segments[17], false, seps) : null; NatureOfServiceTestObservation = segments.Length > 18 && segments[18].Length > 0 ? segments[18] : null; ReportSubheader = segments.Length > 19 && segments[19].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[19], false, seps) : null; ReportDisplayOrder = segments.Length > 20 && segments[20].Length > 0 ? segments[20] : null; DateTimeStampForAnyChangeInDefinitionForTheObservation = segments.Length > 21 && segments[21].Length > 0 ? segments[21].ToNullableDateTime() : null; EffectiveDateTimeOfChange = segments.Length > 22 && segments[22].Length > 0 ? segments[22].ToNullableDateTime() : null; TypicalTurnAroundTime = segments.Length > 23 && segments[23].Length > 0 ? segments[23].ToNullableDecimal() : null; ProcessingTime = segments.Length > 24 && segments[24].Length > 0 ? segments[24].ToNullableDecimal() : null; ProcessingPriority = segments.Length > 25 && segments[25].Length > 0 ? segments[25].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; ReportingPriority = segments.Length > 26 && segments[26].Length > 0 ? segments[26] : null; OutsideSitesWhereObservationMayBePerformed = segments.Length > 27 && segments[27].Length > 0 ? segments[27].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; AddressOfOutsideSites = segments.Length > 28 && segments[28].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[28], false, seps) : null; PhoneNumberOfOutsideSite = segments.Length > 29 && segments[29].Length > 0 ? TypeSerializer.Deserialize <ExtendedTelecommunicationNumber>(segments[29], false, seps) : null; ConfidentialityCode = segments.Length > 30 && segments[30].Length > 0 ? segments[30] : null; ObservationsRequiredToInterpretThisObservation = segments.Length > 31 && segments[31].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[31], false, seps) : null; InterpretationOfObservations = segments.Length > 32 && segments[32].Length > 0 ? TypeSerializer.Deserialize <Text>(segments[32], false, seps) : null; ContraindicationsToObservations = segments.Length > 33 && segments[33].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[33], false, seps) : null; ReflexTestsObservations = segments.Length > 34 && segments[34].Length > 0 ? segments[34].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; RulesThatTriggerReflexTesting = segments.Length > 35 && segments[35].Length > 0 ? segments[35] : null; FixedCannedMessage = segments.Length > 36 && segments[36].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[36], false, seps) : null; PatientPreparation = segments.Length > 37 && segments[37].Length > 0 ? TypeSerializer.Deserialize <Text>(segments[37], false, seps) : null; ProcedureMedication = segments.Length > 38 && segments[38].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[38], false, seps) : null; FactorsThatMayAffectTheObservation = segments.Length > 39 && segments[39].Length > 0 ? TypeSerializer.Deserialize <Text>(segments[39], false, seps) : null; ServiceTestObservationPerformanceSchedule = segments.Length > 40 && segments[40].Length > 0 ? segments[40].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; DescriptionOfTestMethods = segments.Length > 41 && segments[41].Length > 0 ? TypeSerializer.Deserialize <Text>(segments[41], false, seps) : null; KindOfQuantityObserved = segments.Length > 42 && segments[42].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[42], false, seps) : null; PointVersusInterval = segments.Length > 43 && segments[43].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[43], false, seps) : null; ChallengeInformation = segments.Length > 44 && segments[44].Length > 0 ? TypeSerializer.Deserialize <Text>(segments[44], false, seps) : null; RelationshipModifier = segments.Length > 45 && segments[45].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[45], false, seps) : null; TargetAnatomicSiteOfTest = segments.Length > 46 && segments[46].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[46], false, seps) : null; ModalityOfImagingMeasurement = segments.Length > 47 && segments[47].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[47], false, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] separator = IsSubcomponent ? seps.SubcomponentSeparator : seps.ComponentSeparator; string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(separator, StringSplitOptions.None); OccurrenceSpanCode = segments.Length > 0 && segments[0].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[0], true, seps) : null; OccurrenceSpanStartDate = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableDateTime() : null; OccurrenceSpanStopDate = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDateTime() : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } AccidentDateTime = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableDateTime() : null; AccidentCode = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[2], false, seps) : null; AccidentLocation = segments.Length > 3 && segments[3].Length > 0 ? segments[3] : null; AutoAccidentState = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null; AccidentJobRelatedIndicator = segments.Length > 5 && segments[5].Length > 0 ? segments[5] : null; AccidentDeathIndicator = segments.Length > 6 && segments[6].Length > 0 ? segments[6] : null; EnteredBy = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(segments[7], false, seps) : null; AccidentDescription = segments.Length > 8 && segments[8].Length > 0 ? segments[8] : null; BroughtInBy = segments.Length > 9 && segments[9].Length > 0 ? segments[9] : null; PoliceNotifiedIndicator = segments.Length > 10 && segments[10].Length > 0 ? segments[10] : null; AccidentAddress = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[11], false, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } StudyPhaseIdentifier = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[1], false, seps) : null; DateTimeStudyPhaseBegan = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDateTime() : null; DateTimeStudyPhaseEnded = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableDateTime() : null; StudyPhaseEvaluability = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } PrimaryKeyValueIim = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[1], false, seps) : null; ServiceItemCode = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[2], false, seps) : null; InventoryLotNumber = segments.Length > 3 && segments[3].Length > 0 ? segments[3] : null; InventoryExpirationDate = segments.Length > 4 && segments[4].Length > 0 ? segments[4].ToNullableDateTime() : null; InventoryManufacturerName = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[5], false, seps) : null; InventoryLocation = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[6], false, seps) : null; InventoryReceivedDate = segments.Length > 7 && segments[7].Length > 0 ? segments[7].ToNullableDateTime() : null; InventoryReceivedQuantity = segments.Length > 8 && segments[8].Length > 0 ? segments[8].ToNullableDecimal() : null; InventoryReceivedQuantityUnit = segments.Length > 9 && segments[9].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[9], false, seps) : null; InventoryReceivedItemCost = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <Money>(segments[10], false, seps) : null; InventoryOnHandDate = segments.Length > 11 && segments[11].Length > 0 ? segments[11].ToNullableDateTime() : null; InventoryOnHandQuantity = segments.Length > 12 && segments[12].Length > 0 ? segments[12].ToNullableDecimal() : null; InventoryOnHandQuantityUnit = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[13], false, seps) : null; ProcedureCode = segments.Length > 14 && segments[14].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[14], false, seps) : null; ProcedureCodeModifier = segments.Length > 15 && segments[15].Length > 0 ? segments[15].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithNoExceptions>(x, false, seps)) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SetIdUb2 = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableUInt() : null; CoInsuranceDays9 = segments.Length > 2 && segments[2].Length > 0 ? segments[2] : null; ConditionCode24To30 = segments.Length > 3 && segments[3].Length > 0 ? segments[3].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; CoveredDays7 = segments.Length > 4 && segments[4].Length > 0 ? segments[4] : null; NonCoveredDays8 = segments.Length > 5 && segments[5].Length > 0 ? segments[5] : null; ValueAmountCode39To41 = segments.Length > 6 && segments[6].Length > 0 ? segments[6].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ValueCodeAndAmount>(x, false, seps)) : null; OccurrenceCodeDate32To35 = segments.Length > 7 && segments[7].Length > 0 ? segments[7].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <OccurrenceCodeAndDate>(x, false, seps)) : null; OccurrenceSpanCodeDates36 = segments.Length > 8 && segments[8].Length > 0 ? segments[8].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <OccurrenceSpanCodeAndDate>(x, false, seps)) : null; UniformBillingLocator2State = segments.Length > 9 && segments[9].Length > 0 ? segments[9].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; UniformBillingLocator11State = segments.Length > 10 && segments[10].Length > 0 ? segments[10].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; UniformBillingLocator31National = segments.Length > 11 && segments[11].Length > 0 ? segments[11] : null; DocumentControlNumber = segments.Length > 12 && segments[12].Length > 0 ? segments[12].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; UniformBillingLocator49National = segments.Length > 13 && segments[13].Length > 0 ? segments[13].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; UniformBillingLocator56State = segments.Length > 14 && segments[14].Length > 0 ? segments[14].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; UniformBillingLocator57Sational = segments.Length > 15 && segments[15].Length > 0 ? segments[15] : null; UniformBillingLocator78State = segments.Length > 16 && segments[16].Length > 0 ? segments[16].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; SpecialVisitCount = segments.Length > 17 && segments[17].Length > 0 ? segments[17].ToNullableDecimal() : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SetIdDg1 = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableUInt() : null; DiagnosisCodingMethod = segments.Length > 2 && segments[2].Length > 0 ? segments[2] : null; DiagnosisCodeDg1 = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[3], false, seps) : null; DiagnosisDescription = segments.Length > 4 && segments[4].Length > 0 ? segments[4] : null; DiagnosisDateTime = segments.Length > 5 && segments[5].Length > 0 ? segments[5].ToNullableDateTime() : null; DiagnosisType = segments.Length > 6 && segments[6].Length > 0 ? segments[6] : null; MajorDiagnosticCategory = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[7], false, seps) : null; DiagnosticRelatedGroup = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[8], false, seps) : null; DrgApprovalIndicator = segments.Length > 9 && segments[9].Length > 0 ? segments[9] : null; DrgGrouperReviewCode = segments.Length > 10 && segments[10].Length > 0 ? segments[10] : null; OutlierType = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[11], false, seps) : null; OutlierDays = segments.Length > 12 && segments[12].Length > 0 ? segments[12].ToNullableDecimal() : null; OutlierCost = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <CompositePrice>(segments[13], false, seps) : null; GrouperVersionAndType = segments.Length > 14 && segments[14].Length > 0 ? segments[14] : null; DiagnosisPriority = segments.Length > 15 && segments[15].Length > 0 ? segments[15] : null; DiagnosingClinician = segments.Length > 16 && segments[16].Length > 0 ? segments[16].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(x, false, seps)) : null; DiagnosisClassification = segments.Length > 17 && segments[17].Length > 0 ? segments[17] : null; ConfidentialIndicator = segments.Length > 18 && segments[18].Length > 0 ? segments[18] : null; AttestationDateTime = segments.Length > 19 && segments[19].Length > 0 ? segments[19].ToNullableDateTime() : null; DiagnosisIdentifier = segments.Length > 20 && segments[20].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[20], false, seps) : null; DiagnosisActionCode = segments.Length > 21 && segments[21].Length > 0 ? segments[21] : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SetIdBpo = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableUInt() : null; BpUniversalServiceIdentifier = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[2], false, seps) : null; BpProcessingRequirements = segments.Length > 3 && segments[3].Length > 0 ? segments[3].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; BpQuantity = segments.Length > 4 && segments[4].Length > 0 ? segments[4].ToNullableDecimal() : null; BpAmount = segments.Length > 5 && segments[5].Length > 0 ? segments[5].ToNullableDecimal() : null; BpUnits = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[6], false, seps) : null; BpIntendedUseDateTime = segments.Length > 7 && segments[7].Length > 0 ? segments[7].ToNullableDateTime() : null; BpIntendedDispenseFromLocation = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <PersonLocation>(segments[8], false, seps) : null; BpIntendedDispenseFromAddress = segments.Length > 9 && segments[9].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[9], false, seps) : null; BpRequestedDispenseDateTime = segments.Length > 10 && segments[10].Length > 0 ? segments[10].ToNullableDateTime() : null; BpRequestedDispenseToLocation = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize <PersonLocation>(segments[11], false, seps) : null; BpRequestedDispenseToAddress = segments.Length > 12 && segments[12].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[12], false, seps) : null; BpIndicationForUse = segments.Length > 13 && segments[13].Length > 0 ? segments[13].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; BpInformedConsentIndicator = segments.Length > 14 && segments[14].Length > 0 ? segments[14] : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } QueryPriority = segments.Length > 1 && segments[1].Length > 0 ? segments[1] : null; QuantityLimitedRequest = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CompositeQuantityWithUnits>(segments[2], false, seps) : null; ResponseModality = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[3], false, seps) : null; ExecutionAndDeliveryTime = segments.Length > 4 && segments[4].Length > 0 ? segments[4].ToNullableDateTime() : null; ModifyIndicator = segments.Length > 5 && segments[5].Length > 0 ? segments[5] : null; SortByField = segments.Length > 6 && segments[6].Length > 0 ? segments[6].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <SortOrder>(x, false, seps)) : null; SegmentGroupInclusion = segments.Length > 7 && segments[7].Length > 0 ? segments[7].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } PlacerAppointmentId = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[1], false, seps) : null; FillerAppointmentId = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[2], false, seps) : null; OccurrenceNumber = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableDecimal() : null; PlacerGroupNumber = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifierPair>(segments[4], false, seps) : null; ScheduleId = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[5], false, seps) : null; RequestEventReason = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[6], false, seps) : null; AppointmentReason = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[7], false, seps) : null; AppointmentType = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[8], false, seps) : null; AppointmentDuration = segments.Length > 9 && segments[9].Length > 0 ? segments[9].ToNullableDecimal() : null; AppointmentDurationUnits = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[10], false, seps) : null; RequestedStartDateTimeRange = segments.Length > 11 && segments[11].Length > 0 ? segments[11].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <DateTimeRange>(x, false, seps)) : null; PriorityArq = segments.Length > 12 && segments[12].Length > 0 ? segments[12] : null; RepeatingInterval = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <RepeatInterval>(segments[13], false, seps) : null; RepeatingIntervalDuration = segments.Length > 14 && segments[14].Length > 0 ? segments[14] : null; PlacerContactPerson = segments.Length > 15 && segments[15].Length > 0 ? segments[15].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(x, false, seps)) : null; PlacerContactPhoneNumber = segments.Length > 16 && segments[16].Length > 0 ? segments[16].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedTelecommunicationNumber>(x, false, seps)) : null; PlacerContactAddress = segments.Length > 17 && segments[17].Length > 0 ? segments[17].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedAddress>(x, false, seps)) : null; PlacerContactLocation = segments.Length > 18 && segments[18].Length > 0 ? TypeSerializer.Deserialize <PersonLocation>(segments[18], false, seps) : null; EnteredByPerson = segments.Length > 19 && segments[19].Length > 0 ? segments[19].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeIdNumberAndNameForPersons>(x, false, seps)) : null; EnteredByPhoneNumber = segments.Length > 20 && segments[20].Length > 0 ? segments[20].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedTelecommunicationNumber>(x, false, seps)) : null; EnteredByLocation = segments.Length > 21 && segments[21].Length > 0 ? TypeSerializer.Deserialize <PersonLocation>(segments[21], false, seps) : null; ParentPlacerAppointmentId = segments.Length > 22 && segments[22].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[22], false, seps) : null; ParentFillerAppointmentId = segments.Length > 23 && segments[23].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[23], false, seps) : null; PlacerOrderNumber = segments.Length > 24 && segments[24].Length > 0 ? segments[24].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <EntityIdentifier>(x, false, seps)) : null; FillerOrderNumber = segments.Length > 25 && segments[25].Length > 0 ? segments[25].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <EntityIdentifier>(x, false, seps)) : null; }
public void Test_Deserialize_Null() { var serializer = new TypeSerializer(new ManualByteConverter()); object value = null; var bytes = serializer.SerializeAsJson(value); var actual = serializer.Deserialize<object>(bytes, 0, bytes.Length); Assert.AreEqual(value, actual); }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SetIdPye = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableUInt() : null; PayeeType = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[2], false, seps) : null; PayeeRelationshipToInvoicePatient = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[3], false, seps) : null; PayeeIdentificationList = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[4], false, seps) : null; PayeePersonName = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <ExtendedPersonName>(segments[5], false, seps) : null; PayeeAddress = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[6], false, seps) : null; PaymentMethod = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[7], false, seps) : null; }
private void TestTypeSerializerHelper(Type t, string s) { Assert.AreEqual(s, TypeSerializer.Serialize(t)); Assert.AreEqual(t, TypeSerializer.Deserialize(s)); }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } ReferralStatus = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[1], false, seps) : null; ReferralPriority = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[2], false, seps) : null; ReferralType = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[3], false, seps) : null; ReferralDisposition = segments.Length > 4 && segments[4].Length > 0 ? segments[4].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; ReferralCategory = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[5], false, seps) : null; OriginatingReferralIdentifier = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[6], false, seps) : null; EffectiveDate = segments.Length > 7 && segments[7].Length > 0 ? segments[7].ToNullableDateTime() : null; ExpirationDate = segments.Length > 8 && segments[8].Length > 0 ? segments[8].ToNullableDateTime() : null; ProcessDate = segments.Length > 9 && segments[9].Length > 0 ? segments[9].ToNullableDateTime() : null; ReferralReason = segments.Length > 10 && segments[10].Length > 0 ? segments[10].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; ExternalReferralIdentifier = segments.Length > 11 && segments[11].Length > 0 ? segments[11].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <EntityIdentifier>(x, false, seps)) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SetIdSpm = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableUInt() : null; SpecimenId = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifierPair>(segments[2], false, seps) : null; SpecimenParentIds = segments.Length > 3 && segments[3].Length > 0 ? segments[3].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <EntityIdentifierPair>(x, false, seps)) : null; SpecimenType = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null; SpecimenTypeModifier = segments.Length > 5 && segments[5].Length > 0 ? segments[5].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenAdditives = segments.Length > 6 && segments[6].Length > 0 ? segments[6].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenCollectionMethod = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[7], false, seps) : null; SpecimenSourceSite = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[8], false, seps) : null; SpecimenSourceSiteModifier = segments.Length > 9 && segments[9].Length > 0 ? segments[9].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenCollectionSite = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[10], false, seps) : null; SpecimenRole = segments.Length > 11 && segments[11].Length > 0 ? segments[11].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenCollectionAmount = segments.Length > 12 && segments[12].Length > 0 ? TypeSerializer.Deserialize <CompositeQuantityWithUnits>(segments[12], false, seps) : null; GroupedSpecimenCount = segments.Length > 13 && segments[13].Length > 0 ? segments[13].ToNullableDecimal() : null; SpecimenDescription = segments.Length > 14 && segments[14].Length > 0 ? segments[14].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; SpecimenHandlingCode = segments.Length > 15 && segments[15].Length > 0 ? segments[15].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenRiskCode = segments.Length > 16 && segments[16].Length > 0 ? segments[16].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenCollectionDateTime = segments.Length > 17 && segments[17].Length > 0 ? TypeSerializer.Deserialize <DateTimeRange>(segments[17], false, seps) : null; SpecimenReceivedDateTime = segments.Length > 18 && segments[18].Length > 0 ? segments[18].ToNullableDateTime() : null; SpecimenExpirationDateTime = segments.Length > 19 && segments[19].Length > 0 ? segments[19].ToNullableDateTime() : null; SpecimenAvailability = segments.Length > 20 && segments[20].Length > 0 ? segments[20] : null; SpecimenRejectReason = segments.Length > 21 && segments[21].Length > 0 ? segments[21].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenQuality = segments.Length > 22 && segments[22].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[22], false, seps) : null; SpecimenAppropriateness = segments.Length > 23 && segments[23].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[23], false, seps) : null; SpecimenCondition = segments.Length > 24 && segments[24].Length > 0 ? segments[24].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; SpecimenCurrentQuantity = segments.Length > 25 && segments[25].Length > 0 ? TypeSerializer.Deserialize <CompositeQuantityWithUnits>(segments[25], false, seps) : null; NumberOfSpecimenContainers = segments.Length > 26 && segments[26].Length > 0 ? segments[26].ToNullableDecimal() : null; ContainerType = segments.Length > 27 && segments[27].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[27], false, seps) : null; ContainerCondition = segments.Length > 28 && segments[28].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[28], false, seps) : null; SpecimenChildRole = segments.Length > 29 && segments[29].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[29], false, seps) : null; AccessionId = segments.Length > 30 && segments[30].Length > 0 ? segments[30].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeIdWithCheckDigit>(x, false, seps)) : null; OtherSpecimenId = segments.Length > 31 && segments[31].Length > 0 ? segments[31].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedCompositeIdWithCheckDigit>(x, false, seps)) : null; ShipmentId = segments.Length > 32 && segments[32].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[32], false, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SetIdAff = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableUInt() : null; ProfessionalOrganization = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[2], false, seps) : null; ProfessionalOrganizationAddress = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <ExtendedAddress>(segments[3], false, seps) : null; ProfessionalOrganizationAffiliationDateRange = segments.Length > 4 && segments[4].Length > 0 ? segments[4].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <DateTimeRange>(x, false, seps)) : null; ProfessionalAffiliationAdditionalInformation = segments.Length > 5 && segments[5].Length > 0 ? segments[5] : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } ProviderProductServiceSectionNumber = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[1], false, seps) : null; PayerProductServiceSectionNumber = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[2], false, seps) : null; ProductServiceSectionSequenceNumber = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableUInt() : null; BilledAmount = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CompositePrice>(segments[4], false, seps) : null; SectionDescriptionOrHeading = segments.Length > 5 && segments[5].Length > 0 ? segments[5] : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } UniversalServiceIdentifier = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[1], false, seps) : null; AutoDilutionFactor = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <StructuredNumeric>(segments[2], false, seps) : null; RerunDilutionFactor = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <StructuredNumeric>(segments[3], false, seps) : null; PreDilutionFactor = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <StructuredNumeric>(segments[4], false, seps) : null; EndogenousContentOfPreDilutionDiluent = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <StructuredNumeric>(segments[5], false, seps) : null; AutomaticRepeatAllowed = segments.Length > 6 && segments[6].Length > 0 ? segments[6] : null; ReflexAllowed = segments.Length > 7 && segments[7].Length > 0 ? segments[7] : null; AnalyteRepeatStatus = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[8], false, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } CommandResponse = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[1], false, seps) : null; DateTimeCompleted = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDateTime() : null; CommandResponseParameters = segments.Length > 3 && segments[3].Length > 0 ? segments[3].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } ActionCode = segments.Length > 1 && segments[1].Length > 0 ? segments[1] : null; ActionDateTime = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDateTime() : null; ProblemId = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[3], false, seps) : null; ProblemInstanceId = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[4], false, seps) : null; EpisodeOfCareId = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[5], false, seps) : null; ProblemListPriority = segments.Length > 6 && segments[6].Length > 0 ? segments[6].ToNullableDecimal() : null; ProblemEstablishedDateTime = segments.Length > 7 && segments[7].Length > 0 ? segments[7].ToNullableDateTime() : null; AnticipatedProblemResolutionDateTime = segments.Length > 8 && segments[8].Length > 0 ? segments[8].ToNullableDateTime() : null; ActualProblemResolutionDateTime = segments.Length > 9 && segments[9].Length > 0 ? segments[9].ToNullableDateTime() : null; ProblemClassification = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[10], false, seps) : null; ProblemManagementDiscipline = segments.Length > 11 && segments[11].Length > 0 ? segments[11].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; ProblemPersistence = segments.Length > 12 && segments[12].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[12], false, seps) : null; ProblemConfirmationStatus = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[13], false, seps) : null; ProblemLifeCycleStatus = segments.Length > 14 && segments[14].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[14], false, seps) : null; ProblemLifeCycleStatusDateTime = segments.Length > 15 && segments[15].Length > 0 ? segments[15].ToNullableDateTime() : null; ProblemDateOfOnset = segments.Length > 16 && segments[16].Length > 0 ? segments[16].ToNullableDateTime() : null; ProblemOnsetText = segments.Length > 17 && segments[17].Length > 0 ? segments[17] : null; ProblemRanking = segments.Length > 18 && segments[18].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[18], false, seps) : null; CertaintyOfProblem = segments.Length > 19 && segments[19].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[19], false, seps) : null; ProbabilityOfProblem01 = segments.Length > 20 && segments[20].Length > 0 ? segments[20].ToNullableDecimal() : null; IndividualAwarenessOfProblem = segments.Length > 21 && segments[21].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[21], false, seps) : null; ProblemPrognosis = segments.Length > 22 && segments[22].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[22], false, seps) : null; IndividualAwarenessOfPrognosis = segments.Length > 23 && segments[23].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[23], false, seps) : null; FamilySignificantOtherAwarenessOfProblemPrognosis = segments.Length > 24 && segments[24].Length > 0 ? segments[24] : null; SecuritySensitivity = segments.Length > 25 && segments[25].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[25], false, seps) : null; ProblemSeverity = segments.Length > 26 && segments[26].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[26], false, seps) : null; ProblemPerspective = segments.Length > 27 && segments[27].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[27], false, seps) : null; MoodCode = segments.Length > 28 && segments[28].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[28], false, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SequenceNumberTestObservationMasterFile = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableDecimal() : null; PreferredCodingSystem = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[2], false, seps) : null; ValidCodedAnswers = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedElement>(segments[3], false, seps) : null; NormalTextCodesForCategoricalObservations = segments.Length > 4 && segments[4].Length > 0 ? segments[4].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; AbnormalTextCodesForCategoricalObservations = segments.Length > 5 && segments[5].Length > 0 ? segments[5].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; CriticalTextCodesForCategoricalObservations = segments.Length > 6 && segments[6].Length > 0 ? segments[6].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedElement>(x, false, seps)) : null; ValueType = segments.Length > 7 && segments[7].Length > 0 ? segments[7] : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } ErrorCodeAndLocation = segments.Length > 1 && segments[1].Length > 0 ? segments[1] : null; ErrorLocation = segments.Length > 2 && segments[2].Length > 0 ? segments[2].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ErrorLocation>(x, false, seps)) : null; Hl7ErrorCode = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[3], false, seps) : null; Severity = segments.Length > 4 && segments[4].Length > 0 ? segments[4] : null; ApplicationErrorCode = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[5], false, seps) : null; ApplicationErrorParameter = segments.Length > 6 && segments[6].Length > 0 ? segments[6].Split(seps.FieldRepeatSeparator, StringSplitOptions.None) : null; DiagnosticInformation = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <Text>(segments[7], false, seps) : null; UserMessage = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <Text>(segments[8], false, seps) : null; InformPersonIndicator = segments.Length > 9 && segments[9].Length > 0 ? segments[9].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; OverrideType = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[10], false, seps) : null; OverrideReasonCode = segments.Length > 11 && segments[11].Length > 0 ? segments[11].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; HelpDeskContactPoint = segments.Length > 12 && segments[12].Length > 0 ? segments[12].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <ExtendedTelecommunicationNumber>(x, false, seps)) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } StudyScheduledTimePoint = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[1], false, seps) : null; StudyScheduledPatientTimePoint = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDateTime() : null; StudyQualityControlCodes = segments.Length > 3 && segments[3].Length > 0 ? segments[3].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] separator = IsSubcomponent ? seps.SubcomponentSeparator : seps.ComponentSeparator; string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(separator, StringSplitOptions.None); OrganizationName = segments.Length > 0 && segments[0].Length > 0 ? segments[0] : null; OrganizationNameTypeCode = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[1], true, seps) : null; IdNumber = segments.Length > 2 && segments[2].Length > 0 ? segments[2].ToNullableDecimal() : null; IdentifierCheckDigit = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableDecimal() : null; CheckDigitScheme = segments.Length > 4 && segments[4].Length > 0 ? segments[4] : null; AssigningAuthority = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <HierarchicDesignator>(segments[5], true, seps) : null; IdentifierTypeCode = segments.Length > 6 && segments[6].Length > 0 ? segments[6] : null; AssigningFacility = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <HierarchicDesignator>(segments[7], true, seps) : null; NameRepresentationCode = segments.Length > 8 && segments[8].Length > 0 ? segments[8] : null; OrganizationIdentifier = segments.Length > 9 && segments[9].Length > 0 ? segments[9] : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] separator = IsSubcomponent ? seps.SubcomponentSeparator : seps.ComponentSeparator; string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(separator, StringSplitOptions.None); VersionId = segments.Length > 0 && segments[0].Length > 0 ? segments[0] : null; InternationalizationCode = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[1], true, seps) : null; InternationalVersionId = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[2], true, seps) : null; }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } ProviderAdjustmentNumber = segments.Length > 1 && segments[1].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[1], false, seps) : null; PayerAdjustmentNumber = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[2], false, seps) : null; AdjustmentSequenceNumber = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableUInt() : null; AdjustmentCategory = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null; AdjustmentAmount = segments.Length > 5 && segments[5].Length > 0 ? TypeSerializer.Deserialize <CompositePrice>(segments[5], false, seps) : null; AdjustmentQuantity = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CompositeQuantityWithUnits>(segments[6], false, seps) : null; AdjustmentReasonPa = segments.Length > 7 && segments[7].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[7], false, seps) : null; AdjustmentDescription = segments.Length > 8 && segments[8].Length > 0 ? segments[8] : null; OriginalValue = segments.Length > 9 && segments[9].Length > 0 ? segments[9].ToNullableDecimal() : null; SubstituteValue = segments.Length > 10 && segments[10].Length > 0 ? segments[10].ToNullableDecimal() : null; AdjustmentAction = segments.Length > 11 && segments[11].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[11], false, seps) : null; ProviderAdjustmentNumberCrossReference = segments.Length > 12 && segments[12].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[12], false, seps) : null; ProviderProductServiceLineItemNumberCrossReference = segments.Length > 13 && segments[13].Length > 0 ? TypeSerializer.Deserialize <EntityIdentifier>(segments[13], false, seps) : null; AdjustmentDate = segments.Length > 14 && segments[14].Length > 0 ? segments[14].ToNullableDateTime() : null; ResponsibleOrganization = segments.Length > 15 && segments[15].Length > 0 ? TypeSerializer.Deserialize <ExtendedCompositeNameAndIdNumberForOrganizations>(segments[15], false, seps) : null; }
public void Test_Deserialize_Int() { var serializer = new TypeSerializer(new ManualByteConverter()); var five = 5; var bytes = serializer.Serialize(five); var actual = serializer.Deserialize<int>(bytes, 0, bytes.Length); Assert.AreEqual(five, actual); }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } RxComponentType = segments.Length > 1 && segments[1].Length > 0 ? segments[1] : null; ComponentCode = segments.Length > 2 && segments[2].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[2], false, seps) : null; ComponentAmount = segments.Length > 3 && segments[3].Length > 0 ? segments[3].ToNullableDecimal() : null; ComponentUnits = segments.Length > 4 && segments[4].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[4], false, seps) : null; ComponentStrength = segments.Length > 5 && segments[5].Length > 0 ? segments[5].ToNullableDecimal() : null; ComponentStrengthUnits = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[6], false, seps) : null; SupplementaryCode = segments.Length > 7 && segments[7].Length > 0 ? segments[7].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; ComponentDrugStrengthVolume = segments.Length > 8 && segments[8].Length > 0 ? segments[8].ToNullableDecimal() : null; ComponentDrugStrengthVolumeUnits = segments.Length > 9 && segments[9].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[9], false, seps) : null; }
public void Test_Deserialize_String() { var serializer = new TypeSerializer(new ManualByteConverter()); var value = "astring"; var bytes = serializer.Serialize(value); var bytes1 = Encoding.UTF8.GetBytes(value); var actual = serializer.Deserialize<string>(bytes, 0, bytes.Length); Assert.AreEqual(value, actual); }
/// <inheritdoc/> public void FromDelimitedString(string delimitedString, Separators separators) { Separators seps = separators ?? new Separators().UsingConfigurationValues(); string[] segments = delimitedString == null ? Array.Empty <string>() : delimitedString.Split(seps.FieldSeparator, StringSplitOptions.None); if (segments.Length > 0) { if (string.Compare(Id, segments[0], true, CultureInfo.CurrentCulture) != 0) { throw new ArgumentException($"{ nameof(delimitedString) } does not begin with the proper segment Id: '{ Id }{ seps.FieldSeparator }'.", nameof(delimitedString)); } } SetIdAis = segments.Length > 1 && segments[1].Length > 0 ? segments[1].ToNullableUInt() : null; SegmentActionCode = segments.Length > 2 && segments[2].Length > 0 ? segments[2] : null; UniversalServiceIdentifier = segments.Length > 3 && segments[3].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[3], false, seps) : null; StartDateTime = segments.Length > 4 && segments[4].Length > 0 ? segments[4].ToNullableDateTime() : null; StartDateTimeOffset = segments.Length > 5 && segments[5].Length > 0 ? segments[5].ToNullableDecimal() : null; StartDateTimeOffsetUnits = segments.Length > 6 && segments[6].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[6], false, seps) : null; Duration = segments.Length > 7 && segments[7].Length > 0 ? segments[7].ToNullableDecimal() : null; DurationUnits = segments.Length > 8 && segments[8].Length > 0 ? TypeSerializer.Deserialize <CodedWithNoExceptions>(segments[8], false, seps) : null; AllowSubstitutionCode = segments.Length > 9 && segments[9].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[9], false, seps) : null; FillerStatusCode = segments.Length > 10 && segments[10].Length > 0 ? TypeSerializer.Deserialize <CodedWithExceptions>(segments[10], false, seps) : null; PlacerSupplementalServiceInformation = segments.Length > 11 && segments[11].Length > 0 ? segments[11].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; FillerSupplementalServiceInformation = segments.Length > 12 && segments[12].Length > 0 ? segments[12].Split(seps.FieldRepeatSeparator, StringSplitOptions.None).Select(x => TypeSerializer.Deserialize <CodedWithExceptions>(x, false, seps)) : null; }