Beispiel #1
0
        protected override void ProcessValue()
        {
            List <string> allSubComponents;

            if (this.isDelimiter)
            {
                allSubComponents = new List <string>(new [] { this.Value });
            }
            else
            {
                allSubComponents = MessageHelper.SplitString(_value, this.Encoding.SubComponentDelimiter);
            }

            if (allSubComponents.Count > 1)
            {
                this.IsSubComponentized = true;
            }

            this.SubComponentList = new ElementCollection <SubComponent>();

            foreach (string strSubComponent in allSubComponents)
            {
                SubComponent subComponent = new SubComponent(this.Encoding.Decode(strSubComponent), this.Encoding);
                SubComponentList.Add(subComponent);
            }
        }
Beispiel #2
0
        public bool AddNewSubComponent(SubComponent subComponent, int position)
        {
            if (position < 1)
            {
                throw new HL7Exception($"Invalid subcomponents index ({position} < 1)");
            }

            try
            {
                this.SubComponentList.Add(subComponent, position);
                return(true);
            }
            catch (Exception ex)
            {
                throw new HL7Exception("Unable to add new subcomponent Error - " + ex.Message);
            }
        }
Beispiel #3
0
        protected override void ProcessValue()
        {
            if (this.IsDelimiters)  // Special case for the delimiters fields (MSH)
            {
                var subcomponent = new SubComponent(_value, this.Encoding);

                this.ComponentList = new ElementCollection <Component>();
                Component component = new Component(this.Encoding, true);

                component.SubComponentList.Add(subcomponent);

                this.ComponentList.Add(component);
                return;
            }

            this.HasRepetitions = _value.Contains(this.Encoding.RepeatDelimiter);

            if (this.HasRepetitions)
            {
                _RepetitionList = new List <Field>();
                List <string> individualFields = MessageHelper.SplitString(_value, this.Encoding.RepeatDelimiter);

                for (int index = 0; index < individualFields.Count; index++)
                {
                    Field field = new Field(individualFields[index], this.Encoding);
                    _RepetitionList.Add(field);
                }
            }
            else
            {
                List <string> allComponents = MessageHelper.SplitString(_value, this.Encoding.ComponentDelimiter);

                this.ComponentList = new ElementCollection <Component>();

                foreach (string strComponent in allComponents)
                {
                    Component component = new Component(this.Encoding);
                    component.Value = strComponent;
                    this.ComponentList.Add(component);
                }

                this.IsComponentized = this.ComponentList.Count > 1;
            }
        }