Files
limanapp/LiMan.DB/DTO/AppRelStatusDTO.cs
2025-01-17 08:19:27 +01:00

115 lines
3.1 KiB
C#

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;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace LiMan.DB.DTO
{
/// <summary>
/// DTO relativo alle info di ogni singolo applicativo
/// </summary>
public class AppRelStatusDTO
{
/// <summary>
/// CodApp Richiesta
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// CodInstall collegato
/// </summary>
public string CodInst { get; set; } = "";
/// <summary>
/// CodImpiego collegato
/// </summary>
public string CodImp { get; set; } = "";
/// <summary>
/// Licenza Updater
/// </summary>
public int IdxLic { get; set; } = 0;
/// <summary>
/// Codice cliente
/// </summary>
public string Cliente { get; set; } = "";
/// <summary>
/// Istanza Updater (PC)
/// </summary>
public int IdxSubLic { get; set; } = 0;
/// <summary>
/// PC/Installazione specifica
/// </summary>
public string PcInst { get; set; } = "";
/// <summary>
/// Conteggio del numero totale degli impieghi attivi (es conteggio IOB)
/// </summary>
public int NumImp { get; set; } = 1;
/// <summary>
/// Versione Installata
/// </summary>
public string VersNumInstall { get; set; } = "0.0.0.0";
/// <summary>
/// Versione Release corrente
/// </summary>
public string VersNumCurrent { get; set; } = "0.0.0.0";
/// <summary>
/// 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)
/// </summary>
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;
}
}
/// <summary>
/// Data Ora ultimo controllo
/// </summary>
public DateTime DtCheck { get; set; } = DateTime.Now;
}
}