Search now works more than once
Browser validation for search
This commit is contained in:
@@ -1,35 +1,39 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AutoMapper;
|
||||
using LeafWeb.Core.DAL;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.WebCms.Controllers;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace LeafWeb.WebCms.Models
|
||||
{
|
||||
public class LeafDataQuery
|
||||
{
|
||||
/// <summary>Query</summary>
|
||||
[Display(Name = "Search", Description = "General query")]
|
||||
public string Query { get; set; }
|
||||
public string q { get; set; }
|
||||
|
||||
[Display(Name = "Site ID", Description = "The site's name/Fluxnet ID, if known")]
|
||||
public string SiteId { get; set; }
|
||||
[RegularExpression(@".{3,}", ErrorMessage = "Specify at least three characters")]
|
||||
public string siteid { get; set; }
|
||||
|
||||
[Display(Name = "Species Name")]
|
||||
public string SpeciesName { get; set; }
|
||||
[RegularExpression(@".{3,}", ErrorMessage = "Specify at least three characters")]
|
||||
public string species { get; set; }
|
||||
|
||||
/// <summary>Site latitude, northern hemisphere positive</summary>
|
||||
[RegularExpression(@"\d{0,2}", ErrorMessage = "Site latitude, northern hemisphere positive")]
|
||||
public int Latitude { get; set; }
|
||||
[Display(Name = "Latitude")]
|
||||
[RegularExpression(@"^-?([0-9]|[1-8][0-9]|90)$", ErrorMessage = "Site latitude, northern hemisphere positive, -90 – 90")]
|
||||
public string lat { get; set; }
|
||||
|
||||
[Display(Name = "Range")]
|
||||
public string LatitudeRange { get; set; }
|
||||
[RegularExpression(@"^([0-9]|[1-8][0-9]|90)$", ErrorMessage = "± latitude degrees")]
|
||||
public string latr { get; set; }
|
||||
|
||||
/// <summary>Site longitude, east positive</summary>
|
||||
[RegularExpression(@"\d{0,2}", ErrorMessage = "Site longitude, east positive")]
|
||||
public string Longitude { get; set; }
|
||||
[Display(Name = "Longitude")]
|
||||
[RegularExpression(@"^-?([0-9]|[1-8][0-9]|9[0-9]|1[0-7][0-9]|180)$", ErrorMessage = "Site longitude, east positive, -180 – 180")]
|
||||
public string lon { get; set; }
|
||||
|
||||
[Display(Name = "Range")]
|
||||
public string LongitudeRange { get; set; }
|
||||
[RegularExpression(@"^([0-9]|[1-8][0-9]|9[0-9]|1[0-7][0-9]|180)$", ErrorMessage = "± longitude degrees")]
|
||||
public string lonr { get; set; }
|
||||
|
||||
static LeafDataQuery()
|
||||
{
|
||||
@@ -43,5 +47,25 @@ namespace LeafWeb.WebCms.Models
|
||||
{
|
||||
//PhotosynthesisType = new SelectListViewModel();
|
||||
}
|
||||
|
||||
public NameValueCollection GetNameValueCollection(string prefix="")
|
||||
{
|
||||
var nvs = new NameValueCollection();
|
||||
|
||||
prefix =
|
||||
string.IsNullOrEmpty(prefix)
|
||||
? ""
|
||||
: prefix + ".";
|
||||
|
||||
foreach (var pi in typeof(LeafDataQuery).GetProperties())
|
||||
{
|
||||
var value = pi.GetValue(this, null);
|
||||
if (value == null)
|
||||
continue;
|
||||
nvs.Add(prefix + pi.Name, value?.ToString());
|
||||
}
|
||||
|
||||
return nvs;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace LeafWeb.WebCms.Models
|
||||
public string ServerDescription { get; set; }
|
||||
public string ServerStatus { get; set; }
|
||||
public IEnumerable<LeafInput> Items { get; set; }
|
||||
public LeafDataQuery Query { get; set; }
|
||||
public LeafDataQuery Q { get; set; }
|
||||
public TimeInProgressEstimater TimeInProgressEstimater { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user