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 { // // This is here so CodeMaid doesn't reorganize this document // //[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))] [Table("LogLicenze")] public partial class LogLicenzaModel { #region Public Properties [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int IdxLogLic { 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 string Chiave { get; set; } public int IdxLic { get; set; } = 0; public TipoLicenza Tipo { get; set; } = TipoLicenza.ND; [NotMapped] public bool Locked { get; set; } = true; [NotMapped] public string ChiaveCalc { get { return Core.licenseManGLS.getAuthKey(CodInst, CodApp, NumLicenze, Scadenza); } } [NotMapped] public bool IsActive { get => (Scadenza.Subtract(DateTime.Today).TotalDays > 0); } [NotMapped] public bool IsValid { get => Chiave.Equals(ChiaveCalc); } [ForeignKey("IdxLic")] public virtual LicenzaModel LicenzaNav { get; set; } [ForeignKey("CodInst")] public virtual InstallazioneModel InstallazioneNav{ get; set; } [ForeignKey("CodApp")] public virtual ApplicativoModel ApplicativoNav { get; set; } #endregion Public Properties } }