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("InstalledReleasesHistory")]
public partial class InstalledReleasesHistoryModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxInstRelHist { get; set; }
///
/// Data di riferimento campionamento
///
public DateTime DtRif { get; set; } = DateTime.Today;
///
/// CodApp Richiesta
///
[MaxLength(50)]
public string CodApp { get; set; } = "";
///
/// Versione applicativo formato semver numerico 4 blocchi
///
[MaxLength(50)]
public string VersNum { get; set; } = "0.0.0.0";
///
/// Numero Copie Installate dell'applicativo
///
public int NumInst { get; set; } = 1;
///
/// Numero Impieghi dell'applicativo (es per MAPO IOB-WIN il num di iOB usati con uno specifico SW)
///
public int NumImp { get; set; } = 1;
///
/// Numero Installazioni con score 4 (tutti valori rel correnti M.m.r.b)
///
public int NumIS4 { get; set; } = 0;
///
/// Numero Installazioni con score 3 (3 valori rel correnti M.m.r.x)
///
public int NumIS3 { get; set; } = 0;
///
/// Numero Installazioni con score 2 (2 valori rel correnti M.m.x.x)
///
public int NumIS2 { get; set; } = 0;
///
/// Numero Installazioni con score 1 (3 valori rel correnti M.x.x.x)
///
public int NumIS1 { get; set; } = 0;
///
/// Numero Installazioni con score 0 (0 valori rel correnti x.x.x.x)
///
public int NumIS0 { 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; }
}
}