public override void Validate(ValidationMessages messages) { var list = new List <string>(); if (string.IsNullOrEmpty(Taxon.Epithet)) { messages.Error("The name must not be blank"); } else { if (Taxon.Epithet.Contains(" ") && !(Taxon.AvailableName.ValueOrFalse() || Taxon.LiteratureName.ValueOrFalse())) { messages.Error("The name must be only one word."); } } if (Taxon.Unverified.ValueOrFalse() || Taxon.LiteratureName.ValueOrFalse()) { if (!string.IsNullOrEmpty(Taxon.YearOfPub)) { int year; if (Int32.TryParse(Taxon.YearOfPub, out year)) { if (year < 1700 || year > 4000) { messages.Error("The year must be between the years 1700 and 4000"); } } } } }
public override void Validate(ValidationMessages messages) { if (String.IsNullOrEmpty(Model.RefCode)) { messages.Error("You must supply a Reference Code before you can continue"); } }
public override void Validate(ValidationMessages messages) { var list = new List<string>(); if (string.IsNullOrEmpty(Taxon.Epithet)) { messages.Error("The name must not be blank"); } else { if (Taxon.Epithet.Contains(" ") && !(Taxon.AvailableName.ValueOrFalse() || Taxon.LiteratureName.ValueOrFalse())) { messages.Error("The name must be only one word."); } } if (Taxon.Unverified.ValueOrFalse() || Taxon.LiteratureName.ValueOrFalse()) { if (!string.IsNullOrEmpty(Taxon.YearOfPub)) { int year; if (Int32.TryParse(Taxon.YearOfPub, out year)) { if (year < 1700 || year > 4000) { messages.Error("The year must be between the years 1700 and 4000"); } } } } }