/// <summary> /// Writes a message to the destination. /// </summary> /// <param name="message">The message to write.</param> public override void Write(EdiMessage message) { if (_separators == null) { throw new Exception("No interchange was started."); } _messageCounter++; var segmentCounter = 0; var transactionSet = new TransactionSet(message.GetStandardType(), message); transactionSet.RemoveTrailer(MessageTrailer); foreach (var segment in transactionSet.Descendants <Segment>()) { Write(segment.Generate(_separators, PreserveWhitespace)); segmentCounter++; } if (message.Name == "TA1") { return; } segmentCounter++; var trailer = BuildTrailer(MessageTrailer, message.ControlNumber, segmentCounter); Write(trailer); }
public override void Write(EdiMessage message) { var transactionSet = new TransactionSet(message.GetStandardType(), message); foreach (var segment in transactionSet.Descendants <Segment>()) { Write(segment.Generate(Pad)); } }