public static bool ReEnterPassword(string secondPassword, UIView view) { if (secondPassword.ToLower() == Settings.Password.ToLower()) { HelperMethods.RemoveValidationBorder(view); return(true); } else { HelperMethods.AnimateValidationBorder(view); return(false); } }
public static bool ValidateHomeAirport(string homeAirport, UIView view) { //homeAirport = homeAirport.ToUpper(); if (homeAirport.Count() < 6) { HelperMethods.RemoveValidationBorder(view); Settings.HomeAirport = homeAirport; return(true); } else { HelperMethods.AnimateValidationBorder(view); Settings.HomeAirport = string.Empty; return(false); } }
public static bool IsValidPhoneNumber(string phoneNumber, UIView view = null) { //Regex regex = new Regex(@"^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$"); //Match match = regex.Match(phoneNumber); //if (match.Success) //{ // return true; //} //else { // return false; //} bool isValid = false; if (phoneNumber == null || phoneNumber == string.Empty) { isValid = false; } else { isValid = true; } if (view != null) { if (isValid) { HelperMethods.RemoveValidationBorder(view); } else { HelperMethods.AnimateValidationBorder(view); } } if (isValid) { Settings.Phone = phoneNumber; } else { Settings.Phone = string.Empty; } return(isValid); }
public static bool IsValidPassword(string password, UIView view = null) { //regex "^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{10,}$" bool isValid = false; Regex regex = new Regex(@"^(?=.*[a-zA-Z\d].*)[a-zA-Z\d!@#$%&*]{6,}$"); Match match = regex.Match(password); if (match.Success) { // if (password.Length <= 5){} //isValid = false; isValid = true; } else { isValid = false; } if (view != null) { if (isValid) { HelperMethods.RemoveValidationBorder(view); } else { HelperMethods.AnimateValidationBorder(view); } } if (isValid) { Settings.Password = password; } else { Settings.Password = string.Empty; } return(isValid); }
public static bool IsValidEmail(string email, UIView view = null) { bool isValid = false; try { var addr = new System.Net.Mail.MailAddress(email); isValid = addr.Address == email; } catch { isValid = false; } if (view != null) { if (!isValid) { HelperMethods.AnimateValidationBorder(view); } else { HelperMethods.RemoveValidationBorder(view); } } if (isValid) { Settings.Email = email; } else { Settings.Email = string.Empty; } return(isValid); }