Merge branch 'release/FixUpdatePipe_06'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>License Manager</i>
|
||||
<h4>Versione: 2.1.2512.0316</h4>
|
||||
<h4>Versione: 2.1.2512.0317</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.1.2512.0316
|
||||
2.1.2512.0317
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>2.1.2512.0316</version>
|
||||
<version>2.1.2512.0317</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -16,6 +16,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using static Core.Enum;
|
||||
|
||||
@@ -32,8 +33,6 @@ namespace LiMan.DB.Controllers
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Upsert record applicativo
|
||||
@@ -74,9 +73,11 @@ namespace LiMan.DB.Controllers
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se una applcazione abbia record correlati...
|
||||
/// </summary>
|
||||
@@ -255,27 +256,6 @@ namespace LiMan.DB.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista attivazioni x licenza
|
||||
/// </summary>
|
||||
/// <param name="idxLic"></param>
|
||||
/// <returns></returns>
|
||||
public List<SubLicenzaModel> AttivazioniGetByLic(int idxLic)
|
||||
{
|
||||
List<SubLicenzaModel> dbResult = new List<SubLicenzaModel>();
|
||||
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
|
||||
{
|
||||
DateTime oggi = DateTime.Today;
|
||||
var rawRes = localDbCtx
|
||||
.DbSetSubLicenze
|
||||
.Where(x => x.IdxLic == idxLic)
|
||||
.OrderBy(o => o.VetoUnlock)
|
||||
.ToList();
|
||||
dbResult = rawRes != null ? rawRes : dbResult;
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista attivazioni dati cod identificativi CodImp e AppKey
|
||||
/// </summary>
|
||||
@@ -297,6 +277,27 @@ namespace LiMan.DB.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista attivazioni x licenza
|
||||
/// </summary>
|
||||
/// <param name="idxLic"></param>
|
||||
/// <returns></returns>
|
||||
public List<SubLicenzaModel> AttivazioniGetByLic(int idxLic)
|
||||
{
|
||||
List<SubLicenzaModel> dbResult = new List<SubLicenzaModel>();
|
||||
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
|
||||
{
|
||||
DateTime oggi = DateTime.Today;
|
||||
var rawRes = localDbCtx
|
||||
.DbSetSubLicenze
|
||||
.Where(x => x.IdxLic == idxLic)
|
||||
.OrderBy(o => o.VetoUnlock)
|
||||
.ToList();
|
||||
dbResult = rawRes != null ? rawRes : dbResult;
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimino le licenze con veto scaduto
|
||||
/// </summary>
|
||||
@@ -741,6 +742,90 @@ namespace LiMan.DB.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica e ripulisce eventuali vecchie SubLic rimaste senza riferimento
|
||||
/// </summary>
|
||||
/// <param name="upRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> CheckCleanOldSubLic(InstalledReleasesModel upRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
|
||||
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
|
||||
{
|
||||
// cerco idxSublic da info...
|
||||
SubLicenzaModel recIst = localDbCtx
|
||||
.DbSetSubLicenze
|
||||
.FirstOrDefault(x => x.Chiave == upRec.AppKey);
|
||||
// se non fosse giusto CodImpiego e veto scaduto...
|
||||
if (!recIst.CodImpiego.Equals(upRec.CodApp))
|
||||
{
|
||||
// log disuguaglianza chiave
|
||||
Log.Info($"CheckOldSubLic | Mismatch licenza SubLic | CodApp: {upRec.CodApp} | AppKey: {upRec.AppKey} | App.CodImp: {upRec.CodImp} | Db.CodImp: {recIst.CodImpiego}");
|
||||
|
||||
// aggiorno CodImp se non bloccato...
|
||||
if (recIst.VetoUnlock <= DateTime.Now)
|
||||
{
|
||||
// salvo record variazione licenza
|
||||
LogCodImp recLogCodImp = new LogCodImp()
|
||||
{
|
||||
IdxLic = recIst.IdxLic,
|
||||
IdxSubLic = recIst.IdxSubLic,
|
||||
CodApp = upRec.CodApp,
|
||||
CodImpOld = recIst.CodImpiego,
|
||||
CodImpNew = upRec.CodImp,
|
||||
DtMod = DateTime.Now
|
||||
};
|
||||
localDbCtx
|
||||
.DbSetLogCodImp
|
||||
.Add(recLogCodImp);
|
||||
|
||||
// elimino righe vecchie
|
||||
var list2rem = localDbCtx
|
||||
.DbSetInstallRel
|
||||
.Where(x => x.CodApp == upRec.CodApp && x.CodImp == recIst.CodImpiego && x.AppKey == upRec.AppKey)
|
||||
.ToList();
|
||||
if (list2rem != null && list2rem.Count > 0)
|
||||
{
|
||||
// loggo i record che vado ad eliminare
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("---------- Eliminazione SubLic scadute ----------");
|
||||
foreach (var item in list2rem)
|
||||
{
|
||||
sb.AppendLine($"Eliminazione SubLic scaduta | IdxInstall: {item.IdxInstall} | CodImp: {item.CodImp} | Vers: {item.VersNum} | NumImp: {item.NumImp} | LastCheck: {item.DtCheck}");
|
||||
}
|
||||
sb.AppendLine("---------- Fine Elenco ----------");
|
||||
Log.Info(sb.ToString());
|
||||
|
||||
// elimino
|
||||
localDbCtx
|
||||
.DbSetInstallRel
|
||||
.RemoveRange(list2rem);
|
||||
}
|
||||
|
||||
// registro nuovo CodImpiego
|
||||
recIst.CodImpiego = upRec.CodImp;
|
||||
localDbCtx.Entry(recIst).State = EntityState.Modified;
|
||||
// salvataggio!
|
||||
try
|
||||
{
|
||||
// salvo
|
||||
var res = await localDbCtx.SaveChangesAsync();
|
||||
fatto = res != 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in CheckOldSubLic | IdxLic: {upRec.IdxLic} | CodApp: {upRec.CodApp} | VersNum: {upRec.VersNum} {Environment.NewLine}{ex}");
|
||||
}
|
||||
|
||||
// log update codImpiego
|
||||
Log.Info($"CheckOldSubLic | Aggiornamento SubLicenza | CodImp Aggiornato | CodApp: {upRec.CodApp} | AppKey: {upRec.AppKey} | App.CodImp: {upRec.CodImp} | Db.CodImp: {recIst.CodImpiego}");
|
||||
}
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
public bool DbForceMigrate()
|
||||
{
|
||||
bool answ = false;
|
||||
@@ -1571,7 +1656,6 @@ namespace LiMan.DB.Controllers
|
||||
.DbSetInstallRelHist
|
||||
.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
// salvataggio!
|
||||
try
|
||||
@@ -1620,7 +1704,7 @@ namespace LiMan.DB.Controllers
|
||||
if (currRec.IdxSubLic == 0)
|
||||
{
|
||||
// cerco idxSublic da info...
|
||||
var recIst = localDbCtx
|
||||
SubLicenzaModel recIst = localDbCtx
|
||||
.DbSetSubLicenze
|
||||
.FirstOrDefault(x => x.Chiave == upRec.AppKey && x.CodImpiego == upRec.CodImp);
|
||||
if (recIst != null)
|
||||
|
||||
@@ -1217,6 +1217,11 @@ namespace LiMan.DB.Services
|
||||
public bool InstallRelUpsert(InstalledReleasesModel upRec)
|
||||
{
|
||||
bool fatto = dbController.InstallRelUpsert(upRec);
|
||||
// se ok fa verifica sublicenze...
|
||||
if (fatto)
|
||||
{
|
||||
dbController.CheckCleanOldSubLic(upRec);
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>License Manager</i>
|
||||
<h4>Versione: 2.1.2512.0316</h4>
|
||||
<h4>Versione: 2.1.2512.0317</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.1.2512.0316
|
||||
2.1.2512.0317
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>2.1.2512.0316</version>
|
||||
<version>2.1.2512.0317</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.Transfer.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>2.1.2512.0316</Version>
|
||||
<Version>2.1.2512.0317</Version>
|
||||
<RootNamespace>LiMan.UI</RootNamespace>
|
||||
<AssemblyName>LiMan.UI</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>License Manager</i>
|
||||
<h4>Versione: 2.1.2512.0316</h4>
|
||||
<h4>Versione: 2.1.2512.0317</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.1.2512.0316
|
||||
2.1.2512.0317
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>2.1.2512.0316</version>
|
||||
<version>2.1.2512.0317</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user