/// <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 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; } }
/// /// <summary> Event handler. Called by CityTextBox 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 CityTextBox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; isValid = PatientValidation.ValidateCity(cityTextBox.Text); if (!isValid && !String.IsNullOrEmpty(cityTextBox.Text)) { cityBool = false; cityError.Visibility = Visibility.Visible; } else { cityBool = true; cityError.Visibility = Visibility.Hidden; } }
/// /// <summary> Event handler. Called by PNumberTextBox 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 PNumberTextBox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; //Phone number validation isValid = PatientValidation.ValidatePhone(pNumberTextBox.Text); if (!isValid && !String.IsNullOrEmpty(pNumberTextBox.Text)) //Not valid and not empty { pNumberBool = false; pNumError.Visibility = Visibility.Visible; } else //Valid { pNumberBool = true; pNumError.Visibility = Visibility.Hidden; } }
/// /// <summary> Event handler. Called by PCodeTextBox 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 PCodeTextBox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; //Postal Code Validation isValid = PatientValidation.ValidatePostalCode(pCodeTextBox.Text); if (!isValid && !String.IsNullOrWhiteSpace(pCodeTextBox.Text)) //String is not valid and not empty. { pCodeBool = false; pCodeError.Visibility = Visibility.Visible; } else //Valid { pCodeBool = true; pCodeError.Visibility = Visibility.Hidden; } }
/// /// <summary> Event handler. Called by AddressTwoTextbox 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 AddressTwoTextbox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; //Address 2 textbox validation isValid = PatientValidation.ValidateAddressLine2(addressTwoTextbox.Text); if (!isValid && !String.IsNullOrEmpty(addressTwoTextbox.Text)) //Not valid and not an empty string { addressTwoBool = false; address2Error.Visibility = Visibility.Visible; } else //false { addressTwoBool = true; address2Error.Visibility = Visibility.Hidden; } }
/// /// <summary> Event handler. Called by AddressTextBox 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 AddressTextBox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; //Ensure valid address isValid = PatientValidation.ValidateAddressLine1(addressTextBox.Text); if (!isValid && !String.IsNullOrEmpty(addressTextBox.Text)) //Not valid and not empty { addressBool = false; addressError.Visibility = Visibility.Visible; } else //valid { addressBool = true; addressError.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by AddressTwoTextbox for text changed events. /// Ensure a vlaid address, otherwise set it to blank</summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void AddressTwoTextbox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; //Validate address two isValid = PatientValidation.ValidateAddressLine2(addressTwoTextbox.Text); if (!isValid && !String.IsNullOrEmpty(addressTwoTextbox.Text)) //Not valid, string is not empty { addressTwo = ""; address2Error.Visibility = Visibility.Visible; } else //Valid string { addressTwo = addressTwoTextbox.Text; address2Error.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by AddressTextBox for text changed events. /// Ensure a vlaid address, otherwise set it to blank</summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void AddressTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; //Validate address isValid = PatientValidation.ValidateAddressLine1(addressTextBox.Text); if (!isValid && !String.IsNullOrEmpty(addressTextBox.Text)) //If it is not valid and not empty { addressOne = ""; //Address is not set. Error is shown addressError.Visibility = Visibility.Visible; } else //Valid address. Set the address to the textbox string { addressOne = addressTextBox.Text; addressError.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by PCodeTextBox for text changed events. /// Ensures valid postal code entry</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 PCodeTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; //Check postal code validation isValid = PatientValidation.ValidatePostalCode(pCodeTextBox.Text); if (!isValid && !String.IsNullOrWhiteSpace(pCodeTextBox.Text)) //If not valid and not null { postalCode = ""; //Postal code equals nothing, error is present pCodeError.Visibility = Visibility.Visible; } else //Postal code is valid. And error is not visible. { postalCode = pCodeTextBox.Text; pCodeError.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by CityTextBox for text changed events. /// Ensure valid city was entered </summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void CityTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; //Validate the city isValid = PatientValidation.ValidateCity(cityTextBox.Text); if (!isValid && !String.IsNullOrEmpty(cityTextBox.Text)) //City is not valid and the textbox is not empty { city = ""; //City is emoty and error is visible cityError.Visibility = Visibility.Visible; } else //City is valid. Set it to the textbox contents/. { city = cityTextBox.Text; cityError.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by PNumberTextBox for text changed events. /// Ensure valid phone number entry </summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void PNumberTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; //Check phone validation isValid = PatientValidation.ValidatePhone(pNumberTextBox.Text); if (!isValid && !String.IsNullOrEmpty(pNumberTextBox.Text)) //see if not valid and string is not empty { //Set phone value to nothing. Show the error phoneNum = ""; pNumError.Visibility = Visibility.Visible; } else //Valid. Set phone value to textbox value. Hide the error { phoneNum = pNumberTextBox.Text; pNumError.Visibility = Visibility.Hidden; } }
/// /// <summary> Event handler. Called by LNameTextBox 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 LNameTextBox_TextChanged(object sender, TextChangedEventArgs e) { bool isValid = true; //Ensure last name is valid isValid = PatientValidation.ValidateLastName(lNameTextBox.Text); if (!isValid) //not valid { lNameEntered = false; lNameError.Visibility = Visibility.Visible; } else //Valid entry { lNameEntered = true; lNameError.Visibility = Visibility.Hidden; } if (String.IsNullOrEmpty(lNameTextBox.Text)) //Null string { lNameEntered = false; lNameError.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by HcnTextBox for text changed events. /// Ensures a valid health card, and that it does not already exist.</summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void HcnTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally hcnError.Content = "*Invalid Health Card Number!"; bool isValid = true; //Validate health card number isValid = PatientValidation.ValidateHCN(hcnTextBox.Text); if (!isValid) //Not valid. Make error visile. { hcnEntered = false; hcnError.Visibility = Visibility.Visible; } else //Health card is valid. { if (PatientValidation.ValidateNewHCN(hcnTextBox.Text)) //Ensure it doesnt yet exist, if it does show error { hcnEntered = false; hcnError.Content = "Health Card Number Already Exists!"; hcnError.Visibility = Visibility.Visible; } else //Health card is valid and does not exist. Set boolean to true. { hcnEntered = true; hcnError.Visibility = Visibility.Hidden; } } if (String.IsNullOrEmpty(hcnTextBox.Text)) //Nothing was entered. { hcnEntered = false; hcnError.Visibility = Visibility.Hidden; } }
/// /// <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; } }
/// /// <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; } }
/// <summary> Event handler. Called by LNameTextBox 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 LNameTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally bool isValid = true; isValid = PatientValidation.ValidateLastName(lNameTextBox.Text); if (!isValid) { lNameEntered = false; lNameError.Visibility = Visibility.Visible; } else { lNameEntered = true; lNameError.Visibility = Visibility.Hidden; } if (String.IsNullOrEmpty(lNameTextBox.Text)) { lNameEntered = false; lNameError.Visibility = Visibility.Hidden; } }
/// <summary> Event handler. Called by HohTextBox for text changed events. /// See if there is an Hoh with the given values and autofill /// the rest of the user information including, addresses, prov, postal /// code, city and phone number </summary> /// /// <remarks> 2019-04-20. </remarks> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Text changed event information. </param> private void HohTextBox_TextChanged(object sender, TextChangedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally //Set everything to empty and enable the boxes of the Hoh fields. addressTextBox.Text = ""; addressTextBox.IsEnabled = true; addressTwoTextbox.Text = ""; addressTwoTextbox.IsEnabled = true; cityTextBox.Text = ""; cityTextBox.IsEnabled = true; pNumberTextBox.Text = ""; pNumberTextBox.IsEnabled = true; pCodeTextBox.Text = ""; pCodeTextBox.IsEnabled = true; provComboBox.SelectedIndex = 0; provComboBox.IsEnabled = true; bool isValid = true; //Validate the Healthcard number of the HoH entry isValid = PatientValidation.ValidateHoH(hohTextBox.Text); //If not vlaid and string is not null if (!isValid && !String.IsNullOrEmpty(hohTextBox.Text)) { headOfHousehold = ""; //Set the hoh value to blank, show an error hohError.Visibility = Visibility.Visible; } //If it is null.. Dont shoe the error, still set value to blank else if (String.IsNullOrEmpty(hohTextBox.Text)) { headOfHousehold = ""; hohError.Visibility = Visibility.Hidden; } //Else, valid health card.. Input HoH details into the required boxes. else { //Hide the error. hohError.Visibility = Visibility.Hidden; fillPatient = Database.HoH_GetAutoFill(hohTextBox.Text); //Get the HoH information //Use the list returned from the Hohautofill to fill in the contents, // Set all of the boxes to be disabled until the user modifies the hoh // textbox again. addressTextBox.Text = fillPatient[0]; addressTextBox.IsEnabled = false; addressTwoTextbox.Text = fillPatient[1]; addressTwoTextbox.IsEnabled = false; cityTextBox.Text = fillPatient[2]; cityTextBox.IsEnabled = false; //Loop through the provinces to find the correct one, or select 0. for (i = 0; i < provComboBox.Items.Count; i++) { if (string.Compare(fillPatient[4], provComboBox.Items[i].ToString()) == 0) { provComboBox.SelectedIndex = i; } } if (fillPatient[4] == " ") { provComboBox.SelectedIndex = 0; } provComboBox.IsEnabled = false; pCodeTextBox.Text = fillPatient[3]; pCodeTextBox.IsEnabled = false; pNumberTextBox.Text = fillPatient[5]; pNumberTextBox.IsEnabled = false; headOfHousehold = hohTextBox.Text; } }
/// /// <summary> Event handler. Called by HohTextBox 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 HohTextBox_TextChanged(object sender, TextChangedEventArgs e) { //Sets all textboxes to be enabled addressTextBox.IsEnabled = true; addressTwoTextbox.IsEnabled = true; cityTextBox.IsEnabled = true; pNumberTextBox.IsEnabled = true; pCodeTextBox.IsEnabled = true; provComboBox.IsEnabled = true; bool isValid = true; //Check healthcard validation isValid = PatientValidation.ValidateHoH(hohTextBox.Text); if (!isValid && !String.IsNullOrEmpty(hohTextBox.Text)) //Not valid, non-empty string { hohEnteredBool = false; hohError.Visibility = Visibility.Visible; } else if (String.IsNullOrEmpty(hohTextBox.Text)) //Empty string { hohEnteredBool = false; hohError.Visibility = Visibility.Hidden; } else //valid { hohEnteredBool = true; hohError.Visibility = Visibility.Hidden; //Get autofill information fillPatient = Database.HoH_GetAutoFill(hohTextBox.Text); //Fill textboxes with returned list information accordingly addressTextBox.Text = fillPatient[0]; addressTextBox.IsEnabled = false; addressTwoTextbox.Text = fillPatient[2]; addressTwoTextbox.IsEnabled = false; cityTextBox.Text = fillPatient[1]; cityTextBox.IsEnabled = false; //Province for (i = 0; i < provComboBox.Items.Count; i++) { if (string.Compare(fillPatient[4], provComboBox.Items[i].ToString()) == 0) { provComboBox.SelectedIndex = i; } } if (fillPatient[4] == " ") { provComboBox.SelectedIndex = 0; } provComboBox.IsEnabled = false; pCodeTextBox.Text = fillPatient[3]; pCodeTextBox.IsEnabled = false; pNumberTextBox.Text = fillPatient[5]; pNumberTextBox.IsEnabled = false; } }