Click here to Skip to main content
15,917,177 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I have C# code if statement where I want to add a condition to check if string length for RescheduledReason = 0

Here is what xml code look like
XML
<xsl:when test="(Cancelled='True') and (string-length(RescheduledReason)=0)">Cancelled</xsl:when>


Here is my if statement in C#
C#
if ((objxmlNode.SelectSingleNode("Cancelled") != null) && (objxmlNode.SelectSingleNode("Cancelled").InnerText == "True")) 
{
   objPrepHearDoc.Hearing.Settings[i].SettingStatus = "Cancelled";
}


How do I add checking string length RescheduledReason = 0?

What I have tried:

My code that I need help with to add string length RescheduledReason = 0?

C#
if ((objxmlNode.SelectSingleNode("Cancelled") != null) && (objxmlNode.SelectSingleNode("Cancelled").InnerText == "True")) 
{
 objPrepHearDoc.Hearing.Settings[i].SettingStatus = "Cancelled";
}
Posted
Updated 12-Mar-19 5:02am
Comments
[no name] 12-Mar-19 11:04am    
Look for a "RescheduledReason" element / attribute and that it's "value" is "empty" (probably indicating a cancellation with no rescheduling).

Looking at some actual XML for / from this might help.

1 solution

Try this out:
C#
if ((objxmlNode.SelectSingleNode("RescheduledReason") != null) && (objxmlNode.SelectSingleNode("RescheduledReason").InnerText.Length == 0)) 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900