Files
mapo-core/Egw.Core/LiManObj.cs
T
2022-02-01 12:31:51 +01:00

221 lines
6.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Egw.Core
{
public class LiManObj
{
#region Public Enums
public enum StatoRichiesta
{
ND = 0,
Richiesta,
Valutazione,
Approvata,
Rifiutata
}
public enum TipoLicenza
{
ND = 0,
/// <summary>
/// Licenza LEgacy Steamware
/// </summary>
GLS,
/// <summary>
/// Master Key License, che ha una data di scadenza globale ed un token = numero di utenti/token massimi associati
/// </summary>
MasterKey,
/// <summary>
/// UserKey License (licenza che consuma un token utente della licenza master) - es GPW
/// </summary>
UserKey,
/// <summary>
/// Chiave tiupo Checksum basata su licenza masster + checksum MD5 di una serie di dati (child licenses)
/// </summary>
CheckSumKey
}
#endregion Public Enums
#region Public Classes
public class ApplicativoDTO
{
#region Public Properties
public string Chiave { get; set; } = "";
public string CodApp { get; set; } = "";
public string CodInst { get; set; } = "";
public DateTime DataEnigma { get; set; } = DateTime.Today.AddYears(-1);
public string Descrizione { get; set; } = "";
public string Enigma { get; set; } = "";
public int IdxLic { get; set; } = 0;
public bool IsActive
{
get => (Scadenza.Subtract(DateTime.Today).TotalDays > 0);
}
public bool Locked { get; set; } = false;
public int NumLicenze { get; set; } = 0;
public int NumLicenzeAttive { get; set; } = 0;
public string Payload { get; set; } = "";
public DateTime Scadenza { get; set; } = DateTime.Today.AddYears(-1);
public TipoLicenza Tipo { get; set; } = TipoLicenza.ND;
#endregion Public Properties
}
public class AttivazioneDTO
{
#region Public Properties
public string Chiave { get; set; } = "";
public string CodApp { get; set; } = "";
public string CodImpiego { get; set; } = "";
public string CodInst { get; set; } = "";
public string Descrizione { get; set; } = "";
public int IdxLic { get; set; } = 0;
public int IdxSubLic { get; set; } = 0;
public TipoLicenza Tipo { get; set; } = TipoLicenza.UserKey;
public DateTime VetoUnlock { get; set; } = DateTime.Today.AddMonths(2);
#endregion Public Properties
}
public class LicenseCoord
{
#region Public Properties
public string CodApp { get; set; } = "";
public string CodInst { get; set; } = "";
public string Enigma { get; set; } = "";
public string MasterKey { get; set; } = "";
#endregion Public Properties
}
public class SupportRequest
{
#region Public Properties
public string CodApp { get; set; } = "";
public string CodImp { get; set; } = "";
public string CodInst { get; set; } = "";
public string ContactEmail { get; set; } = "";
public string ContactName { get; set; } = "";
public string ContactPhone { get; set; } = "";
public int idxSubLic { get; set; } = 0;
public bool IsValid
{
get => !string.IsNullOrEmpty(MasterKey) && !string.IsNullOrEmpty(ContactName) && !string.IsNullOrEmpty(ContactEmail) && !string.IsNullOrEmpty(CodInst) && !string.IsNullOrEmpty(CodApp);
}
public string MasterKey { get; set; } = "";
public string ReqBody { get; set; } = "";
#endregion Public Properties
}
/// <summary>
/// Oggetto Ticket
/// </summary>
public class TicketDTO
{
#region Public Properties
/// <summary>
/// Codice univoco della sub licenza (opzionale)
/// </summary>
public string CodImpiego { get; set; } = "";
/// <summary>
/// Contatto email del cliente richiedente
/// </summary>
public string ContactEmail { get; set; } = "";
/// <summary>
/// Contatto del cliente richiedente
/// </summary>
public string ContactName { get; set; } = "";
/// <summary>
/// Contatto telefonico del cliente richiedente
/// </summary>
public string ContactPhone { get; set; } = "";
public DateTime DtReq { get; set; } = DateTime.Now;
/// <summary>
/// IDX licenza master
/// </summary>
public int IdxLic { get; set; } = 0;
/// <summary>
/// IDX licenza child (opzionale)
/// </summary>
public int IdxSubLic { get; set; } = 0;
public int IdxTicket { get; set; } = 0;
/// <summary>
/// Motivazione della richiesta
/// </summary>
public string ReqBody { get; set; } = "";
/// <summary>
/// Stato richiesta
/// </summary>
public StatoRichiesta Status { get; set; } = StatoRichiesta.ND;
/// <summary>
/// Risposta alla richiesta
/// </summary>
public string SupplAnsw { get; set; } = "";
/// <summary>
/// Email del responsabile dell'azione (interno - supplier)
/// </summary>
public string SupplEmail { get; set; } = "";
/// <summary>
/// Cod dell'user responsabile dell'azione (interno - supplier)
/// </summary>
public string SupplUserCode { get; set; } = "";
/// <summary>
/// Tipologia di licenza gestita
/// </summary>
public TipoLicenza Tipo { get; set; } = TipoLicenza.UserKey;
#endregion Public Properties
}
public class UserLicenseRequest
{
#region Public Properties
public string MasterKey { get; set; } = "";
public Dictionary<string, string> ParamDict { get; set; } = new Dictionary<string, string>();
#endregion Public Properties
}
#endregion Public Classes
}
}