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;
//
// This is here so CodeMaid doesn't reorganize this document
//
namespace LiMan.DB.DTO
{
///
/// DTO relativo alle info di ogni singolo applicativo
///
public class AppRelStatusDTO
{
///
/// CodApp Richiesta
///
public string CodApp { get; set; } = "";
///
/// CodInstall collegato
///
public string CodInst { get; set; } = "";
///
/// CodImpiego collegato
///
public string CodImp { get; set; } = "";
///
/// Licenza Updater
///
public int IdxLic { get; set; } = 0;
///
/// Codice cliente
///
public string Cliente { get; set; } = "";
///
/// Istanza Updater (PC)
///
public int IdxSubLic { get; set; } = 0;
///
/// PC/Installazione specifica
///
public string PcInst { get; set; } = "";
///
/// Conteggio del numero totale degli impieghi attivi (es conteggio IOB)
///
public int NumImp { get; set; } = 1;
///
/// Versione Installata
///
public string VersNumInstall { get; set; } = "0.0.0.0";
///
/// Versione Release corrente
///
public string VersNumCurrent { get; set; } = "0.0.0.0";
///
/// Status aggiornamento:
/// 4 = corrente, 4 blocchi uguali (0.0.0.0)
/// 3 = 3 uguali, cambia 4 blocco (0.0.0.x)
/// 2 = 2 uguali, cambia 3 blocco (0.0.x.x)
/// 1 = 1 uguali, cambia 2 blocco (0.x.x.x)
/// 0 = 0 uguali, cambia 1 blocco (x.x.x.x)
///
public int UpToDateStatus
{
get
{
int answ = 0;
if (VersNumCurrent == VersNumInstall)
{
answ = 4;
}
else
{
var tokInst = VersNumInstall.Split('.');
var tokCurr = VersNumCurrent.Split('.');
int numTok = tokCurr.Count();
// parto dal + basso ad assegnare punteggio...
for (int i = 0; i < numTok; i++)
{
// se diversi esco...
if (tokInst[i] != tokCurr[i])
{
break;
}
answ++;
}
}
return answ;
}
}
///
/// Data Ora ultimo controllo
///
public DateTime DtCheck { get; set; } = DateTime.Now;
}
}