private static void process_address_line(Segment line, Address address, string elementDelimeter) { List<string> arr = line.GetElements(elementDelimeter); if (line.Label == EDIConstants.AddressNameLabel) { address.AddressType = get_address_type(arr[1]); address.AddressName = arr[2]; if (arr.Count >= 4) address.AddressCode = arr[3]; } if (line.Label == EDIConstants.AddressLineLabel) if (string.IsNullOrEmpty(address.Address1)) address.Address1 = arr[1]; else { if (string.IsNullOrEmpty(address.Address2)) address.Address2 = arr[1]; } if (line.Label == EDIConstants.GeographicLabel) { address.City = arr[1]; address.State = arr[2]; address.Zip = arr[3]; } }
private ReceiptAcknowledgementMsg getAck(Segment segment ) { var els = segment.GetElements(_elementDelimiter); var ack = new ReceiptAcknowledgementMsg(); ack.ControlNumber = els[2]; ack.DocumentId = els[1].CastToInt(); return ack; }
public CustomerOrderLine CreateLine(Segment line_seg) { if (line_seg.Label != "PO1") return null; SegmentCount++; string el_delimiter = line_seg.Contents.Substring(3, 1); List<string> arr = line_seg.GetElements(el_delimiter); var line = new CustomerOrderLine { LineNumber = arr[1].CastToInt(), RequestedQuantity = arr[2].CastToInt(), RequestedPrice = arr[4].CastToDouble() }; for (int i = 6; i < arr.Count - 1; i++) { if (arr[i] == "IN") line.CustomerPartNumber = arr[i + 1]; if (arr[i] == "PD") line.ItemDescription = arr[i + 1]; if (arr[i] == "VN") line.ItemID = arr[i + 1]; } return line; }
private static string get_element_delimiter(Segment header) { return header.Contents.Substring(2, 1); }