private bool testForInvalidValues() { if (string.IsNullOrWhiteSpace(txtName.TextWithoutWatermark)) { Feedback.ErrorInvalidName(); return(false); } if (string.IsNullOrWhiteSpace(txtLastName.TextWithoutWatermark)) { Feedback.ErrorInvaliLastdName(); return(false); } if (string.IsNullOrWhiteSpace(txtEmail.TextWithoutWatermark) || !txtEmail.TextWithoutWatermark.Contains("@") || !txtEmail.TextWithoutWatermark.Contains(".")) { Feedback.ErrorInvaliEmail(); return(false); } if (string.IsNullOrWhiteSpace(txtPhoneNumber.TextWithoutWatermark) || !txtPhoneNumber.TextWithoutWatermark.Any(char.IsDigit)) { Feedback.ErrorInvalidTel(); return(false); } if (!DateTime.TryParse(txtBirthDate.TextWithoutWatermark, out DateTime birthDate)) { Feedback.ErrorInvalidDate(); return(false); } if ((DateTime.Today.Date - birthDate.Date) < new TimeSpan(365 * 18, 6 * 18, 0, 0)) //min. Alter { Feedback.ErrorInvalidAge(); return(false); } if (string.IsNullOrWhiteSpace(txtStreet.TextWithoutWatermark)) { Feedback.ErrorInvalidStreet(); return(false); } if (string.IsNullOrWhiteSpace(txtHouseNumber.TextWithoutWatermark)) { Feedback.ErrorInvalidHouseNumber(); return(false); } if (string.IsNullOrWhiteSpace(txtPlz.TextWithoutWatermark) || !txtPlz.TextWithoutWatermark.All(char.IsDigit)) { Feedback.ErrorInvalidPLZ(); return(false); } if (string.IsNullOrWhiteSpace(txtCity.TextWithoutWatermark)) { Feedback.ErrorInvalidCity(); return(false); } if (string.IsNullOrWhiteSpace(txtCountry.TextWithoutWatermark)) { Feedback.ErrorInvalidCountry(); return(false); } if (!DBController.TryGetAllCustomers(out List <Customer> customers)) { Feedback.ErrorDatabaseConnection(); return(false); } if (txtEmail.TextWithoutWatermark != customerOld.EmailAddress) { foreach (Customer c in customers) { if (txtEmail.TextWithoutWatermark == c.EmailAddress) { Feedback.ErrorAlreadyExistingEmail(); return(false); } } } return(true); }