Joining Files
EDIFileJoiner is capable of joining any number of X12 EDI files into one. The joining operation is asynchronous by nature allowing program flow to continue.
Example
EDIFileJoiner joiner = new EDIFileJoiner();
// Join the files at the ST header level
joiner.FileJoinLevel = FileJoinLevel.HEADER;
// Subscribe to be notified when the joining operation is complete
joiner.OnFileOperationCompleted += new EventHandler(joiner_OnFileOperationCompleted);
// Specify the list of files to join
List files = new List();
files.Add(“834_1.txt”);
files.Add(“834_2.txt”);
files.Add(“834_2ST.txt”);
files.Add(“834_5010.txt”);
// Join the EDI files
joiner.Join(files, “CombinedAll.txt”);
private void joiner_OnFileOperationCompleted(object sender, FileOperationCompletedEventArgs e)
{
if (e.Status != FileOperationStatus.Success)
{
{
if (e.Status != FileOperationStatus.Success)
{
// Success
}
}
}
}
Files can also be joined asynchronously using the async join methods. Use the EachSegmentInNewLine property to make every segment appear in a new line.