Add object for results details

This commit is contained in:
2020-07-18 21:39:18 -04:00
parent 1e7fa1bb1d
commit 28377cfce8
14 changed files with 156 additions and 33 deletions
+11 -15
View File
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using AutoMapper;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Utility;
namespace LeafWeb.WebCms.Models
{
@@ -14,24 +12,24 @@ namespace LeafWeb.WebCms.Models
[HiddenInput(DisplayValue = false)]
public int LeafInputId { get; set; }
[Display(Name = "Identifier")]
[Display(Name = "Identifier", Order = 0)]
[Required(ErrorMessage = "A unique identifier is required")]
public string Identifier { get; set; }
[Display(Name = "Site Id")]
[Display(Name = "Site Id", Order = 0)]
[Required(ErrorMessage = "The site's name is required")]
public string SiteId { get; set; }
[Display(Name = "Photosyn. Pathway")]
[Display(Name = "Photosyn. Pathway", Order = 0)]
[Required(ErrorMessage = "A Photosynthetic pathway must be chosen")]
public string PhotosynthesisType { get; set; }
[Display(Name = "Name")]
[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")]
[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")]
@@ -39,19 +37,17 @@ namespace LeafWeb.WebCms.Models
[DataType(DataType.Date)]
[Required]
[Display(Order = 0)]
public DateTime Added { get; set; }
[Display(Name = "Piscal Error")]
[Display(Name = "Piscal Error", Order = 0)]
[UIHint("PreReadMore")]
public string OutputErrorMessage { get; set; }
[Display(Name = "Piscal Warning")]
[Display(Name = "Piscal Warning", Order = 0)]
[UIHint("PreReadMore")]
public string OutputWarningMessage { get; set; }
[Display(Name = "Time In Progress")]
public TimeSpan TimeInProgress { get; set; }
[HiddenInput(DisplayValue = false)]
public bool HasLeafChart { get; set; }
@@ -71,12 +67,12 @@ namespace LeafWeb.WebCms.Models
public bool IsCancellable { get; set; }
[UIHint("LeafInputDataViewModels")]
[Display(Order = 0)]
public List<LeafInputDataViewModel> LeafInputData { get; set; }
[UIHint("LeafInputStatusViewModels")]
public List<LeafInputStatusViewModel> StatusHistory { get; set; }
public LeafInputDetails(){}
public LeafInputDetails(LeafInput leafInput)
public LeafInputDetails(LeafInput leafInput)
{
Mapper.Map(leafInput, this);
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using AutoMapper;
using LeafWeb.Core.Entities;
namespace LeafWeb.WebCms.Models
{
public class LeafInputDetails_Admin : LeafInputDetails
{
[Display(Name = "Time In Progress", Order = 2)]
public TimeSpan TimeInProgress { get; set; }
[UIHint("LeafInputStatusViewModels")]
[Display(Order = 2)]
public List<LeafInputStatusViewModel> StatusHistory { get; set; }
public LeafInputDetails_Admin(LeafInput leafInput)
{
Mapper.Map(leafInput, this);
}
}
}