private bool CopyToHl7Message(Hl7Message hl7Message, Hl7Comparator sourceComparator) { bool messagePopulated = true; // Check if both templates have been initialized correctly if ((this.Template == null) || (sourceComparator.Template == null)) { return(false); } // Iterate over this comparator foreach (Hl7ComparisonTag thisComparisonTag in this.Template.ComparisonTags) { // try to get the equivalent tag in the sourceComparator Hl7ComparisonTag sourceComparisonTag = sourceComparator.Template.ComparisonTags.Find(thisComparisonTag.Tag); if (sourceComparisonTag != null) { System.String stringValue = sourceComparisonTag.DataFormat.ToHl7Format(); if (hl7Message != null) { // add the value hl7Message.AddValue(sourceComparisonTag.Tag.Segment, sourceComparisonTag.Tag.FieldIndex, stringValue); } } } return(messagePopulated); }