Files
2024-07-15 17:40:48 +02:00

154 lines
4.1 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Liman.CadCam.DbModel
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("LicenceTable")]
public class LicenceModel
{
/// <summary>
/// ID su DB
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int LicenceID { get; set; } = 0;
/// <summary>
/// Key Prodotto
/// </summary>
public int ProductID { get; set; } = 0;
public int ProductVersion { get; set; } = 0;
public int ProductLevel { get; set; } = 0;
public DateTime? ProductDeadline { get; set; } = DateTime.MinValue;
[NotMapped]
public bool IsDefinitiva
{
get => ProductDeadline.HasValue && ProductDeadline > new DateTime(2099, 01, 01);
}
[NotMapped]
public string CssDefinitiva
{
get
{
string answ = "text-dark";
if (ProductDeadline.HasValue && ProductDeadline > new DateTime(2099, 01, 01))
{
answ = "text-success";
}
else if (ProductDeadline.HasValue && ProductDeadline > DateTime.Today)
{
answ = "text-warning";
}
else
{
answ = "text-danger";
}
return answ;
}
}
public int Option1 { get; set; } = 0;
public int Option2 { get; set; } = 0;
public DateTime? OptionDeadline { get; set; } = DateTime.MinValue;
public string? LockID { get; set; } = "";
public string? File { get; set; } = "";
/// <summary>
/// Data creazione
/// </summary>
public DateTime Date { get; set; } = DateTime.MinValue;
[NotMapped]
public DateTime DtScadenza
{
get => Date.AddYears(1);
}
[NotMapped]
public string CssScad
{
get => Date.AddYears(1) > DateTime.Today ? "text-success" : "text-danger";
}
public string? LicFile { get; set; } = "";
public string? Note { get; set; } = "";
public string? NestKey { get; set; } = "";
public DateTime? NestDeadline { get; set; } = DateTime.MinValue;
[ForeignKey("ProductID")]
public virtual ProductModel ProdNav { get; set; } = null!;
public override bool Equals(object? obj)
{
if (obj == null)
return false;
if (!(obj is LicenceModel item))
return false;
if (LicenceID != item.LicenceID)
return false;
if (ProductID != item.ProductID)
return false;
if (ProductVersion != item.ProductVersion)
return false;
if (ProductLevel != item.ProductLevel)
return false;
if (ProductDeadline != item.ProductDeadline)
return false;
if (Option1 != item.Option1)
return false;
if (Option2 != item.Option2)
return false;
if (OptionDeadline != item.OptionDeadline)
return false;
if (LockID != item.LockID)
return false;
if (File != item.File)
return false;
if (Date != item.Date)
return false;
if (LicFile != item.LicFile)
return false;
if (Note != item.Note)
return false;
if (NestKey != item.NestKey)
return false;
if (NestDeadline != item.NestDeadline)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}