public async Task <IActionResult> GetISAById(string isaId) { try { if (!ObjectIdValidator.Validate(isaId)) { return(BadRequest("Please enter valid ISA Id.")); } var facilityKey = Guid.Parse(executionContextAccessor.Current.Facility.FacilityKey); _logger.LogInformation(LoggingConstants.GetISAById, facilityKey); ISA isa = await _isaManager.GetISAById(isaId, facilityKey); if (isa == null) { _logger.LogError(LoggingConstants.Empty_List); return(NotFound($"ISA with ISA ID {isaId} not found")); } return(Ok(isa)); } catch (Exception ex) { _logger.LogError(ex.Message); return(StatusCode(500)); } }
///<Summary> ///<CreatedOn>08/08/2018</CreatedOn> ///<Author>Sunny Bhardwaj</Author> ///<Description>Returns object for ISA segments(Interchange Contoller Header)</Description> ///</Summary> public static ISA GetISA(string ISA01, string ISA02, string ISA03, string ISA04, string ISA05, string ISA06, string ISA07, string ISA08, string ISA09, string ISA10, string ISA11, string ISA12, string ISA13, string ISA14, string ISA15, string ISA16) { ISA obj = new ISA(); obj.ISA01 = ISA01; // ISA01 and ISA03 are used in case of security purpose otherwise set to 00 obj.ISA02 = string.Empty.PadRight((int)SegmentLength.Ten); // Requred ten empty spaces in this segment element as per edi standard obj.ISA03 = ISA03; obj.ISA04 = string.Empty.PadRight((int)SegmentLength.Ten); // Requred ten empty spaces in this segment element as per edi standard obj.ISA05 = ISA05; obj.ISA06 = CreateString(ISA06, (int)SegmentLength.Fifteen, (int)SegmentLength.Fifteen, ' ', true, true); //Sender Id will be of 15 chararcters obj.ISA07 = ISA07; obj.ISA08 = CreateString(ISA08, (int)SegmentLength.Fifteen, (int)SegmentLength.Fifteen, ' ', true, true); //Receiver Id will be of 15 characters obj.ISA09 = ISA09; obj.ISA10 = ISA10; obj.ISA11 = ISA11; obj.ISA12 = ISA12; /////Batch Id is the Control No.All the claims will be under this control number obj.ISA13 = ISA13; obj.ISA14 = ISA14; obj.ISA15 = ISA15; obj.ISA16 = ISA16; return(obj); }
public void ISA0ftTest() { var isa = new ISA(0); Assert.AreEqual(288.15, isa.T, 0.01); Assert.AreEqual(101325, isa.P, 1); Assert.AreEqual(1.22500, isa.Rho, 0.01); Assert.AreEqual(340.294, isa.VSound, 0.01); }
public void ISA1000ftTest() { var isa = new ISA(1000); Assert.AreEqual(286.1688, isa.T, 0.01); Assert.AreEqual(97717, isa.P, 1); Assert.AreEqual(1.18955, isa.Rho, 0.01); Assert.AreEqual(339.122, isa.VSound, 0.01); }
public void ISA8000ftTest() { var isa = new ISA(8000); Assert.AreEqual(272.300, isa.T, 0.01); Assert.AreEqual(75262, isa.P, 1); Assert.AreEqual(0.962870, isa.Rho, 0.01); Assert.AreEqual(330.803, isa.VSound, 0.01); }
public static TypeInfo TypeFactory(ISA isa, GS gs, ST st) { if (st.TransactionSetIdentifierCode_01 == "997") { return(typeof(TS997).GetTypeInfo()); } throw new Exception(string.Format("Transaction {0} for version {1} is not supported.", st.TransactionSetIdentifierCode_01, gs.VersionAndRelease_8)); }
public static string BuildAck(ISA originalIsa, GS originalGs, EdiMessage ack, AckVersion ackVersion, int isaControlNumber = 1, int gsControlNumber = 1) { var memoryStream = new MemoryStream(); var writer = new X12Writer(memoryStream, Encoding.Default, Environment.NewLine); writer.Write(originalIsa.ToAckIsa(isaControlNumber.ToString().PadLeft(9, '0'), ackVersion)); writer.Write(originalGs.ToAckGs(gsControlNumber.ToString(), ackVersion)); writer.Write(ack); writer.Flush(); memoryStream.Position = 0; using (var reader = new StreamReader(memoryStream)) return(reader.ReadToEnd()); }
public static TypeInfo TypeFactory(ISA isa, GS gs, ST st) { if (st.TransactionSetIdentifierCode_01 == "850") { return(typeof(TS850).GetTypeInfo()); } if (st.TransactionSetIdentifierCode_01 == "810") { return(typeof(TS810).GetTypeInfo()); } throw new Exception(string.Format("Transaction {0} is not supported.", st.TransactionSetIdentifierCode_01)); }
/// <summary> /// Parse the transaction explicitly. /// </summary> /// <param name="isa">The ISA.</param> /// <param name="gs">The GS.</param> /// <param name="st">The ST.</param> /// <returns>The type to parse to.</returns> public static TypeInfo FullTemplateFactory(ISA isa, GS gs, ST st) { if (isa.InterchangeSenderID_6.StartsWith("SPLIT1", StringComparison.Ordinal) && st.TransactionSetIdentifierCode_01 == "850") { return(typeof(TS850Split).GetTypeInfo()); } if (isa.InterchangeSenderID_6.StartsWith("INVALID1", StringComparison.Ordinal) && st.TransactionSetIdentifierCode_01 == "850") { return(typeof(TS850Validation).GetTypeInfo()); } if (isa.InterchangeSenderID_6.StartsWith("CUSTOM1", StringComparison.Ordinal) && st.TransactionSetIdentifierCode_01 == "850") { return(typeof(TS850Custom1).GetTypeInfo()); } if (isa.InterchangeSenderID_6.StartsWith("CUSTOM2", StringComparison.Ordinal) && st.TransactionSetIdentifierCode_01 == "850") { return(typeof(TS850Custom2).GetTypeInfo()); } if (gs.VersionAndRelease_8 == "004010" && st.TransactionSetIdentifierCode_01 == "850") { return(typeof(TS850).GetTypeInfo()); } if (gs.VersionAndRelease_8 == "004010" && st.TransactionSetIdentifierCode_01 == "810") { return(typeof(TS810).GetTypeInfo()); } if (gs.VersionAndRelease_8 == "005010X222A1" && st.TransactionSetIdentifierCode_01 == "837") { return(typeof(TS837P).GetTypeInfo()); } throw new Exception(string.Format("Transaction {0} for version {1} is not supported.", st.TransactionSetIdentifierCode_01, gs.VersionAndRelease_8)); }
public ISA FindISA(string ISAGuid) { foreach (Inventory inv in m_invs) { foreach (BuildTool bt in inv.BuildTools) { ISA pt = FindObjectByGuid(ISAGuid, bt.SupportedISAs) as ISA; if (pt != null) { return(pt); } } } return(null); }
private static string BuildAck <T>(ISA originalIsa, GS originalGs, T ack, AckVersion ackVersion, int isaControlNumber = 1, int gsControlNumber = 1) where T : EdiMessage { var memoryStream = new MemoryStream(); using (var writer = new X12Writer(memoryStream, new X12WriterSettings() { Encoding = Encoding.Default, Postfix = Environment.NewLine })) { writer.Write(originalIsa.ToAckIsa(isaControlNumber.ToString().PadLeft(9, '0'), ackVersion)); writer.Write(originalGs.ToAckGs(gsControlNumber.ToString(), ackVersion)); writer.Write(ack); } memoryStream.Position = 0; using (var reader = new StreamReader(memoryStream)) return(reader.ReadToEnd()); }
internal X12Doc(bool includeDefinition) { DocDelimiters = new Delimiters { Element = '*', Component = ':', Repetition = '^', Segment = '~' }; InterchagneControlHeader = new ISA(); FunctionGroupHeader = new GS(); TransactionSetHeader = new ST(); BeginHierarchicalTransaction = new BHT(); TransactionSetTrailer = new SE(); FunctionalGroupTrailer = new GE(); InterchangeControlTrailer = new IEA(); }
/// <summary> /// Swap the original sender and receiver and copy over the rest of the values. /// </summary> public static ISA ToAckIsa(this ISA header, string controlNumber, AckVersion ackVersion) { return(new ISA { AuthorizationInformationQualifier_1 = "00", AuthorizationInformation_2 = "".PadRight(10, ' '), SecurityInformationQualifier_3 = "00", SecurityInformation_4 = "".PadRight(10, ' '), SenderIDQualifier_5 = header.ReceiverIDQualifier_7.PadRight(2), InterchangeSenderID_6 = header.InterchangeReceiverID_8.PadRight(15), ReceiverIDQualifier_7 = header.SenderIDQualifier_5.PadRight(2), InterchangeReceiverID_8 = header.InterchangeSenderID_6.PadRight(15), InterchangeDate_9 = DateTime.Now.Date.ToString("yyMMdd"), InterchangeTime_10 = DateTime.Now.TimeOfDay.ToString("hhmm"), InterchangeControlStandardsIdentifier_11 = "^", InterchangeControlVersionNumber_12 = GetIsaVersion(ackVersion), InterchangeControlNumber_13 = controlNumber, AcknowledgementRequested_14 = "0", UsageIndicator_15 = header.UsageIndicator_15 }); }
/// <summary> /// Build custom 999 acknowledgment using the original ISA and GS. /// </summary> public static string BuildAck(ISA originalIsa, GS originalGs, TS999Custom1 ack, AckVersion ackVersion, int isaControlNumber = 1, int gsControlNumber = 1) { return(BuildAck <TS999Custom1>(originalIsa, originalGs, ack, ackVersion, isaControlNumber, gsControlNumber)); }
private static void ProcessPurchaseOrder(ISA isa, GS gs, TS850 purchaseOrder) { // Do something with the purchase order }
protected override EdiItem Process(string segment) { EdiItem result = null; var segmentContext = new SegmentContext(segment, Separators); switch (segmentContext.Name) { case "ISA": case "GS": case "ST": case "GE": case "IEA": result = Flush(segment); if (result != null) { return(result); } break; } switch (segmentContext.Name) { case "ISA": var isa = ParseSegment <ISA>(segmentContext.Value, Separators); _currentIsa = isa; result = isa; _currentGroupHeader = null; break; case "TA1": result = ParseSegment <TA1>(segmentContext.Value, Separators); _currentGroupHeader = null; break; case "GS": result = ParseSegment <GS>(segmentContext.Value, Separators); _currentGroupHeader = segmentContext; break; case "ST": CurrentSegments.Add(segmentContext); CurrentMessageContext = BuildContext(); SegmentIndex = 0; PartsIndex = 0; break; case "SE": CurrentSegments.Add(segmentContext); result = ParseSegments(); CurrentMessageContext = null; SegmentIndex = 0; PartsIndex = 0; break; case "GE": result = ParseSegment <GE>(segmentContext.Value, Separators); _currentGroupHeader = null; break; case "IEA": result = ParseSegment <IEA>(segmentContext.Value, Separators); _currentGroupHeader = null; _currentIsa = null; break; default: CurrentSegments.Add(segmentContext); break; } return(result); }
/// <summary> /// Generates custom 999. /// </summary> public static void GenerateCustom999() { Debug.WriteLine("******************************"); Debug.WriteLine(MethodBase.GetCurrentMethod().Name); Debug.WriteLine("******************************"); var edi = Assembly.GetExecutingAssembly().GetManifestResourceStream("EdiFabric.Sdk.X12.Edi.PurchaseOrdersMultipleGroups.txt"); var custom999 = new Custom999 { AK1Loops = new List <TS999_AK1Loop>() }; ISA currentIsa = null; GS currentGs = null; int isaCounter = 0; int gsCounter = 0; var settings = new AckSettings { AckHandler = (s, a) => { if (a.AckType == AckType.Technical) { // Raise 999 acknowledgment at the end of every interchange var currentAck = Helpers.BuildAck(currentIsa, currentGs, custom999, AckVersion.Hipaa_999, ++isaCounter, ++gsCounter); Debug.Write(currentAck); custom999 = null; } if (a.AckType == AckType.Implementation) { currentIsa = a.InterchangeHeader; currentGs = a.GroupHeader; if (custom999 == null) { custom999 = new Custom999 { AK1Loops = new List <TS999_AK1Loop>() } } ; var ak1Loop = new TS999_AK1Loop(); var current999 = a.Message as TS999; if (current999 != null) { if (custom999.ST == null) { custom999.ST = current999.ST; } ak1Loop.AK1 = current999.AK1; ak1Loop.AK2Loop1 = current999.AK2Loop1; ak1Loop.AK9 = current999.AK9; custom999.AK1Loops.Add(ak1Loop); } } }, AckVersion = AckVersion.Hipaa_999, TechnicalAck = TechnicalAck.Enforce }; var ackMan = new Plugins.Acknowledgments.X12.AckMan(settings); using (var ediReader = new X12Reader(edi, "EdiFabric.Sdk.X12")) { while (ediReader.Read()) { ackMan.Publish(ediReader.Item); } } ackMan.Complete(); } }
private static void ProcessInvoice(ISA isa, GS gs, TS810 invoice) { // Do something with the invoice }
public EDI999SchemaModel ParseEDI999(string fileText) { string segmentValue = string.Empty; string[] ediTextArray = fileText.Split("~"); foreach (string stringSegment in ediTextArray) { string[] segmentArray = stringSegment.Split("*"); if (segmentArray != null) { IEnumerable <string> values = Enum.GetValues(typeof(EDI999Segments)) .OfType <EDI999Segments>() .Select(s => Convert.ToString(s)); if (values.Contains(segmentArray[0].TrimStart())) { segmentValue = segmentArray[0].TrimStart(); switch (segmentValue) { case "ISA": { ISA ISA = GetSegmentInfo <ISA>(new ISA(), segmentArray); edi999SchemaModel.ISA = ISA; break; } case "GS": { GS GS = GetSegmentInfo <GS>(new GS(), segmentArray); edi999SchemaModel.GS = GS; break; } case "ST": { ST ST = GetSegmentInfo <ST>(new ST(), segmentArray); edi999SchemaModel.ST = ST; break; } case "AK1": { AK1 AK1 = GetSegmentInfo <AK1>(new AK1(), segmentArray); edi999SchemaModel.AK1 = AK1; break; } case "AK2": { AK2 AK2 = GetSegmentInfo <AK2>(new AK2(), segmentArray); edi999SchemaModel.AK2 = AK2; break; } case "IK3": { IK3 IK3 = GetSegmentInfo <IK3>(new IK3(), segmentArray); edi999SchemaModel.IK3 = IK3; break; } case "IK4": { IK4 IK4 = GetSegmentInfo <IK4>(new IK4(), segmentArray); edi999SchemaModel.IK4 = IK4; break; } case "IK5": { IK5 IK5 = GetSegmentInfo <IK5>(new IK5(), segmentArray); edi999SchemaModel.IK5 = IK5; break; } case "AK9": { AK9 AK9 = GetSegmentInfo <AK9>(new AK9(), segmentArray); edi999SchemaModel.AK9 = AK9; break; } } } } } return(edi999SchemaModel); }
/// <summary> /// Extnesion for ISA segment to pre-load the segment with data from the file /// This is the easiest way to load up the ISA versus via the Populate() method the other header/trailer segments go through /// </summary> /// <param name="isa">Instance of the ISA this is extending. ISA will be altered.</param> /// <param name="s">Stream that holds the X12 to begin parsing and pre-load the ISA with</param> internal static void FromStream(this ISA isa, Stream s) { if (isa == null) { isa = new ISA(); } var original = s.Position; if (s.Length - s.Position < 106) { throw new Exception("Invalid ISA"); } byte[] valueBuffer = new byte[107]; s.Read(valueBuffer, 0, 107); if (valueBuffer[0] == (byte)'I' && valueBuffer[1] == (byte)'S' && valueBuffer[2] == (byte)'A') { var elementSeperator = (char)valueBuffer[3]; isa.LineSeperator = Encoding.ASCII.GetString(valueBuffer, 105, 1); //Issue, spec says its character length of 1, but some files have \r\n some files do not have fixed isa correct //so many invalid files, really sucks if (char.IsLetterOrDigit(isa.LineSeperator[0]) || valueBuffer[103] != elementSeperator || valueBuffer[106] != 'G') { s.Position = original + 4; var bigBuffer = new byte[1024]; s.Read(bigBuffer, 0, 1024); var field = Encoding.ASCII.GetString(bigBuffer); var indexE = field.IndexOf("GS" + elementSeperator, StringComparison.Ordinal); if (indexE == -1) { isa.ComponentElementSeparator = "~"; return; } var indexS = field.LastIndexOf(elementSeperator, indexE - 1); isa.ComponentElementSeparator = field[indexS + 1].ToString(); isa.LineSeperator = field[indexS + 2].ToString(); s.Position = original + indexE + 5; } else { isa.AuthInformationQualifier = Encoding.ASCII.GetString(valueBuffer, 4, 2); isa.AuthorizationInformation = Encoding.ASCII.GetString(valueBuffer, 7, 10); isa.SecurityInformationQualifier = Encoding.ASCII.GetString(valueBuffer, 18, 2); isa.SecurityInformation = Encoding.ASCII.GetString(valueBuffer, 21, 10); isa.InterchangeIDQualifier = Encoding.ASCII.GetString(valueBuffer, 32, 2); isa.InterchangeSenderID = Encoding.ASCII.GetString(valueBuffer, 35, 15); isa.InterchangeIDQualifier_2 = Encoding.ASCII.GetString(valueBuffer, 51, 2); isa.InterchangeReceiverID = Encoding.ASCII.GetString(valueBuffer, 54, 15); isa.InterchangeDate = Encoding.ASCII.GetString(valueBuffer, 70, 6); isa.InterchangeTime = Encoding.ASCII.GetString(valueBuffer, 77, 4); isa.RepetitionSeparator = Encoding.ASCII.GetString(valueBuffer, 82, 1); isa.InterchangeControlVersion = Encoding.ASCII.GetString(valueBuffer, 84, 5); isa.InterchangeControlNo = Encoding.ASCII.GetString(valueBuffer, 90, 9); isa.AcknowledgmentRequested = Encoding.ASCII.GetString(valueBuffer, 100, 1); isa.UsageIndicator = Encoding.ASCII.GetString(valueBuffer, 102, 1); isa.ComponentElementSeparator = Encoding.ASCII.GetString(valueBuffer, 104, 1); isa.LineSeperator = Encoding.ASCII.GetString(valueBuffer, 105, 1); //Issue, spec says its character length of 1, but some files have \r\n } s.Position--; } else { throw new ArgumentException("Invalid ISA"); } }
public EDI271SchemaModel ParseEDI271(string fileText) { string claimSegment = string.Empty; bool payerLoopVisited = false; bool submitterLoopVisited = false; bool subscriberLoopVisited = false; bool ebSegmentVisited = false; bool dtpSegmentVisited = true; EB EB = null; List <EB> ebList = null; string segmentValue = string.Empty; string[] ediTextArray = fileText.Split("~"); foreach (string stringSegment in ediTextArray) { string[] segmentArray = stringSegment.Split("*"); if (segmentArray != null) { IEnumerable <string> values = Enum.GetValues(typeof(EDI271Segments)) .OfType <EDI271Segments>() .Select(s => Convert.ToString(s)); if (values.Contains(segmentArray[0].TrimStart())) { segmentValue = segmentArray[0].TrimStart(); switch (segmentValue) { case "ISA": { ISA ISA = GetSegmentInfo <ISA>(new ISA(), segmentArray); ediSchemaModel.ISA = ISA; break; } case "GS": { GS GS = GetSegmentInfo <GS>(new GS(), segmentArray); ediSchemaModel.GS = GS; break; } case "ST": { ST ST = GetSegmentInfo <ST>(new ST(), segmentArray); ediSchemaModel.ST = ST; break; } case "AAA": { AAA AAA = GetSegmentInfo <AAA>(new AAA(), segmentArray); ediSchemaModel.AAA = AAA; break; } case "NM1": { NM1 NM1 = GetSegmentInfo <NM1>(new NM1(), segmentArray); if (NM1 != null && NM1.NM101 == "PR" && payerLoopVisited == false) { ediSchemaModel.PayerDetails = NM1; payerLoopVisited = true; } else if (NM1 != null && NM1.NM101 == "1P" && submitterLoopVisited == false) { ediSchemaModel.SubmitterDetails = NM1; submitterLoopVisited = true; } else if (NM1 != null && NM1.NM101 == "IL" && subscriberLoopVisited == false) { ediSchemaModel.SubscriberDetails = NM1; subscriberLoopVisited = true; } break; } case "EB": { if (EB != null) { if (EB.EB01 == "1" || EB.EB01 == "6" || EB.EB01 == "I") { ebList = new List <EB>(); ebList = EB.EB03.Split("^").Select(x => new EB() { EB01 = EB.EB01, EB02 = EB.EB02, EB03 = x, EB04 = EB.EB04, EB05 = EB.EB05, EB06 = EB.EB06, EB07 = EB.EB07, EB08 = EB.EB08, EB09 = EB.EB09, EB10 = EB.EB10, EB11 = EB.EB11, EB12 = EB.EB12, EB13 = EB.EB13, EB14 = EB.EB14 }).ToList(); } if (EB.EB01 == "1") { ediSchemaModel.ActivePlans.AddRange(ebList); } else if (EB.EB01 == "6") { ediSchemaModel.InactivePlans.AddRange(ebList); } else if (EB.EB01 == "I") { ediSchemaModel.NonCoveredPlan.AddRange(ebList); } else if (EB.EB01 == "C" && (EB.EB06 == "" || EB.EB06 == "26")) { ediSchemaModel.BaseDeductiblesAllPlans.Add(EB); } else if (EB.EB01 == "C" && EB.EB06 == "29") { ediSchemaModel.RemainingDeductiblesAllPlans.Add(EB); } else if (EB.EB01 == "A") { ediSchemaModel.CoinsuranceAllPlans.Add(EB); } else if (EB.EB01 == "B") { ediSchemaModel.CopayAllPlans.Add(EB); } } EB = GetSegmentInfo <EB>(new EB(), segmentArray); ebSegmentVisited = true; break; } case "DTP": { if (EB != null && ebSegmentVisited == true) { EB.DTP = GetSegmentInfo <DTP>(new DTP(), segmentArray); } //EB = null; ebSegmentVisited = false; break; } } } } } return(ediSchemaModel); }
public EDI835SchemaModel ParseEDI835(string fileText) { bool payerSeg = false; bool payeeSeg = false; string claimSegment = string.Empty; string segmentValue = string.Empty; string[] ediTextArray = fileText.Split("~"); CLP clp = null; SVC svc = null; bool findNextCLP = false; bool isServiceLineVisited = false; foreach (string stringSegment in ediTextArray) { string[] segmentArray = stringSegment.Split("*"); if (segmentArray != null) { IEnumerable <string> values = Enum.GetValues(typeof(EDI835Segments)) .OfType <EDI835Segments>() .Select(s => Convert.ToString(s)); if (values.Contains(segmentArray[0].TrimStart())) { if (segmentArray[0].TrimStart() != "CLP" && findNextCLP == true) { continue; } //else continue; segmentValue = segmentArray[0].TrimStart(); if (claimSegment == "CLP") { segmentValue = "CLP"; } switch (segmentValue) { case "ISA": { ISA ISA = GetSegmentInfo <ISA>(new ISA(), segmentArray); ediSchemaModel.ISA = ISA; break; } case "GS": { GS GS = GetSegmentInfo <GS>(new GS(), segmentArray); ediSchemaModel.GS = GS; break; } case "ST": { ST ST = GetSegmentInfo <ST>(new ST(), segmentArray); ediSchemaModel.ST = ST; break; } case "BPR": { BPR BPR = GetSegmentInfo <BPR>(new BPR(), segmentArray); ediSchemaModel.BPR = BPR; break; } case "TRN": { TRN TRN = GetSegmentInfo <TRN>(new TRN(), segmentArray); ediSchemaModel.TRN = TRN; break; } case "DTM": { DTM DTM = GetSegmentInfo <DTM>(new DTM(), segmentArray); ediSchemaModel.DTM = DTM; break; } case "N1": { if (segmentArray[1] == "PR") { N1 N1 = GetSegmentInfo <N1>(new N1(), segmentArray); ediSchemaModel.PayerInfo = N1; payerSeg = true; } else if (segmentArray[1] == "PE") { N1 N1 = GetSegmentInfo <N1>(new N1(), segmentArray); ediSchemaModel.PayeeInfo = N1; payeeSeg = true; } break; } case "N3": { if (payerSeg) { N3 N3 = GetSegmentInfo <N3>(new N3(), segmentArray); ediSchemaModel.PayerAddress = N3; } else if (payeeSeg) { N3 N3 = GetSegmentInfo <N3>(new N3(), segmentArray); ediSchemaModel.PayeeAddress = N3; } break; } case "N4": { if (payerSeg) { N4 N4 = GetSegmentInfo <N4>(new N4(), segmentArray); ediSchemaModel.PayerCityStateZip = N4; payerSeg = false; } else if (payeeSeg) { N4 N4 = GetSegmentInfo <N4>(new N4(), segmentArray); ediSchemaModel.PayeeCityStateZip = N4; payeeSeg = false; } break; } case "CLP": { claimSegment = "CLP"; switch (segmentArray[0].TrimStart()) { case "CLP": { findNextCLP = false; if (clp != null) { ediSchemaModel.CLPList.Add(clp); isServiceLineVisited = false; clp = null; } clp = GetSegmentInfo <CLP>(new CLP(), segmentArray); break; } case "SVC": { //if (svc != null) //{ // if (clp.SVCList == null) clp.SVCList = new List<SVC>(); // clp.SVCList.Add(svc); // svc = null; //} svc = GetSegmentInfo <SVC>(new SVC(), segmentArray); if (clp != null && clp.SVCList == null) { clp.SVCList = new List <SVC>(); } clp.SVCList.Add(svc); isServiceLineVisited = true; break; } case "CAS": { if (isServiceLineVisited) { CAS CAS = GetSegmentInfo <CAS>(new CAS(), segmentArray); if (svc.SVCAdjList == null) { svc.SVCAdjList = new List <CAS>(); } svc.SVCAdjList.Add(CAS); CAS = null; } break; } case "REF": { if (segmentArray[1].Trim() == "6R" && svc != null && svc.REF == null) { svc.REF = new REF(); svc.REF = GetSegmentInfo <REF>(new REF(), segmentArray); } break; } case "GE": { if (clp != null) { ediSchemaModel.CLPList.Add(clp); isServiceLineVisited = false; clp = null; findNextCLP = true; } break; } default: { break; } } break; } } } } } return(ediSchemaModel); }