Esempio n. 1
0
 protected override void FullyParse()
 {
     if (!string.IsNullOrEmpty(Value))
     {
         var segments = Value.Split(Encoding.SegmentSeparator, StringSplitOptions.None).ToList();
         segmentsInternal.Clear();
         foreach (var segment in segments)
         {
             segmentsInternal.Add(Hl7Segment.Parse(segment, Encoding));
         }
     }
     Value    = null;
     IsParsed = true;
 }
Esempio n. 2
0
        public static Hl7Segment Parse(string segment, Hl7Encoding encoding)
        {
            if (segment == null)
            {
                throw new ArgumentNullException(nameof(segment));
            }

            if (segment.Length < 3 ||
                segment.Length > 3 && segment[3] != encoding.FieldSeparator ||
                segment.Substring(0, 3).Contains(encoding.FieldSeparator))
            {
                throw new ArgumentException("Segment names should be 3 character long", segment);
            }

            var segmentName = segment.Substring(0, 3);
            var hl7Segment  = new Hl7Segment(segmentName, segment, encoding);

            if (segment.Length <= 4)
            {
                hl7Segment.EnsureFullyParsed();
            }
            return(hl7Segment);
        }
Esempio n. 3
0
 public static Hl7Message operator +(Hl7Message message, string segment)
 {
     message += Hl7Segment.Parse(segment, message.Encoding);
     return(message);
 }