Question
C# - Develop a class and supporting class(se) that will generate the EDI string for an X12 850 Purchase Order. Only the mandatory segments and
C# - Develop a class and supporting class(se) that will generate the EDI string for an X12 850 Purchase Order. Only the mandatory segments and elements are required. Use the delimiters defined in the table below when generating the output. The class must be able to handle multiple PO1 segments according to the standard and must generate the proper values for the following elements: ST02 control number (a sequential number), CTT01 Line Item Count, SE01 number of segments, and SE02 control number. Override the ToString method of the PurchaseOrder class to generate the output. The Constructor of the class must accept a string containing a valid X12 EDI Purchase Order and initialize the class. If the incoming EDI is invalid, throw an appropriate exception. The overall design of the program is at your discretion; however, a mandatory use case is the ability to create a PO using an EDI string and update the price and quantity and generate an updated EDI document. Your design should consider that other elements may also need to be updated.
I am looking to write each line to console with header section ST, BEG, detail section PO1, summary SE.
Segment Delimiter ~ (tilde) hex: 0x7E
Element Delimiter * (asterisk) hex: 0x2A
Sample file to translate:
ST*850*0021~ (0021 number is autogenerated min 4 max 9 alphanumeric characters as element ST02)
BEG*00*DS*61469078**20120201*0314186030~
PO1*00010*1*EA*1062.82*CP*BP*RH0155783RN*VP*DV3128 REF*BB*LIC123456 REF*PLA*Authcode REF~ (this can be multiple lines of PO1 to be translated)
CTT*1~ (CTT01 this must count number of PO1 line items in EDI file)
SE*31*0021~ (31 is SE01 and must count number of segments(lines using ~), 0021 is SE02 and must generated number with min 4 max 9 alphanumeric characters)
to console something like this:
ST*850*0021 becomes
Transaction Set Header
Transaction Set Identifier Code: 850
Transaction Set Control Number: 0021.
This would be the same for each line.
Any help would be appreciated.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started