Files

80 lines
2.2 KiB
C#

using Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static Core.Enum;
#nullable disable
namespace LiMan.DB.DBModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
[Table("Licenze")]
public partial class LicenzaModel
{
#region Public Properties
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxLic { get; set; }
public string CodApp { get; set; }
public string CodInst { get; set; }
public int NumLicenze { get; set; } = 0;
public string Descrizione { get; set; }
public DateTime Scadenza { get; set; } = DateTime.Today.AddYears(-1);
public TipoLicenza Tipo { get; set; } = TipoLicenza.ND;
public string Chiave { get; set; }
public DateTime DataEnigma { get; set; }
public string Enigma { get; set; }
public string Payload { get; set; }
public bool Locked { get; set; } = false;
[NotMapped]
public string ChiaveCalc
{
get
{
return Core.licenseManGLS.getAuthKey(CodInst, CodApp, NumLicenze, Scadenza);
}
}
[NotMapped]
public string PayloadCalc
{
get
{
return Core.SteamCrypto.EncryptString(Payload, Enigma);
}
}
[NotMapped]
public bool IsActive
{
get => (Scadenza.Subtract(DateTime.Today).TotalDays > 0);
}
[NotMapped]
public bool IsValid
{
get => Chiave.Equals(ChiaveCalc);
}
[ForeignKey("CodApp")]
public virtual ApplicativoModel ApplicativoNav{ get; set; }
[ForeignKey("CodInst")]
public virtual InstallazioneModel InstallazioneNav{ get; set; }
public virtual ICollection<SubLicenzaModel> Attivazioni { get; set; }
public virtual ICollection<TicketModel> Tickets { get; set; }
#endregion Public Properties
}
}