private void Send_Click(object sender, RoutedEventArgs e) { bool passedEmptyBoxesStage = SharedFunctions.PassedEmpty(this); if (passedEmptyBoxesStage) { if (IsDate(birthText.Text) == false) { SharedFunctions.AddErrors(birthText, "Incorrect format: Example format - 12/06/1972"); } Match match = Regex.Match(bloodTypeText.Text, "^([A-Z]+\\-)(Positive|Negative)$"); if (match.Success == false) { SharedFunctions.AddErrors(bloodTypeText, "Incorrect format: Should be 1 or more letters, a '-' symbol, and then" + "either Positive or Negative"); } if (SharedFunctions.GetFoundErrors().Count() == 0) { ValidateDonorDetails(); } else { SharedFunctions.CheckForErrors(); } } }
private void Send_Click(object sender, RoutedEventArgs e) { bool passedEmptyBoxesStage = SharedFunctions.PassedEmpty(this); var emailAtr = new EmailAddressAttribute(); if (passedEmptyBoxesStage) { if (!number.Text.All(Char.IsDigit)) { SharedFunctions.AddErrors(number, "Contact: Type in only numbers"); } if (pass.Text != confirm.Text) { SharedFunctions.AddErrors(pass, "Password confirmation does not match"); } if (emailAtr.IsValid(mail.Text) == false) { SharedFunctions.AddErrors(mail, "Please write your email in the format: [email protected]"); } if (SharedFunctions.GetFoundErrors().Count() == 0) { AddValidateDetails(); } else { SharedFunctions.CheckForErrors(); } } //All fields where blank, leave all red, but change as input else { SharedFunctions.Clear(this); } }