/// <summary> Event handler. Called by FNameTextBox for text changed events. /// Ensure valid first name entry, set vool accordingly</summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void FNameTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; //Validate First name isValid = PatientValidation.ValidateFirstName(fNameTextBox.Text); if (!isValid) //If not valid, show error, set booleam to false. { fNameEntered = false; fNameError.Visibility = Visibility.Visible; } else //String is valid hide error and set bool to true. { fNameEntered = true; fNameError.Visibility = Visibility.Hidden; } //If string is null... Set it to false but hide error if (String.IsNullOrEmpty(fNameTextBox.Text)) { fNameEntered = false; fNameError.Visibility = Visibility.Hidden; } }
public bool ValidateAddPatienInfo(List <string> errors, PatientInformation patient) { bool isValid = true; if (!PatientValidation.ValidateFirstName(patient.firstname)) { isValid = false; errors.Add("Error: Invalid First Name."); } if (!PatientValidation.ValidateLastName(patient.LastName)) { isValid = false; errors.Add("Error: Invalid Last Name."); } if (!PatientValidation.ValidateHCN(patient.HCN)) { isValid = false; errors.Add("Error: Invalid Health Card Number."); } if (!PatientValidation.ValidateMInitial(patient.MInitial)) { isValid = false; errors.Add("Error: Invalid Middle Initial."); } if (!PatientValidation.ValidateDOB(patient.DOB)) { isValid = false; errors.Add("Error: Invalid Birth Date."); } return(isValid); }
/// /// <summary> Event handler. Called by FNameTextBox for text changed events. </summary> /// /// <remarks> UNIT ONE, 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> /// private void FNameTextBox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; //CheckValidation isValid = PatientValidation.ValidateFirstName(fNameTextBox.Text); if (!isValid) //Not valid { fNameEntered = false; fNameError.Visibility = Visibility.Visible; } else { //Valid fNameEntered = true; fNameError.Visibility = Visibility.Hidden; } if (String.IsNullOrEmpty(fNameTextBox.Text)) //Empty string { fNameEntered = false; fNameError.Visibility = Visibility.Hidden; } }