163 lines
4.1 KiB
C#
163 lines
4.1 KiB
C#
namespace LaaProduction.Cordonel.Models
|
|
{
|
|
using Newtonsoft.Json;
|
|
|
|
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
public class Cordonel_DELETE_EOL_Progress
|
|
{
|
|
[Range(1, int.MaxValue, ErrorMessage = "The PcbId should not be <= 0")]
|
|
public int PcbId { get; set; }
|
|
|
|
public string EditedBy { get; set; }
|
|
}
|
|
|
|
public class Cordonel_GET_EOL_Progress
|
|
{
|
|
[Range(1, int.MaxValue, ErrorMessage = "The PcbId should not be <= 0")]
|
|
public int PcbId { get; set; }
|
|
|
|
public string EditedBy { get; set; }
|
|
}
|
|
|
|
public class Cordonel_POST_EOL_Progress
|
|
{
|
|
[Range(1, int.MaxValue, ErrorMessage = "The PcbId should not be <= 0")]
|
|
public int PcbId { get; set; }
|
|
|
|
[Required(AllowEmptyStrings = false, ErrorMessage = "Complete status is required.")]
|
|
public Status Status { get; set; }
|
|
|
|
public string EditedBy { get; set; }
|
|
}
|
|
|
|
public class EOLProgressModel
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
[Range(1, int.MaxValue, ErrorMessage = "The PcbId should not be <= 0")]
|
|
public int PcbId { get; set; }
|
|
|
|
public DateTime? AddDate { get; set; }
|
|
|
|
public int? RequirementId { get; set; }
|
|
|
|
public Status RequirementChecked { get; set; }
|
|
|
|
public Status PasswordFileInstalled { get; set; }
|
|
|
|
public Status ProductionStatusChecked { get; set; }
|
|
|
|
public Status ParameterizationDone { get; set; }
|
|
|
|
public Status RebootDone { get; set; }
|
|
|
|
public Status StoreConfigurationDone { get; set; }
|
|
|
|
public Status ExportDone { get; set; }
|
|
|
|
public long? RaioCheckId { get; set; }
|
|
|
|
public DateTime? SentinelDate { get; set; }
|
|
|
|
public Status Completed { get; set; }
|
|
|
|
public DateTime? CompleteDate { get; set; }
|
|
|
|
public string EditedBy { get; set; }
|
|
}
|
|
|
|
public class JsonStatusConverter : JsonConverter<Status>
|
|
{
|
|
public override Status ReadJson(JsonReader reader, Type objectType, Status existingValue, bool hasExistingValue, JsonSerializer serializer)
|
|
{
|
|
return reader?.Value?.ToString();
|
|
}
|
|
|
|
public override void WriteJson(JsonWriter writer, Status value, JsonSerializer serializer)
|
|
{
|
|
writer.WriteValue(value?.ToString());
|
|
}
|
|
}
|
|
|
|
[JsonConverter(typeof(JsonStatusConverter))]
|
|
public class Status
|
|
{
|
|
private readonly Options? option;
|
|
|
|
private Status(Options? option)
|
|
{
|
|
this.option = option;
|
|
}
|
|
|
|
public enum Options
|
|
{
|
|
FAIL = -1,
|
|
NA = 0,
|
|
OK = 1,
|
|
}
|
|
|
|
public static Status NULL => null;
|
|
|
|
public static Status FAIL => Options.FAIL;
|
|
|
|
public static Status NA => Options.NA;
|
|
|
|
public static Status OK => Options.OK;
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{this.option}";
|
|
}
|
|
|
|
public static implicit operator Status (string _string)
|
|
{
|
|
var status = default(Status);
|
|
|
|
if (!string.IsNullOrWhiteSpace(_string) && Enum.TryParse(_string, out Options option))
|
|
{
|
|
status = new Status(option);
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
public static implicit operator Status(int _int)
|
|
{
|
|
switch (_int)
|
|
{
|
|
case -1: return FAIL;
|
|
case 0: return NA;
|
|
case 1: return OK;
|
|
default: return NULL;
|
|
}
|
|
}
|
|
|
|
public static implicit operator Status (Options? option)
|
|
{
|
|
if (option is null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return new Status(option);
|
|
}
|
|
|
|
public static implicit operator string(Status status)
|
|
{
|
|
return status?.ToString();
|
|
}
|
|
|
|
public static implicit operator int?(Status status)
|
|
{
|
|
return (int?)status?.option;
|
|
}
|
|
|
|
public static implicit operator Options? (Status status)
|
|
{
|
|
return status?.option;
|
|
}
|
|
}
|
|
}
|