protected override ValidationResult IsValid(object value, ValidationContext context) { N4 n4value = (N4)context.ObjectType.GetProperty("N4").GetValue(context.ObjectInstance); NM1 nm1Value = (NM1)value; string ErrorString; if (nm1Value.NM12 == "1") { ErrorString = ValidateElement.GetValidation(nm1Value.NM13, Element.Required, 1, 60, "NM103") + ValidateElement.GetValidation(nm1Value.NM14, Element.Required, 1, 35, "NM104") + ValidateElement.GetValidation(nm1Value.NM15, Element.Required, 1, 25, "NM105") + ValidateElement.GetValidation(nm1Value.NM17, Element.Required, 1, 10, "NM107"); } else if (nm1Value.NM12 == "2") { ErrorString = ValidateElement.GetValidation(nm1Value.NM13, Element.Required, 1, 60, "NM103") + ValidateElement.GetValidation(nm1Value.NM14, Element.Situational, 1, 35, "NM104") + ValidateElement.GetValidation(nm1Value.NM15, Element.Situational, 1, 25, "NM105") + ValidateElement.GetValidation(nm1Value.NM17, Element.Situational, 1, 10, "NM107"); } else { ErrorString = "NM102 should be 1 or 2 "; } if (n4value.N44 == null || n4value.N44 == string.Empty) { ErrorMessage = ErrorString + (nm1Value.NM18 == "XX" ? "" : "NM108 should be XX ") + ValidateElement.GetValidation(nm1Value.NM19, Element.Required, 2, 80, "NM109"); } if (ErrorString == string.Empty) { return(null); } return(new ValidationResult(ErrorString)); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { NM1 nm1Value = (NM1)value; string ErrorString = string.Empty; if (!(nm1Value.NM12 == "1" || nm1Value.NM12 == "2")) { return(new ValidationResult("NM102 should be 1 or 2")); } if (nm1Value.NM12 == "1") { ErrorString = ValidateElement.GetValidation(nm1Value.NM14, Element.Required, 1, 35, "NM104") + ValidateElement.GetValidation(nm1Value.NM15, Element.Required, 1, 25, "NM105") + ValidateElement.GetValidation(nm1Value.NM17, Element.Required, 1, 10, "NM107"); } else if (nm1Value.NM12 == "2") { ErrorString = ValidateElement.GetValidation(nm1Value.NM14, Element.Situational, 1, 35, "NM104") + ValidateElement.GetValidation(nm1Value.NM15, Element.Situational, 1, 25, "NM105") + ValidateElement.GetValidation(nm1Value.NM17, Element.Situational, 1, 10, "NM107"); } ErrorString += ValidateElement.GetValidation(nm1Value.NM13, Element.Required, 1, 60, "NM103"); if (!(nm1Value.NM18 == "II" || nm1Value.NM18 == "MI")) { return(new ValidationResult(ErrorString + "NM108 should be II or MI")); } ErrorString += ValidateElement.GetValidation(nm1Value.NM19, Element.Required, 2, 80, "NM109"); if (ErrorString == string.Empty) { return(null); } return(new ValidationResult(ErrorString)); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { NM1 nm1Value = (NM1)value; if (nm1Value.NM112 == "1" || nm1Value.NM112 == "2") { return(null); } return(new ValidationResult("Pay To Address:NM102 should be 1 or 2")); }
///<Summary> ///<CreatedOn>03/01/2018</CreatedOn> ///<Author>Sunny Bhardwaj</Author> ///<Description>Get NM1 segment for All</Description> ///</Summary> /// public static NM1 GetNM1(string NM101, string NM102, string NM103, string NM104, string NM105, string NM106, string NM107, string NM108, string NM109) { NM1 NM1 = new NM1(); NM1.NM101 = NM101; NM1.NM102 = NM102; NM1.NM103 = !string.IsNullOrEmpty(NM103) ? CreateString(NM103, (int)SegmentLength.One, (int)SegmentLength.Sixty, ' ', true) : string.Empty; NM1.NM104 = !string.IsNullOrEmpty(NM104) ? CreateString(NM104, (int)SegmentLength.One, (int)SegmentLength.ThirtyFive, ' ', true) : string.Empty; NM1.NM105 = !string.IsNullOrEmpty(NM105) ? CreateString(NM105, (int)SegmentLength.One, (int)SegmentLength.TwentyFive, ' ', true) : string.Empty; NM1.NM106 = !string.IsNullOrEmpty(NM106) ? NM106 : string.Empty; NM1.NM107 = !string.IsNullOrEmpty(NM107) ? NM107 : string.Empty; NM1.NM108 = !string.IsNullOrEmpty(NM108) ? NM108 : string.Empty; NM1.NM109 = CreateString(NM109, (int)SegmentLength.Two, (int)SegmentLength.Eighty, '0', true); return(NM1); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { NM1 nm1Value = (NM1)value; string ErrorString = string.Empty; if (nm1Value.NM12 != "1") { ErrorString = "NM102 should be 1"; } ErrorString += ValidateElement.GetValidation(nm1Value.NM13, Element.Required, 1, 60, "NM103") + ValidateElement.GetValidation(nm1Value.NM14, Element.Situational, 1, 35, "NM104") + ValidateElement.GetValidation(nm1Value.NM15, Element.Situational, 1, 25, "NM105") + ValidateElement.GetValidation(nm1Value.NM17, Element.Situational, 1, 10, "NM107"); if (ErrorString == string.Empty) { return(null); } return(new ValidationResult(ErrorString)); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { NM1 nm1Value = (NM1)value; if (nm1Value.NM12 != "2") { return(new ValidationResult("NM102 should be 2 ")); } string ErrorString = ValidateElement.GetValidation(nm1Value.NM13, Element.Required, 1, 60, "NM103"); if (ErrorString == string.Empty) { return(null); } return(new ValidationResult(ErrorString)); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { string ErrorString = string.Empty; NM1 nm1Value = (NM1)value; if (nm1Value.NM12 == "2") { ErrorString = "Pay to plan NM102 should be 2 "; } ErrorString += ValidateElement.GetValidation(nm1Value.NM13, Element.Required, 1, 60, "NM103"); if (!(nm1Value.NM18 == "PI" || nm1Value.NM18 == "XV")) { ErrorString += "NM108 should be PI or XV "; } ErrorString += ValidateElement.GetValidation(nm1Value.NM19, Element.Required, 2, 80, "NM109"); if (ErrorString == string.Empty) { return(null); } return(new ValidationResult(ErrorString)); }
public override bool IsValid(object value) { NM1 nm1Value = (NM1)value; return(nm1Value.NM19 != null && nm1Value.NM13 != null && nm1Value.NM12 == "2" && nm1Value.NM13.Length >= 1 && nm1Value.NM13.Length <= 60 && nm1Value.NM18 == "46" && nm1Value.NM19.Length > 1 && nm1Value.NM19.Length <= 80); }
public override bool IsValid(object value) { NM1 nm1Value = (NM1)value; return(nm1Value.NM11 == "41" && (nm1Value.NM12 == "1" || nm1Value.NM12 == "2") && nm1Value.NM13 != "" && nm1Value.NM13.Length <= 60 && nm1Value.NM14.Length <= 35 && nm1Value.NM15.Length <= 25 && (nm1Value.NM18 == "" || nm1Value.NM18 == "46") && nm1Value.NM19.Length >= 2 && nm1Value.NM19.Length <= 80); }
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); }