using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DB.DBModels
{
[Table("InstalledReleases")]
public partial class InstalledReleasesModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxInstall { get; set; }
///
/// CodApp Richiesta
///
[MaxLength(50)]
public string CodApp { get; set; } = "";
///
/// Master Key
///
[MaxLength(500)]
public string MastKey { get; set; } = "";
///
/// Codice Impiego Istanza (SubLic)
///
[MaxLength(500)]
public string CodImp { get; set; } = "";
///
/// Chiave SubLic
///
[MaxLength(500)]
public string AppKey { get; set; } = "";
///
/// Versione applicativo formato semver numerico 4 blocchi
///
[MaxLength(50)]
public string VersNum { get; set; } = "0.0.0.0";
///
/// Numero impieghi dell'applicativo (es per MAPO IOB-WIN il num di iOB usati con uno specifico SW)
///
public int NumImp { get; set; } = 1;
///
/// Data di ultima verifica versione
///
public DateTime DtCheck { get; set; } = DateTime.Today.AddYears(-1);
///
/// Licenza associata
///
public int IdxLic { get; set; } = 0;
///
/// Istanza (SubLic) associata
///
public int IdxSubLic { get; set; } = 0;
///
/// Versione (calcolata) a partire dal valore Num
///
[NotMapped]
public Version VersVal
{
get
{
Version answ = new Version();
try
{
// solo se è una versione valida: SemVer = 2/3 punti
int numPunti = VersNum.Length - VersNum.Replace(".", "").Length;
if (numPunti >= 2 && numPunti <= 3)
{
answ = !string.IsNullOrEmpty(VersNum) ? new Version(VersNum) : new Version();
}
}
catch { }
return answ;
}
}
[ForeignKey("CodApp")]
public virtual ApplicativoModel ApplicativoNav { get; set; }
[ForeignKey("IdxLic")]
public virtual LicenzaModel? LicenzaNav { get; set; }
}
}