Hi
I am trying to do a comparison that is confusing me
I start by extracting the portion of the ID number that pertains to gender. 0001 - 4999 is female, and 5000 - 9999 is male.
I then see what the gender is that is being selected and I compare it
In my tests I use the gender portion to be 5001 and I choose female as per the code below. This should run the code in the if conditional but it deems it evaluates to true but it deems it to be false. Am I doing something incorrectly
I am trying to do a comparison that is confusing me
I start by extracting the portion of the ID number that pertains to gender. 0001 - 4999 is female, and 5000 - 9999 is male.
I then see what the gender is that is being selected and I compare it
In my tests I use the gender portion to be 5001 and I choose female as per the code below. This should run the code in the if conditional but it deems it evaluates to true but it deems it to be false. Am I doing something incorrectly
C#:
string genderSegment = nationalIdstring.Substring(6, 4);
int genderSegmentInt = Convert.ToInt32(genderSegment);
string genderString = addStudentGenderCodeComboBox.SelectedValue.ToString();
string maleGender = "M";
string femaleGender = "F";
if ((genderSegmentInt > 4999) && (genderString == femaleGender))
{
isValidated = false;
validationErrorMessage.Append("The gender does not match portion in ID");
validationErrorMessage.Append(Environment.NewLine);
}