/// <summary>   Event handler. Called by InitialTextBox for text changed events.
        ///             Ensures one letter only was inputted </summary>
        ///
        /// <remarks>   2019-04-20. </remarks>
        ///
        /// <param name="sender">   Source of the event. </param>
        /// <param name="e">        Text changed event information. </param>

        private void MInitialTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            SubmitError.Visibility = Visibility.Hidden; //Hide the error initally
            bool isValid = true;

            //Validate middle intial
            isValid = PatientValidation.ValidateMInitial(mInitialTextBox.Text);

            if (!isValid) //If not valid. Show error
            {
                mInitialEntered          = false;
                mInitialError.Visibility = Visibility.Visible;
            }
            else //Valid entrey
            {
                mInitialEntered          = true;
                mInitialError.Visibility = Visibility.Hidden;
            }

            if (String.IsNullOrEmpty(mInitialTextBox.Text)) //Empty string. Not valid
            {
                mInitialEntered          = false;
                mInitialError.Visibility = Visibility.Hidden;
            }
        }
Beispiel #2
0
        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 InitialTextBox for text changed events. </summary>
        ///
        /// <remarks>   2019-04-20. </remarks>
        ///
        /// <param name="sender">   Source of the event. </param>
        /// <param name="e">        Text changed event information. </param>
        ///

        private void MInitialTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            bool isValid = true;

            //Ensure that the middle name is valid
            isValid = PatientValidation.ValidateMInitial(mInitialTextBox.Text);

            if (!isValid) //Not valid
            {
                mInitialEntered          = false;
                mInitialError.Visibility = Visibility.Visible;
            }
            else //Valid
            {
                mInitialEntered          = true;
                mInitialError.Visibility = Visibility.Hidden;
            }

            if (String.IsNullOrEmpty(mInitialTextBox.Text)) //Empty string
            {
                mInitialEntered          = false;
                mInitialError.Visibility = Visibility.Hidden;
            }
        }