public bool Validate() { Regex alphanumeric = new Regex(@"^[\s\p{L}0-9]+$"); if (string.IsNullOrEmpty(LicensePlateNumber) || (!alphanumeric.IsMatch(LicensePlateNumber)) || string.IsNullOrEmpty(Brand) || (!alphanumeric.IsMatch(Brand)) || string.IsNullOrEmpty(Model) || (!alphanumeric.IsMatch(Model)) || string.IsNullOrEmpty(Engine) || (!alphanumeric.IsMatch(Engine)) || string.IsNullOrEmpty(Year.ToString()) || string.IsNullOrEmpty(Transmission) || (!alphanumeric.IsMatch(Transmission)) || string.IsNullOrEmpty(FuelType) || (!alphanumeric.IsMatch(FuelType)) || string.IsNullOrEmpty(Color) || (!alphanumeric.IsMatch(Color)) || string.IsNullOrEmpty(PricePerDay.ToString()) || string.IsNullOrEmpty(Mileage.ToString())) { return(false); } int currentYear = DateTime.Now.Year; if (Year < (currentYear - 100) || (Year > currentYear)) { return(false); } return(true); }
public int CompareTo(VideoBO other) { if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } var idComparison = Id.CompareTo(other.Id); if (idComparison != 0) { return(idComparison); } var titleComparison = string.Compare(Title, other.Title, StringComparison.Ordinal); if (titleComparison != 0) { return(titleComparison); } return(PricePerDay.CompareTo(other.PricePerDay)); }