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, /// /// Licenza LEgacy Steamware /// GLS, /// /// Master Key License, che ha una data di scadenza globale ed un token = numero di utenti/token massimi associati /// MasterKey, /// /// UserKey License (licenza che consuma un token utente della licenza master) - es GPW /// UserKey, /// /// Chiave tiupo Checksum basata su licenza masster + checksum MD5 di una serie di dati (child licenses) /// 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 } /// /// Oggetto Ticket /// public class TicketDTO { #region Public Properties /// /// Codice univoco della sub licenza (opzionale) /// public string CodImpiego { get; set; } = ""; /// /// Contatto email del cliente richiedente /// public string ContactEmail { get; set; } = ""; /// /// Contatto del cliente richiedente /// public string ContactName { get; set; } = ""; /// /// Contatto telefonico del cliente richiedente /// public string ContactPhone { get; set; } = ""; public DateTime DtReq { get; set; } = DateTime.Now; /// /// IDX licenza master /// public int IdxLic { get; set; } = 0; /// /// IDX licenza child (opzionale) /// public int IdxSubLic { get; set; } = 0; public int IdxTicket { get; set; } = 0; /// /// Motivazione della richiesta /// public string ReqBody { get; set; } = ""; /// /// Stato richiesta /// public StatoRichiesta Status { get; set; } = StatoRichiesta.ND; /// /// Risposta alla richiesta /// public string SupplAnsw { get; set; } = ""; /// /// Email del responsabile dell'azione (interno - supplier) /// public string SupplEmail { get; set; } = ""; /// /// Cod dell'user responsabile dell'azione (interno - supplier) /// public string SupplUserCode { get; set; } = ""; /// /// Tipologia di licenza gestita /// public TipoLicenza Tipo { get; set; } = TipoLicenza.UserKey; #endregion Public Properties } public class UserLicenseRequest { #region Public Properties public string MasterKey { get; set; } = ""; public Dictionary ParamDict { get; set; } = new Dictionary(); #endregion Public Properties } #endregion Public Classes } }