///<summary>Only use this constructor when generating a message instead of parsing a message.</summary> internal SegmentHL7(SegmentName name) { fullText=""; Name=name; Fields=new List<FieldHL7>(); //remember that the "field quantity" is one more than the last index, because 0-based. //All fields are initially added with just one component //This can all probably be removed now since we add fields dynamically as needed: if(name==SegmentName.MSH) { AddFields(12); } if(name==SegmentName.EVN) { AddFields(4); } if(name==SegmentName.PID) { AddFields(23); } if(name==SegmentName.PV1) { AddFields(51); } if(name==SegmentName.FT1) { AddFields(27); } if(name==SegmentName.DG1) { AddFields(5); } if(name==SegmentName.ZX1) { AddFields(6); } }
///<summary>If an optional segment is not present, it will return null.</summary> public SegmentHL7 GetSegment(SegmentName segmentName,bool isRequired) { for(int i=0;i<Segments.Count;i++) { if(Segments[i].Name==segmentName) { return Segments[i]; } } if(isRequired) { throw new ApplicationException(segmentName+" segment is missing."); } return null; }
///<summary>If an optional segment is not present, it will return null.</summary> public SegmentHL7 GetSegment(SegmentName segmentName, bool isRequired) { for (int i = 0; i < Segments.Count; i++) { if (Segments[i].Name == segmentName) { return(Segments[i]); } } if (isRequired) { throw new ApplicationException(segmentName + " segment is missing."); } return(null); }
///<summary>The list will be ordered by sequence number.</summary> public List <SegmentHL7> GetSegments(SegmentName segmentName) { List <SegmentHL7> retVal = new List <SegmentHL7>(); for (int i = 0; i < Segments.Count; i++) { if (Segments[i].Name != segmentName) { continue; } if (Segments[i].GetFieldFullText(1) != (retVal.Count + 1).ToString()) //wrong sequence number { continue; } retVal.Add(Segments[i]); } return(retVal); }
///<summary>Only use this constructor when generating a message instead of parsing a message.</summary> internal SegmentHL7(SegmentName name) { fullText = ""; Name = name; Fields = new List <FieldHL7>(); //remember that the "field quantity" is one more than the last index, because 0-based. //All fields are initially added with just one component //This can all probably be removed now since we add fields dynamically as needed: if (name == SegmentName.MSH) { AddFields(12); } if (name == SegmentName.EVN) { AddFields(4); } if (name == SegmentName.PID) { AddFields(23); } if (name == SegmentName.PV1) { AddFields(51); } if (name == SegmentName.FT1) { AddFields(27); } if (name == SegmentName.DG1) { AddFields(5); } if (name == SegmentName.ZX1) { AddFields(6); } }
///<summary>The list will be ordered by sequence number.</summary> public List<SegmentHL7> GetSegments(SegmentName segmentName) { List<SegmentHL7> retVal=new List<SegmentHL7>(); for(int i=0;i<Segments.Count;i++) { if(Segments[i].Name!=segmentName) { continue; } if(Segments[i].GetFieldFullText(1) != (retVal.Count+1).ToString()){//wrong sequence number continue; } retVal.Add(Segments[i]); } return retVal; }
public string GetSegCode()//Populates segment code field in datagrid { string strSegmentCode = "00"; switch (SegmentName.ToUpper()) { case "MID-LEVEL": case "MID LEVEL": strSegmentCode = "29"; break; case "SOCIETY": strSegmentCode = "09"; break; case "MONTHLY GIVERS": case "MONTHLY-GIVERS": case "MONTHLYGIVERS": case "MONTHLY": strSegmentCode = "08"; break; case "NEW": strSegmentCode = "05"; break; case "REACTIVATED": strSegmentCode = "06"; break; case "BUSINESSES": case "BUSINESS": strSegmentCode = "25"; break; case "CHURCHES": case "CHURCH": strSegmentCode = "13"; break; case "NEWSLETTER ONLY (NL ONLY)": case "NEWSLETTER ONLY": case "(NL ONLY)": case "NL ONLY": case "NEWSLETTER": case "NL": strSegmentCode = "07"; break; case "VOLUNTEERS": case "VOLUNTEER": strSegmentCode = "97"; break; case "BOARD/ STAFF": case "BOARD/STAFF": case "BOARD": case "STAFF": strSegmentCode = "24"; break; case "IN-KIND/ NON-GIVERS": case "IN-KIND/NON-GIVERS": case "IN KIND/ NON-GIVERS": case "IN KIND/NON-GIVERS": case "IN-KIND/ NON GIVERS": case "IN-KIND/NON GIVERS": case "IN KIND/ NON GIVERS": case "IN KIND/NON GIVERS": case "IN-KIND": case "IN KIND": case "INKIND": case "NON-GIVERS": case "NON GIVERS": case "NONGIVERS": strSegmentCode = "26"; break; } return(strSegmentCode); }
public int GetPriority()//Populates Priority section in datagrid { int intPriority = 0; switch (SegmentName.ToUpper()) { case "MID-LEVEL": case "MID LEVEL": intPriority = 1; break; case "SOCIETY": intPriority = 2; break; case "MONTHLY GIVERS": case "MONTHLY-GIVERS": case "MONTHLYGIVERS": case "MONTHLY": intPriority = 3; break; case "NEW": intPriority = 4; break; case "REACTIVATED": intPriority = 5; break; case "BUSINESSES/ CHURCHES": case "BUSINESSES/CHURCHES": case "BUSINESSES": case "BUSINESS": case "CHURCHES": case "CHURCH": intPriority = 6; break; case "NEWSLETTER ONLY (NL ONLY)": case "NEWSLETTER ONLY": case "(NL ONLY)": case "NL ONLY": case "NEWSLETTER": case "NL": intPriority = 7; break; case "VOLUNTEERS": case "VOLUNTEER": intPriority = 8; break; case "BOARD/ STAFF": case "BOARD/STAFF": case "BOARD": case "STAFF": intPriority = 9; break; case "IN-KIND/ NON-GIVERS": case "IN-KIND/NON-GIVERS": case "IN KIND/ NON-GIVERS": case "IN KIND/NON-GIVERS": case "IN-KIND/ NON GIVERS": case "IN-KIND/NON GIVERS": case "IN KIND/ NON GIVERS": case "IN KIND/NON GIVERS": case "IN-KIND": case "IN KIND": case "INKIND": case "NON-GIVERS": case "NON GIVERS": case "NONGIVERS": intPriority = 10; break; } return(intPriority); }