I would like to check if the first status element in ProtectionOrder with Op="A" or "E" is the same as first Status element in MNProtectionOrderAdditional with Op="A" or "E".
If they are not equal, I will throw a system error like this Throw New System.Exception("Statuses out of sync. The detail tab does Not match the additional tab status.")
How do I do this using if statement in VB.Net?
In my Vb.Net code, the xml document is in aobjXmlInputDoc object. So to get Status element I will do it this way
In plain English my logic will look like this
If the first status with Op=A or E from ProtectionOrder <> to first Status from MNProtectionOrderAdditional Then
Throw New System.Exception("Statuses out of sync. The detail tab does Not match the additional tab status.")
End If
In VB.Net I am not sure how to do it. This is where I need help.
Code:
If aobjXmlInputDoc.DocumentElement.SelectSingleNode("Integration/ProtectionOrder/Statuses/Status[1]/@Op") <> aobjXmlInputDoc.DocumentElement.SelectSingleNode ("Integration/ProtectionOrder/MNProtectionOrderAdditional/Statuses/Status[1]/@Op") Then
Throw New System.Exception("Statuses out of sync. The detail tab does Not match the additional tab status.")
End If
Here is my xml document.
Code:
<Integration>
<ProtectionOrder>
<Statuses>
<Status Op="A">
<Current>true</Current>
<Active>No</Active>
<Date Op="A">12/13/2018</Date>
<Type Op="A" Word="EXPIRED">Expired</Type>
</Status>
<Status>
<Current>false</Current>
<Active>Yes</Active>
<Date>12/13/2016</Date>
<Type Word="SBJO">Signed By Judicial Officer</Type>
</Status>
<Status>
<Current>false</Current>
<Active>No</Active>
<Date>12/13/2016</Date>
<Type Word="DRAFT">Draft</Type>
</Status>
</Statuses>
<MNProtectionOrderAdditional>
<Statuses>
<Status Op="A">
<Current>false</Current>
<Active>No</Active>
<Date Op="A">12/13/2018</Date>
<Type Op="A" Word="EXPIRED">Expired</Type>
</Status>
<Status>
<Current>false</Current>
<Active>Yes</Active>
<Date>12/13/2016</Date>
<Type Word="SBJO">Signed By Judicial Officer</Type>
</Status>
<Status>
<Current>true</Current>
<Active>No</Active>
<Date>12/13/2016</Date>
<Type Word="DRAFT">Draft</Type>
</Status>
</Statuses>
</MNProtectionOrderAdditional>
</ProtectionOrder>
</Integration>