using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml; using System.Xml.XPath; using System.Text; /// /// Summary description for Class1 /// public class HelperMethods { public HelperMethods() { // // TODO: Add constructor logic here // } public static String getCourtOrderDesignatedLocation(XmlNode warrantNode, XmlNamespaceManager nsmgr) { XmlNode addressNode = warrantNode.SelectSingleNode("./j:CourtOrderDesignatedLocation/j:LocationAddress", nsmgr); return HelperMethods.getLocationAddress(addressNode, nsmgr); } public static String getCourtOrderIssuingJudicialOfficial(XmlNode warrantNode, XmlNamespaceManager nsmgr) { XmlNode personNameNode = warrantNode.SelectSingleNode("./j:CourtOrderIssuingJudicialOfficial/j:PersonName", nsmgr); String personName = HelperMethods.getPersonName(personNameNode, nsmgr); return personName; } public static String getWarrantActionStatus(XmlNode warrantNode, XmlNamespaceManager nsmgr) { XmlNode warrantActionStatusNode = warrantNode.SelectSingleNode("./warrant:WarrantActionStatus", nsmgr); String warrantAction = warrantActionStatusNode.SelectSingleNode("./warrant:WarrantAction", nsmgr).InnerText; StringBuilder stringToReturn = new StringBuilder(); stringToReturn.AppendLine("\tWarrant Action: " + warrantAction); XmlNode warrantActionDescNode = warrantActionStatusNode.SelectSingleNode("./warrant:WarrantActionDescription", nsmgr); if (warrantActionDescNode != null) { stringToReturn.AppendLine("\tWarrant Action Description: " + warrantActionDescNode.InnerText); } String warrantActionDate = warrantActionStatusNode.SelectSingleNode("./warrant:WarrantActionDate", nsmgr).InnerText; stringToReturn.AppendLine("\tWarrant Action Date: " + warrantActionDate); return stringToReturn.ToString(); } public static String getWarrantSubject(XmlNode warrantNode, XmlNamespaceManager nsmgr) { XmlNode warrantSubjectNode = warrantNode.SelectSingleNode("./warrant:WarrantSubject", nsmgr); XmlNode personNameNode = warrantSubjectNode.SelectSingleNode("./j:PersonName", nsmgr); StringBuilder stringToReturn = new StringBuilder(); stringToReturn.AppendLine("Warrant Subject: "); string id = warrantSubjectNode.SelectSingleNode("./@j:id", nsmgr).InnerText; stringToReturn.AppendLine("\tSubject id: " + id); String personName = HelperMethods.getPersonName(personNameNode, nsmgr); stringToReturn.AppendLine(personName); XmlNode residenceNode = warrantSubjectNode.SelectSingleNode("./j:Residence", nsmgr); if (residenceNode != null) { XmlNode locationAddress = residenceNode.SelectSingleNode("./j:LocationAddress", nsmgr); string locationAddressStr = HelperMethods.getLocationAddress(locationAddress, nsmgr); stringToReturn.AppendLine(locationAddressStr); } XmlNode primaryContactInfo = warrantSubjectNode.SelectSingleNode("./j:PrimaryContactInformation", nsmgr); stringToReturn.AppendLine(HelperMethods.getContactInfo(primaryContactInfo, nsmgr)); stringToReturn.AppendLine(HelperMethods.getPersonBirthdate(warrantSubjectNode, nsmgr)); XmlNode assignedIdDetail = warrantSubjectNode.SelectSingleNode("./j:PersonAssignedIDDetails", nsmgr); stringToReturn.AppendLine(HelperMethods.getAssignedIdDetails(assignedIdDetail, nsmgr)); XmlNode physicalDetails = warrantSubjectNode.SelectSingleNode("./j:PersonPhysicalDetails", nsmgr); stringToReturn.AppendLine(HelperMethods.getPhysicalDetails(physicalDetails,nsmgr)); //00 XmlNodeList cautionInformationCaveatNodes = warrantSubjectNode.SelectNodes("./j:SubjectCautionInformationCaveat", nsmgr); foreach (XmlNode cautionInformationCaveatNode in cautionInformationCaveatNodes) { stringToReturn.AppendLine("\tCaution Information Caveat: " + cautionInformationCaveatNode.InnerText); } XmlNodeList cautionInformationCodeNodes = warrantSubjectNode.SelectNodes("./j:SubjectCautionInformationCode", nsmgr); foreach (XmlNode cautionInformationCodeNode in cautionInformationCodeNodes) { stringToReturn.AppendLine("\tCaution Information Code: " + cautionInformationCodeNode.InnerText); } XmlNode DNACollectionStatusText = warrantSubjectNode.SelectSingleNode("./j:DNACollectionStatusText", nsmgr); if (DNACollectionStatusText != null) { stringToReturn.AppendLine("\tDNA Collection Status: " + DNACollectionStatusText.InnerText); } stringToReturn.AppendLine(HelperMethods.getBiometricDetails(warrantSubjectNode, nsmgr)); stringToReturn.AppendLine(HelperMethods.getDriverLicense(warrantSubjectNode, nsmgr)); stringToReturn.AppendLine(HelperMethods.getVehicle(warrantSubjectNode, nsmgr)); stringToReturn.AppendLine(HelperMethods.getPersonAlias(warrantSubjectNode, nsmgr)); return stringToReturn.ToString(); } public static String getPersonAlias(XmlNode warrantSubjectNode, XmlNamespaceManager nsmgr) { XmlNodeList personAliasNodes = warrantSubjectNode.SelectNodes("./warrant:PersonAlias", nsmgr); StringBuilder stringToReturn = new StringBuilder(); foreach (XmlNode personAliasNode in personAliasNodes) { stringToReturn.AppendLine("\tPerson Alias:"); stringToReturn.AppendLine(HelperMethods.getPersonName(personAliasNode.SelectSingleNode("./j:PersonName", nsmgr), nsmgr)); stringToReturn.AppendLine(HelperMethods.getPersonBirthdate(personAliasNode, nsmgr)); stringToReturn.AppendLine(HelperMethods.getAssignedIdDetails(personAliasNode.SelectSingleNode("j:PersonAssignedIDDetails", nsmgr), nsmgr)); stringToReturn.AppendLine(HelperMethods.getDriverLicense(personAliasNode, nsmgr)); } return stringToReturn.ToString(); } public static string getPersonBirthdate(XmlNode parentNode, XmlNamespaceManager nsmgr) { XmlNode birthDate = parentNode.SelectSingleNode("./j:PersonBirthDate", nsmgr); if (birthDate != null) { return ("\tBirthdate: " + birthDate.InnerText); } else return ""; } public static string getWarrantDocuments(XmlNode parentNode, XmlNamespaceManager nsmgr) { StringBuilder stringToReturn = new StringBuilder(); XmlNodeList warrantDocumentNodes = parentNode.SelectNodes("./warrant:WarrantDocument", nsmgr); foreach (XmlNode warrantDocumentNode in warrantDocumentNodes) { stringToReturn.AppendLine("Warrant Document: "); stringToReturn.AppendLine("\tDocumentBinary: "); XmlNode binaryIDNode = warrantDocumentNode.SelectSingleNode(".//j:BinaryID/j:ID", nsmgr); if (binaryIDNode != null) { stringToReturn.AppendLine("\t\tBinary ID: " + binaryIDNode.InnerText); } XmlNode binaryObjectBase64Node = warrantDocumentNode.SelectSingleNode(".//j:BinaryObject.Base64", nsmgr); if (binaryObjectBase64Node != null) { stringToReturn.AppendLine("\t\tBinaryObject.Base64: " + binaryObjectBase64Node.InnerText); } XmlNode binaryDescriptionTextNode = warrantDocumentNode.SelectSingleNode(".//j:BinaryDescriptionText", nsmgr); if (binaryDescriptionTextNode != null) { stringToReturn.AppendLine("\t\tBinaryDescriptionText: " + binaryDescriptionTextNode.InnerText); } XmlNode binaryReferrenceIDNode = warrantDocumentNode.SelectSingleNode(".//j:BinaryReferenceID", nsmgr); if (binaryReferrenceIDNode != null) { stringToReturn.AppendLine("\t\tBinaryReferenceID: " + binaryReferrenceIDNode.InnerText.Trim()); } } return stringToReturn.ToString(); } public static String getVehicle(XmlNode warrantSubjectNode, XmlNamespaceManager nsmgr) { XmlNodeList vehicleNodes = warrantSubjectNode.SelectNodes("./j:Vehicle", nsmgr); StringBuilder stringToReturn = new StringBuilder(); foreach (XmlNode vehicleNode in vehicleNodes) { stringToReturn.AppendLine("\tVehicle:"); stringToReturn.AppendLine("\t\tRegistration:"); XmlNode jurisdictionNameNode = vehicleNode.SelectSingleNode(".//j:RegistrationJurisdictionName", nsmgr); if (jurisdictionNameNode != null) { stringToReturn.AppendLine("\t\t\tJurisdiction Name: " + jurisdictionNameNode.InnerText); } stringToReturn.AppendLine("\t\t\tRegistrationJurisdictionCode.ncicLIS: " + vehicleNode.SelectSingleNode(".//j:RegistrationJurisdictionCode.ncicLIS", nsmgr).InnerText); stringToReturn.AppendLine("\t\t\tVehicleRegistrationPlateID: " + vehicleNode.SelectSingleNode(".//j:VehicleRegistrationPlateID/j:ID", nsmgr).InnerText); stringToReturn.AppendLine("\t\t\tVehicleRegistrationPlateTypeText: " + vehicleNode.SelectSingleNode(".//j:VehicleRegistrationPlateTypeText", nsmgr).InnerText); stringToReturn.AppendLine("\t\t\tVehicleRegistrationPlateTypeCode: " + vehicleNode.SelectSingleNode(".//j:VehicleRegistrationPlateTypeCode", nsmgr).InnerText); stringToReturn.AppendLine("\t\t\tVehicleRegistrationDecal: " + vehicleNode.SelectSingleNode(".//j:DecalYearDate", nsmgr)==null?"":vehicleNode.SelectSingleNode(".//j:DecalYearDate", nsmgr).InnerText); stringToReturn.AppendLine("\t\tVehicle ID: " + vehicleNode.SelectSingleNode("./j:VehicleID/j:ID", nsmgr).InnerText.Trim()); } return stringToReturn.ToString(); } public static String getDriverLicense(XmlNode warrantSubjectNode, XmlNamespaceManager nsmgr) { XmlNode driverLicenseNode = warrantSubjectNode.SelectSingleNode("./warrant:DriverLicense", nsmgr); if (driverLicenseNode != null) { StringBuilder stringToReturn = new StringBuilder(); stringToReturn.AppendLine("\tDriver License:"); stringToReturn.AppendLine("\t\tDriver Authorization ID: " + driverLicenseNode.SelectSingleNode(".//j:DriverAuthorizationID.Detailed/j:ID", nsmgr).InnerText); stringToReturn.AppendLine("\t\tDetailed: "); XmlNode authoriztionIDNode = driverLicenseNode.SelectSingleNode(".//j:DriverAuthorizationID/j:ID", nsmgr); if (authoriztionIDNode != null) stringToReturn.AppendLine("\t\t\tDriver Authorization ID: " + authoriztionIDNode.InnerText); XmlNode issuingAuthorityTextNode = driverLicenseNode.SelectSingleNode(".//j:IDIssuingAuthorityText", nsmgr); if (issuingAuthorityTextNode != null) { stringToReturn.AppendLine("\t\t\tID IssuingAuthority Text: " + issuingAuthorityTextNode.InnerText); } XmlNode jurisdictionTextNode = driverLicenseNode.SelectSingleNode(".//j:IDJurisdictionText", nsmgr); if (jurisdictionTextNode != null) { stringToReturn.AppendLine("\t\t\tJurisdiction Text: " + jurisdictionTextNode.InnerText); } XmlNode jurisdictionCodeNode = driverLicenseNode.SelectSingleNode(".//j:IDJurisdictionCode.ncicLSTA", nsmgr); if (jurisdictionCodeNode!= null) { stringToReturn.AppendLine("\t\t\tIDJurisdictionCode.ncicLSTA: " + jurisdictionCodeNode.InnerText); } XmlNode jurisdictionAuthorityCodeNode = driverLicenseNode.SelectSingleNode(".//j:DrivingJurisdictionAuthorityCode.ncicLSTA", nsmgr); if (jurisdictionAuthorityCodeNode != null) { stringToReturn.AppendLine("\t\t\tDrivingJurisdictionAuthorityCode.ncicLSTA: " + jurisdictionAuthorityCodeNode.InnerText); } stringToReturn.AppendLine("\t\tID Expiration Year: " + driverLicenseNode.SelectSingleNode("./warrant:IDExpirationYear", nsmgr).InnerText); return stringToReturn.ToString(); } else { return ""; } } public static String getBiometricDetails(XmlNode warrantSubjectNode, XmlNamespaceManager nsmgr) { XmlNode personBiometricDetailsNode = warrantSubjectNode.SelectSingleNode("./warrant:PersonBiometricDetails", nsmgr); if (personBiometricDetailsNode != null) { StringBuilder stringToReturn = new StringBuilder(); stringToReturn.AppendLine("\tBiometric Details:"); stringToReturn.AppendLine("\t\tFingerprint On File Indicator: " + personBiometricDetailsNode.SelectSingleNode("./warrant:FingerprintOnFileIndicator", nsmgr).InnerText); XmlNode DNAOnFileIndicatorNode = personBiometricDetailsNode.SelectSingleNode("./warrant:DNAOnFileIndicator", nsmgr); if (DNAOnFileIndicatorNode != null) { stringToReturn.AppendLine("\t\tDNA OnFile Indicator: " + DNAOnFileIndicatorNode.InnerText); } return stringToReturn.ToString(); } else { return ""; } } public static String getPersonName(XmlNode personNameNode, XmlNamespaceManager nsmgr) { String personGivenName = personNameNode.SelectSingleNode("./j:PersonGivenName", nsmgr).InnerText; StringBuilder stringToReturn = new StringBuilder(); stringToReturn.AppendLine("\tPersonName:"); stringToReturn.AppendLine("\tGiven Name: " + personGivenName); XmlNodeList middleNameNodes = personNameNode.SelectNodes("./j:PersonMiddleName", nsmgr); foreach (XmlNode middleNameNode in middleNameNodes) { stringToReturn.AppendLine("\tMiddle Name: " + middleNameNode.InnerText); } String personSurName = personNameNode.SelectSingleNode("./j:PersonSurName", nsmgr).InnerText; stringToReturn.AppendLine("\tSur Name: " + personSurName); XmlNode personSuffixName = personNameNode.SelectSingleNode("./j:PersonSuffixName", nsmgr); if (personSuffixName != null) { stringToReturn.AppendLine("\tSuffix Name: " + personSuffixName.InnerText); } return stringToReturn.ToString(); } public static String getContactInfo(XmlNode contactInfoNode, XmlNamespaceManager nsmgr) { if (contactInfoNode == null) return ""; XmlNode teleponeNumber = contactInfoNode.SelectSingleNode("./j:ContactTelephoneNumber", nsmgr); StringBuilder stringToReturn = new StringBuilder(); stringToReturn.AppendLine("\tContact Info:"); if (teleponeNumber != null) { XmlNodeList fullIdNodes = teleponeNumber.SelectNodes("./j:TelephoneNumberFullID", nsmgr); foreach (XmlNode fullIdNode in fullIdNodes) { stringToReturn.AppendLine("\tTelephone Number:" + fullIdNode.InnerText.Trim()); } } return stringToReturn.ToString(); } public static String getCharges(XmlNode parentNode, XmlNamespaceManager nsmgr) { StringBuilder stringToReturn = new StringBuilder(); XmlNodeList chargeNodes = parentNode.SelectNodes("./j:Charge", nsmgr); foreach (XmlNode chargeNode in chargeNodes) { stringToReturn.AppendLine("Charge:"); stringToReturn.AppendLine("\tCharge ID: " + chargeNode.SelectSingleNode("./j:ChargeID/j:ID", nsmgr).InnerText); stringToReturn.AppendLine("\tChargeOriginator.Organization: " + chargeNode.SelectSingleNode(".//j:OrganizationName", nsmgr).InnerText); stringToReturn.AppendLine("\tChargeStatute:"); stringToReturn.AppendLine("\t\tStatute Code ID: " + chargeNode.SelectSingleNode(".//j:StatuteCodeID/j:ID", nsmgr).InnerText); stringToReturn.AppendLine("\t\tStatute Description Text: " + chargeNode.SelectSingleNode(".//j:StatuteDescriptionText", nsmgr).InnerText); } return stringToReturn.ToString(); } public static String getAssignedIdDetails(XmlNode assignedIdDetailsNode, XmlNamespaceManager nsmgr) { StringBuilder stringToReturn = new StringBuilder(); if (assignedIdDetailsNode != null) { stringToReturn.AppendLine("\tAssignedIDDetails:"); XmlNode SSNID = assignedIdDetailsNode.SelectSingleNode("./j:PersonSSNID/j:ID", nsmgr); if ( SSNID != null ) { stringToReturn.AppendLine("\t\tSSN ID: " + SSNID.InnerText); } XmlNode FBIID = assignedIdDetailsNode.SelectSingleNode("./j:PersonFBIID/j:ID", nsmgr); if (FBIID != null) { stringToReturn.AppendLine("\t\tFBI ID: " + FBIID.InnerText); } XmlNode stateID = assignedIdDetailsNode.SelectSingleNode("./j:PersonStateID/j:ID", nsmgr); if (stateID != null) { stringToReturn.AppendLine("\t\tState ID: " + stateID.InnerText); } XmlNode AFISID = assignedIdDetailsNode.SelectSingleNode("./j:PersonAFISID/j:ID", nsmgr); if (AFISID != null) { stringToReturn.AppendLine("\t\tAFIS ID: " + AFISID.InnerText); } XmlNode otherID = assignedIdDetailsNode.SelectSingleNode("./j:PersonOtherID", nsmgr); if (otherID != null) { XmlNode id = otherID.SelectSingleNode("./j:ID", nsmgr); XmlNode type = otherID.SelectSingleNode("./j:PersonIDTypeCode", nsmgr); if (id != null) stringToReturn.Append("\t\tOther ID: " + id.InnerText); if (type != null) stringToReturn.AppendLine("\ttype: " + type.InnerText); } } return stringToReturn.ToString(); } public static String getPhysicalDetails(XmlNode physicalDetailsNode, XmlNamespaceManager nsmgr) { StringBuilder stringToReturn = new StringBuilder(); if (physicalDetailsNode != null) { stringToReturn.AppendLine("\tPhysicalDetails:"); XmlNode heightMeasure = physicalDetailsNode.SelectSingleNode("./j:PersonHeightMeasure", nsmgr); if (heightMeasure != null) { stringToReturn.AppendLine("\t\tHeight Measure: " + heightMeasure.InnerText + "\tUnit Code: " + heightMeasure.SelectSingleNode("./@j:personHeightUnitCode",nsmgr).InnerText); } XmlNode weightMeasure = physicalDetailsNode.SelectSingleNode("./j:PersonWeightMeasure", nsmgr); if (weightMeasure != null) { stringToReturn.AppendLine("\t\tWeight Measure: " + weightMeasure.InnerText + "\tUnit Code: " + weightMeasure.SelectSingleNode("./@j:personWeightUnitCode", nsmgr).InnerText); } XmlNode eyeColorText = physicalDetailsNode.SelectSingleNode("./j:PersonEyeColorText", nsmgr); if (eyeColorText != null) { stringToReturn.AppendLine("\t\tEye Color Text: " + eyeColorText.InnerText); } XmlNode eyeColorCode = physicalDetailsNode.SelectSingleNode("./j:PersonEyeColorCode", nsmgr); if (eyeColorCode != null) { stringToReturn.AppendLine("\t\tEye Color Code: " + eyeColorCode.InnerText); } XmlNode hairColorText = physicalDetailsNode.SelectSingleNode("./j:PersonHairColorText", nsmgr); if (hairColorText != null) { stringToReturn.AppendLine("\t\tHair Color Text: " + hairColorText.InnerText); } XmlNode hairColorCode = physicalDetailsNode.SelectSingleNode("./j:PersonHairColorCode", nsmgr); if (hairColorCode != null) { stringToReturn.AppendLine("\t\tHair Color Code: " + hairColorCode.InnerText); } XmlNode sexText = physicalDetailsNode.SelectSingleNode("./j:PersonSexText", nsmgr); if (sexText != null) { stringToReturn.AppendLine("\t\tSex Text: " + sexText.InnerText); } XmlNode sexCode = physicalDetailsNode.SelectSingleNode("./j:PersonSexCode", nsmgr); if (sexCode != null) { stringToReturn.AppendLine("\t\tSex Code: " + sexCode.InnerText); } XmlNode raceText = physicalDetailsNode.SelectSingleNode("./j:PersonRaceText", nsmgr); if (raceText != null) { stringToReturn.AppendLine("\t\tRace Text: " + raceText.InnerText); } XmlNode raceCode = physicalDetailsNode.SelectSingleNode("./j:PersonRaceCode", nsmgr); if (raceCode != null) { stringToReturn.AppendLine("\t\tRace Code: " + raceCode.InnerText); } XmlNode skinToneText = physicalDetailsNode.SelectSingleNode("./j:PersonSkinToneText", nsmgr); if (skinToneText != null) { stringToReturn.AppendLine("\t\tSkin Tone Text: " + skinToneText.InnerText); } XmlNode skinToneCode = physicalDetailsNode.SelectSingleNode("./j:PersonSkinToneCode", nsmgr); if (skinToneCode != null) { stringToReturn.AppendLine("\t\tSkin Tone Code: " + skinToneCode.InnerText); } XmlNodeList physicalFeatureNodes = physicalDetailsNode.SelectNodes("./j:PersonPhysicalFeature", nsmgr); foreach (XmlNode physicalFeatureNode in physicalFeatureNodes) { stringToReturn.AppendLine("\t\tPhysical Feature: "); stringToReturn.AppendLine("\t\t\tFeture Type Code: " + physicalFeatureNode.SelectSingleNode("./j:PhysicalFeatureTypeCode", nsmgr).InnerText); XmlNode physicalFeatureDescTextNode = physicalFeatureNode.SelectSingleNode("./j:PhysicalFeatureDescriptionText", nsmgr); if (physicalFeatureDescTextNode != null) { stringToReturn.AppendLine("\t\t\tFeature Description Text: " + physicalFeatureDescTextNode.InnerText); } } } return stringToReturn.ToString(); } public static String getLocationAddress(XmlNode locationAddressNode, XmlNamespaceManager nsmgr) { StringBuilder stringToReturn = new StringBuilder(); if (locationAddressNode != null) { stringToReturn.AppendLine("\tLocation Address: "); XmlNode locationStreet = locationAddressNode.SelectSingleNode("./j:LocationStreet", nsmgr); if (locationStreet != null) { stringToReturn.AppendLine("\tStreet: " + locationStreet.InnerText.Trim()); } XmlNodeList secondaryUnitTextNodes = locationAddressNode.SelectNodes("./j:LocationSecondaryUnitText", nsmgr); foreach (XmlNode secondaryUnitTextNode in secondaryUnitTextNodes) { stringToReturn.AppendLine("\tSecondary Unit Text: " + secondaryUnitTextNode.InnerText); } XmlNode cityName = locationAddressNode.SelectSingleNode("./j:LocationCityName", nsmgr); if (cityName != null) { stringToReturn.AppendLine("\tCity Name : " + cityName.InnerText); } XmlNode stateCode = locationAddressNode.SelectSingleNode("./j:LocationStateCode.USPostalService", nsmgr); if (stateCode != null) { stringToReturn.AppendLine("\tState Code: " + stateCode.InnerText); } XmlNode zipCode = locationAddressNode.SelectSingleNode("./j:LocationPostalCodeID/j:ID", nsmgr); if (zipCode != null) { stringToReturn.AppendLine("\tZip Code: " + zipCode.InnerText); } XmlNode countyName = locationAddressNode.SelectSingleNode("./j:LocationCountyName", nsmgr); if (countyName != null) { stringToReturn.AppendLine("\tCounty Name : " + countyName); } XmlNode countyCode = locationAddressNode.SelectSingleNode("./j:LocationCountyCode", nsmgr); if (countyCode != null) { stringToReturn.AppendLine("\tCounty Name : " + countyCode.InnerText); } } return stringToReturn.ToString(); } }