public IList<Medication> parse(string message) { PipeParser pp = new PipeParser(); ORP_O10 orp_o10 = (ORP_O10)pp.Parse(message); ORP_O10_ORCRXE orp_o10_orcrxe = new ORP_O10_ORCRXE(); // ORP_O10 doesn't parse the RXE segment of the response so we need this class extension if (!String.Equals(((MSA)orp_o10.GetStructure("MSA")).AcknowledgementCode.Value, "AA", StringComparison.CurrentCultureIgnoreCase)) { throw new mdo.exceptions.MdoException("Error in refill response: " + message); } IList<Medication> meds = new List<Medication>(); //IStructure[] structs = orp_o10.GetAll("RXE"); string[] lines = message.Split(new char[] { '\r' }); IList<string> rxeLines = new List<string>(); foreach (string line in lines) { if (String.IsNullOrEmpty(line)) { continue; } if (line.StartsWith("RXE")) { rxeLines.Add(line); } } for (int i = 0; i < rxeLines.Count; i++) { meds.Add(buildMedication(getRxe(rxeLines[i], orp_o10_orcrxe.getRxe(i)))); } return meds; }
public IList <Medication> parse(string message) { PipeParser pp = new PipeParser(); ORP_O10 orp_o10 = (ORP_O10)pp.Parse(message); ORP_O10_ORCRXE orp_o10_orcrxe = new ORP_O10_ORCRXE(); // ORP_O10 doesn't parse the RXE segment of the response so we need this class extension if (!String.Equals(((MSA)orp_o10.GetStructure("MSA")).AcknowledgementCode.Value, "AA", StringComparison.CurrentCultureIgnoreCase)) { throw new mdo.exceptions.MdoException("Error in refill response: " + message); } IList <Medication> meds = new List <Medication>(); //IStructure[] structs = orp_o10.GetAll("RXE"); string[] lines = message.Split(new char[] { '\r' }); IList <string> rxeLines = new List <string>(); foreach (string line in lines) { if (String.IsNullOrEmpty(line)) { continue; } if (line.StartsWith("RXE")) { rxeLines.Add(line); } } for (int i = 0; i < rxeLines.Count; i++) { meds.Add(buildMedication(getRxe(rxeLines[i], orp_o10_orcrxe.getRxe(i)))); } return(meds); }