public IIhiSearchValidateOutcome SearchOrValidateIhi(IIhiRequestData IhiRequestData) { IhiSearchValidateOutcome = new IhiSearchValidateOutcome(IhiRequestData); //Hash the config so that we don't validate it is unchanged. int ConfigHashTemp = IhiSearchValidateConfig.GetHashCode(); if (ConfigHashTemp != ConfigHash) { if (!IsConfigrationDataValid()) { return(IhiSearchValidateOutcome); } else { ConfigHash = ConfigHashTemp; } } if (!IsRequestDataValid()) { return(IhiSearchValidateOutcome); } IhiSeachOrValidateQuery(); return(IhiSearchValidateOutcome); }
private void SetRequestDataForQuery(IhiSearchValidateOutcome IhiSearchValidateOutcome, searchIHI request) { RequestHasMedicareNumber = false; RequestHasDvaNumber = false; RequestHasIHINumber = false; if (!String.IsNullOrWhiteSpace(IhiSearchValidateOutcome.RequestData.Given)) { request.givenName = IhiSearchValidateOutcome.RequestData.Given; } if (!String.IsNullOrWhiteSpace(IhiSearchValidateOutcome.RequestData.Family)) { request.familyName = IhiSearchValidateOutcome.RequestData.Family; } if (IhiSearchValidateOutcome.RequestData.Dob.HasValue) { request.dateOfBirth = IhiSearchValidateOutcome.RequestData.Dob.Value; } if (Char.IsLetter(IhiSearchValidateOutcome.RequestData.SexChar)) { request.sex = GetSexTypeByChar(IhiSearchValidateOutcome.RequestData.SexChar); } if (!String.IsNullOrWhiteSpace(IhiSearchValidateOutcome.RequestData.MedicareNumber)) { request.medicareCardNumber = RemoveWhitespace(IhiSearchValidateOutcome.RequestData.MedicareNumber); RequestHasMedicareNumber = true; } if (!String.IsNullOrWhiteSpace(IhiSearchValidateOutcome.RequestData.MedicareIRN)) { request.medicareIRN = IhiSearchValidateOutcome.RequestData.MedicareIRN; } if (!String.IsNullOrWhiteSpace(IhiSearchValidateOutcome.RequestData.DVANumber)) { request.dvaFileNumber = RemoveWhitespace(IhiSearchValidateOutcome.RequestData.DVANumber); RequestHasDvaNumber = true; } if (!String.IsNullOrWhiteSpace(IhiSearchValidateOutcome.RequestData.IHINumber)) { request.ihiNumber = IhiNamespace + RemoveWhitespace(IhiSearchValidateOutcome.RequestData.IHINumber); RequestHasIHINumber = true; } }
private void SetSoapRequestAndResponseData(IhiSearchValidateOutcome IhiSearchValidateOutcome, ConsumerSearchIHIClient client, searchIHIResponse ihiResponse) { if (ihiResponse != null && ihiResponse.searchIHIResult != null && ihiResponse.searchIHIResult.serviceMessages != null) { ServiceMessagesType ServiceMessage = ihiResponse.searchIHIResult.serviceMessages; foreach (var Msg in ServiceMessage.serviceMessage) { HiServiceMessage HiServiceMessage = new HiServiceMessage(); if (!String.IsNullOrWhiteSpace(Msg.code)) { HiServiceMessage.Code = Msg.code; } if (!String.IsNullOrWhiteSpace(Msg.reason)) { HiServiceMessage.Reason = Msg.reason; } HiServiceMessage.SeverityType = GetSeverityTypeString(Msg.severity); IhiSearchValidateOutcome.QueryMetadata.ServiceMessage.Add(HiServiceMessage); } } if (client.SoapMessages != null) { if (!String.IsNullOrWhiteSpace(client.SoapMessages.SoapRequestMessageId)) { IhiSearchValidateOutcome.QueryMetadata.SoapRequestMessageId = client.SoapMessages.SoapRequestMessageId; } if (!String.IsNullOrWhiteSpace(client.SoapMessages.SoapResponseMessageId)) { IhiSearchValidateOutcome.QueryMetadata.SoapResponseMessageId = client.SoapMessages.SoapResponseMessageId; } if (IhiSearchValidateOutcome.RequestData.ReturnSoapRequestAndResponseData) { if (!String.IsNullOrWhiteSpace(client.SoapMessages.SoapRequest)) { IhiSearchValidateOutcome.QueryMetadata.SoapRequest = client.SoapMessages.SoapRequest; } if (!String.IsNullOrWhiteSpace(client.SoapMessages.SoapResponse)) { IhiSearchValidateOutcome.QueryMetadata.SoapResponse = client.SoapMessages.SoapResponse; } } } }
private void SetResponseDataToReturnData(IhiSearchValidateOutcome IhiSearchValidateOutcome, searchIHIResponse ihiResponse) { if (ihiResponse.searchIHIResult != null) { if (!String.IsNullOrWhiteSpace(ihiResponse.searchIHIResult.familyName)) { IhiSearchValidateOutcome.ResponseData.Family = ihiResponse.searchIHIResult.familyName; } if (!String.IsNullOrWhiteSpace(ihiResponse.searchIHIResult.givenName)) { IhiSearchValidateOutcome.ResponseData.Given = ihiResponse.searchIHIResult.givenName; } if (ihiResponse.searchIHIResult.dateOfBirth != null) { IhiSearchValidateOutcome.ResponseData.Dob = ihiResponse.searchIHIResult.dateOfBirth; } IhiSearchValidateOutcome.ResponseData.SexChar = GetSexCharBySexType(ihiResponse.searchIHIResult.sex); if (!String.IsNullOrWhiteSpace(ihiResponse.searchIHIResult.ihiNumber)) { if (ihiResponse.searchIHIResult.ihiNumber.StartsWith(IhiNamespace) && ihiResponse.searchIHIResult.ihiNumber.Length == (IhiNamespace.Length + 16)) { //Strip off the namespace and only return the 16 digit IHI number string IHIValue = ihiResponse.searchIHIResult.ihiNumber; IhiSearchValidateOutcome.ResponseData.IHINumber = IHIValue.Substring(IHIValue.Length - 16, 16); } else { //For some reason the retuned value does not conform to the namespave and 16 digit IHI default, so just return what we got. IhiSearchValidateOutcome.ResponseData.IHINumber = ihiResponse.searchIHIResult.ihiNumber; } } if (ihiResponse.searchIHIResult.ihiRecordStatusSpecified) { IhiSearchValidateOutcome.ResponseData.IHIRecordStatus = ihiResponse.searchIHIResult.ihiRecordStatus.ToString(); } if (ihiResponse.searchIHIResult.ihiStatusSpecified) { IhiSearchValidateOutcome.ResponseData.IHIStatus = ihiResponse.searchIHIResult.ihiStatus.ToString(); } if (!String.IsNullOrWhiteSpace(ihiResponse.searchIHIResult.medicareCardNumber)) { IhiSearchValidateOutcome.ResponseData.MedicareNumber = ihiResponse.searchIHIResult.medicareCardNumber; } if (!String.IsNullOrWhiteSpace(ihiResponse.searchIHIResult.medicareIRN)) { IhiSearchValidateOutcome.ResponseData.MedicareIRN = ihiResponse.searchIHIResult.medicareIRN; } if (!String.IsNullOrWhiteSpace(ihiResponse.searchIHIResult.dvaFileNumber)) { IhiSearchValidateOutcome.ResponseData.DVANumber = ihiResponse.searchIHIResult.dvaFileNumber; } } }