Files
LeafWeb/WebCms/Models/LeafInputDetails.cs
T

80 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using AutoMapper;
using LeafWeb.Core.Entities;
namespace LeafWeb.WebCms.Models
{
public class LeafInputDetails
{
[HiddenInput(DisplayValue = false)]
public int LeafInputId { get; set; }
[Display(Name = "Identifier", Order = 0)]
[Required(ErrorMessage = "A unique identifier is required")]
public string Identifier { get; set; }
[Display(Name = "Site Id", Order = 0)]
[Required(ErrorMessage = "The site's name is required")]
public string SiteId { get; set; }
[Display(Name = "Photosyn. Pathway", Order = 0)]
[Required(ErrorMessage = "A Photosynthetic pathway must be chosen")]
public string PhotosynthesisType { get; set; }
[Display(Name = "Name", Order = 0)]
[Required(ErrorMessage = "Name required")]
[RegularExpression(@"[A-Za-z().]+(\s+[A-Za-z().]+)+", ErrorMessage = "Please provide full name")]
public string Name { get; set; }
[Display(Name = "Email address", Order = 0)]
[Required(ErrorMessage = "An email address is required")]
[DataType(DataType.EmailAddress)]
[RegularExpression(@"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}", ErrorMessage = "Must be an email address")]
public string Email { get; set; }
[DataType(DataType.Date)]
[Required]
[Display(Order = 0)]
public DateTime Added { get; set; }
[Display(Name = "Piscal Error", Order = 0)]
[UIHint("PreReadMore")]
public string OutputErrorMessage { get; set; }
[Display(Name = "Piscal Warning", Order = 0)]
[UIHint("PreReadMore")]
public string OutputWarningMessage { get; set; }
[HiddenInput(DisplayValue = false)]
public bool HasLeafChart { get; set; }
[HiddenInput(DisplayValue = false)]
public bool HasOutputFiles { get; set; }
[HiddenInput(DisplayValue = false)]
public bool IsRunning { get; set; }
[HiddenInput(DisplayValue = false)]
public bool IsComplete { get; set; }
[HiddenInput(DisplayValue = false)]
public bool IsDeletable { get; set; }
[HiddenInput(DisplayValue = false)]
public bool IsCancellable { get; set; }
[UIHint("LeafInputDataViewModels")]
[Display(Order = 0)]
public List<LeafInputDataViewModel> LeafInputData { get; set; }
public LeafInputDetails(){}
public LeafInputDetails(LeafInput leafInput)
{
Mapper.Map(leafInput, this);
}
}
}