/// <summary> /// Batch multiple transactions under multiple functional groups in the same EDI stream. /// </summary> public static void Run() { Debug.WriteLine("******************************"); Debug.WriteLine(MethodBase.GetCurrentMethod().Name); Debug.WriteLine("******************************"); using (var stream = new MemoryStream()) { using (var writer = new EdifactWriter(stream)) { writer.Write(SegmentBuilders.BuildUnb("1")); // 1. Write the first group writer.Write(SegmentBuilders.BuildUng("1", "INVOIC")); writer.Write(EF_EDIFACT_D96A_INVOIC_Builder.BuildInvoice("1")); // 2. Write the second group // No need to close the previous group with a UNE writer.Write(SegmentBuilders.BuildUng("2", "ORDERS")); writer.Write(EF_EDIFACT_D96A_ORDERS_Builder.BuildPurchaseOrder("1")); } Debug.Write(stream.LoadToString()); } }
/// <summary> /// Write Passenger Data /// </summary> static void Write() { var transaction = BuildPassengerData("1"); using (var stream = new MemoryStream()) { using (var writer = new EdifactWriter(stream)) { writer.Write(SegmentBuilders.BuildUnb("13052210400995")); writer.Write(SegmentBuilders.BuildUng("13052210400995", "PNRGOV")); writer.Write(transaction); } var ediString = stream.LoadToString(); } }
/// <summary> /// Write Passenger List /// </summary> static void Write() { var transaction = BuildPassengerList("PAXLST16"); using (var stream = new MemoryStream()) { using (var writer = new EdifactWriter(stream)) { writer.Write(SegmentBuilders.BuildUnb("1")); writer.Write(SegmentBuilders.BuildUng("16", "PAXLST")); writer.Write(transaction); } var ediString = stream.LoadToString(); } }