public bool Validate() { Regex numeric = new Regex("^[0-9]*$"); if (!numeric.IsMatch(DrivenDistance.ToString())) { return(false); } if (ReturnDate > DateTime.Now) { return(false); } return(true); }
public bool Validate() { Regex alphabetic = new Regex(@"^[\s\p{L}]+$"); Regex numeric = new Regex("^[0-9]*$"); Regex mail = new Regex(@"^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$"); Regex alphanumeric = new Regex(@"^[\s\p{L}0-9]+$"); if (string.IsNullOrEmpty(DrivenDistance.ToString()) || (!numeric.IsMatch(DrivenDistance.ToString()) || string.IsNullOrEmpty(IsDamaged.ToString()) || string.IsNullOrEmpty(ReturnDate.ToString()))) { return(false); } if (ReturnDate > DateTime.Now) { return(false); } return(true); }