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 List <SubComponent>(); foreach (string strSubComponent in allSubComponents) { SubComponent subComponent = new SubComponent(this.Encoding.Decode(strSubComponent), this.Encoding); SubComponentList.Add(subComponent); } }
public void AddSubComponent(SubComponent subComponent) { if (!this.IsSubComponentized) { throw new HL7Exception("Component must be subcomponentized (IsSubComponentized = true)"); } if (SubComponentList == null) { SubComponentList = new List <SubComponent>(); } SubComponentList.Add(subComponent); }
public SubComponent SubComponents(int position) { position = position - 1; SubComponent sub = null; try { sub = SubComponentList[position]; } catch (Exception ex) { throw new HL7Exception("SubComponent not availalbe Error-" + ex.Message); } return(sub); }
protected override void ProcessValue() { List <string> AllSubComponents = MessageHelper.SplitString(_value, this.Encoding.SubComponentDelimiter); if (AllSubComponents.Count > 1) { this.IsSubComponentized = true; } SubComponentList = new List <SubComponent>(); foreach (string strSubComponent in AllSubComponents) { SubComponent subComponent = new SubComponent(Encoding.Decode(strSubComponent)); SubComponentList.Add(subComponent); } }
protected override void ProcessValue() { if (this.IsDelimiters) // Special case for the delimiters field (MSH) { var subcomponent = new SubComponent(_value); this.ComponentList = new ComponentCollection(); Component component = new Component(this.Encoding); component.SubComponentList.Add(subcomponent); this.ComponentList.Add(component); return; } if (_value.Length > 0) { 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 ComponentCollection(); foreach (string strComponent in allComponents) { Component component = new Component(this.Encoding); component.Value = strComponent; this.ComponentList.Add(component); } this.IsComponentized = this.ComponentList.Count > 1; } } }