56 lines
2.3 KiB
C#
56 lines
2.3 KiB
C#
using System.Collections.Specialized;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace LeafWeb.WebCms.Models
|
|
{
|
|
public class LeafDataQuery
|
|
{
|
|
/// <summary>Query</summary>
|
|
[Display(Name = "Search", Description = "General query")]
|
|
public string q { get; set; }
|
|
|
|
[Display(Name = "Site ID", Description = "The site's name/Fluxnet ID, if known")]
|
|
[RegularExpression(@".{3,}", ErrorMessage = "Specify at least three characters")]
|
|
public string siteid { get; set; }
|
|
|
|
[Display(Name = "Species Name")]
|
|
[RegularExpression(@".{3,}", ErrorMessage = "Specify at least three characters")]
|
|
public string species { get; set; }
|
|
|
|
/// <summary>Site latitude, northern hemisphere positive</summary>
|
|
[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")]
|
|
[RegularExpression(@"^([0-9]|[1-8][0-9]|90)$", ErrorMessage = "± latitude degrees")]
|
|
public string latr { get; set; }
|
|
|
|
/// <summary>Site longitude, east positive</summary>
|
|
[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")]
|
|
[RegularExpression(@"^([0-9]|[1-8][0-9]|9[0-9]|1[0-7][0-9]|180)$", ErrorMessage = "± longitude degrees")]
|
|
public string lonr { get; set; }
|
|
|
|
/// <summary>Sample CO2 concentration</summary>
|
|
//[ParseInfo(17, units: "umol/mol")]
|
|
[Display(Name = "CO2 response curves")]
|
|
[RegularExpression(@"^([0-9]*\.[0-9]+|[0-9]+)$", ErrorMessage = "Value is numeric")]
|
|
public string co2s { get; set; }
|
|
|
|
public bool HasExtendedParameters =>
|
|
!(
|
|
string.IsNullOrEmpty(siteid)
|
|
&& string.IsNullOrEmpty(species)
|
|
&& string.IsNullOrEmpty(lat)
|
|
&& string.IsNullOrEmpty(latr)
|
|
&& string.IsNullOrEmpty(lon)
|
|
&& string.IsNullOrEmpty(lonr)
|
|
&& string.IsNullOrEmpty(co2s)
|
|
);
|
|
}
|
|
} |