Can someone please explain to me how to check the CELL phone using the same query that I used to check for the HOME phone in my if statement?
If type HOME is not found I want to get type CELL, if that is not found, I want to get type WORK, if that is not found, I want to find type FAX in that order.
I only want to get one type at a time. The phone for the type must have @Current='true'
What I need to change is the following if statement
if (objxmlPhoneNode.SelectSingleNode("Type").InnerText == 'Cell')
so that I can recheck for the CELL, WORK and FAX using,
XmlNode objxmlPhoneNode = objxmlBasePartyNode.SelectSingleNode("Phone[@Current='true' and Type/@Word='HOME']");
I am not sure how to use this in my if statement to check for CELL, WORK and FAX if there was no HOME
XmlNode objxmlPhoneNode = objxmlBasePartyNode.SelectSingleNode("Phone[@Current='true'and Type/@Word='HOME']");
if (objxmlPhoneNode != null)
{
objCaseParty.Phone = new ConservatorService.Phone();
objCaseParty.Phone.Type = ConservatorService.PhoneNumberTypes.Home;
blnPhoneFound = true;
if (objxmlPhoneNode != null)
{
if (objxmlPhoneNode.SelectSingleNode("Type").InnerText == "Cell")
{
objCaseParty.Phone.Type = ConservatorService.PhoneNumberTypes.Cell;
}
}
}
Here is my xml document
<?xml version="1.0" encoding="UTF-8"?>
<Party ID="14884325" InternalPartyID="1612739531">
<Phone Current="true">
<Type Word="FAX">Fax</Type>
<Number>999-999-9999</Number>
</Phone>
<Phone>
<Type Word="FAX">Fax</Type>
<Number>999-999-9999</Number>
</Phone>
<Phone Current="true">
<Type Word="HOME">Home</Type>
<Number>777-777-7777</Number>
</Phone>
<Phone>
<Type Word="HOME">Home</Type>
<Number>777-777-7777</Number>
</Phone>
<Phone Current="true">
<Type Word="WORK">Work</Type>
<Number>111-222-0000</Number>
</Phone>
<Phone>
<Type Word="WORK">Work</Type>
<Number>111-222-0000</Number>
</Phone>
<Phone Current="true">
<Type Word="CELL">Cell</Type>
<Number>666-666-6666</Number>
</Phone>
<Phone>
<Type Word="CELL">Cell</Type>
<Number>666-666-6666</Number>
</Phone>
</Party>
If type HOME is not found I want to get type CELL, if that is not found, I want to get type WORK, if that is not found, I want to find type FAX in that order.
I only want to get one type at a time. The phone for the type must have @Current='true'
What I need to change is the following if statement
if (objxmlPhoneNode.SelectSingleNode("Type").InnerText == 'Cell')
so that I can recheck for the CELL, WORK and FAX using,
XmlNode objxmlPhoneNode = objxmlBasePartyNode.SelectSingleNode("Phone[@Current='true' and Type/@Word='HOME']");
I am not sure how to use this in my if statement to check for CELL, WORK and FAX if there was no HOME
XmlNode objxmlPhoneNode = objxmlBasePartyNode.SelectSingleNode("Phone[@Current='true'and Type/@Word='HOME']");
if (objxmlPhoneNode != null)
{
objCaseParty.Phone = new ConservatorService.Phone();
objCaseParty.Phone.Type = ConservatorService.PhoneNumberTypes.Home;
blnPhoneFound = true;
if (objxmlPhoneNode != null)
{
if (objxmlPhoneNode.SelectSingleNode("Type").InnerText == "Cell")
{
objCaseParty.Phone.Type = ConservatorService.PhoneNumberTypes.Cell;
}
}
}
Here is my xml document
<?xml version="1.0" encoding="UTF-8"?>
<Party ID="14884325" InternalPartyID="1612739531">
<Phone Current="true">
<Type Word="FAX">Fax</Type>
<Number>999-999-9999</Number>
</Phone>
<Phone>
<Type Word="FAX">Fax</Type>
<Number>999-999-9999</Number>
</Phone>
<Phone Current="true">
<Type Word="HOME">Home</Type>
<Number>777-777-7777</Number>
</Phone>
<Phone>
<Type Word="HOME">Home</Type>
<Number>777-777-7777</Number>
</Phone>
<Phone Current="true">
<Type Word="WORK">Work</Type>
<Number>111-222-0000</Number>
</Phone>
<Phone>
<Type Word="WORK">Work</Type>
<Number>111-222-0000</Number>
</Phone>
<Phone Current="true">
<Type Word="CELL">Cell</Type>
<Number>666-666-6666</Number>
</Phone>
<Phone>
<Type Word="CELL">Cell</Type>
<Number>666-666-6666</Number>
</Phone>
</Party>
Last edited: