p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   .NET 4 and Visual Studio 2010 General Discussions (http://p2p.wrox.com/forumdisplay.php?f=579)
-   -   How can I use if statement to check if po user send is the same as one in the case? (http://p2p.wrox.com/showthread.php?t=94032)

winkimjr2 January 26th, 2015 12:07 PM

How can I use if statement to check if po user send is the same as one in the case?
 
I would like to check to see if the po number the user submitted is the same as the one in the case using if statement. If the po number is not the same, I want to throw an exception "PO Number does not match the one in the case"

The case is an xml document saved in objXmlCaseDoc.

Here is my vb code.
Code:



Public Class BcaPoRequests

  Private Class MessageProcessor

            Dim objXmlMessageDoc As XmlDocument
            Dim objXmlMessageNode As XmlNode
            Dim objNameTable As NameTable
            Dim objXMLNameSpaceManager As XmlNamespaceManager
            Dim objXMLSchemaException As Xml.Schema.XmlSchemaException
            Dim strCaseNumber As String
            Dim strPoNumber As String
            Dim objXmlCaseDoc As XmlDocument
            Dim objXMLOutputSoapEnvelopeDoc As XmlDocument


            'Check if the PO on this case is the same as the one user submitted
            'How do I use a if statement to see if the PO submitted is the same as the one in the case?


    End Class

End Class


winkimjr2 January 27th, 2015 01:28 PM

This is how I resolved this issue:

Code:

If objXmlCaseDoc.DocumentElement.SelectSingleNode("ProtectionOrder[ProtectionOrderNumber='" + strPoNumber + "']", objXMLNameSpaceManager) Is Nothing Then

                aobjBroker.Reply(aobjBroker.CreateSoapFault(Msc.Integration.Utility.Library.v4.Soap.udtSoapCodes.Sender, "Protection Order " + strPoNumber + " for case " + strCaseNumber + " not found.", Msc.Integration.Utility.Library.v4.Soap.udtSoapRoles.RoleUltimateReceiver, aobjXMLInputSoapEnvelopeDoc, "soap:InvalidMessage", "soap:Body", Msc.Integration.Utility.Library.v4.Soap.GetReplyEndpointReference(aobjXMLInputSoapEnvelopeDoc), aobjXMLInputSoapEnvelopeDoc.DocumentElement.SelectSingleNode("soap:Header/wsa:MessageID", objXMLNameSpaceManager).InnerText, aobjConsumer))
                Exit Sub
            End If



All times are GMT -4. The time now is 07:17 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.