26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace JdeScoping.Client.Models;
|
|
|
|
/// <summary>
|
|
/// View model for displaying search information in lists and details.
|
|
/// </summary>
|
|
public class SearchViewModel
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
[Required(ErrorMessage = "Name is required.")]
|
|
public string Name { get; set; } = string.Empty;
|
|
public string UserName { get; set; } = string.Empty;
|
|
public string Status { get; set; } = string.Empty;
|
|
public DateTime? SubmitDt { get; set; }
|
|
public DateTime? StartDt { get; set; }
|
|
public DateTime? EndDt { get; set; }
|
|
public SearchCriteriaViewModel Criteria { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets the background color based on status.
|
|
/// </summary>
|
|
public string StatusColor => Status switch
|
|
{
|
|
"Error" => "#FF6347",
|
|
"Ended" => "#90EE90",
|
|
"Running" => "#87CEEB",
|
|
_ => "#EEEEEE"
|
|
};
|
|
|
|
/// <summary>
|
|
/// Returns true if the search has downloadable results.
|
|
/// </summary>
|
|
public bool HasResults => Status == "Ended";
|
|
|
|
/// <summary>
|
|
/// Returns true if the search is read-only (already submitted).
|
|
/// </summary>
|
|
public bool IsReadOnly => Status != "New";
|
|
}
|