diff --git a/MagMan.Data.Tenant/Controllers/TenantController.cs b/MagMan.Data.Tenant/Controllers/TenantController.cs
index 9c83fc1..5442ea4 100644
--- a/MagMan.Data.Tenant/Controllers/TenantController.cs
+++ b/MagMan.Data.Tenant/Controllers/TenantController.cs
@@ -1499,6 +1499,49 @@ namespace MagMan.Data.Tenant.Controllers
return numMod;
}
+ ///
+ /// Update record Project + refresh cache x info archived
+ ///
+ /// Stringa connessione (variabile x cliente)
+ /// IDizionario ProdId / IsArchived da impostare
+ /// Esito update
+ public bool ProjectUpdArchived(string connString, Dictionary newData)
+ {
+ bool fatto = false;
+ using (MagManContext dbCtx = new MagManContext(connString))
+ {
+ try
+ {
+ DateTime adesso = DateTime.Now;
+ foreach (var item in newData)
+ {
+ /*
+ * Ricerca:
+ * - DbId corrisponde e > 0...
+ * */
+ var currData = dbCtx
+ .DbSetProjects
+ .Where(x => (item.Key > 0 && x.ProjDbId == item.Key))
+ .FirstOrDefault();
+ if (currData != null)
+ {
+ currData.IsArchived = item.Value;
+ currData.DtLastAction = adesso;
+ dbCtx.Entry(currData).State = EntityState.Modified;
+ }
+ }
+ var done = dbCtx.SaveChanges();
+ // registro esito ok
+ fatto = done > 0;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione in ProjectUpdArchived{Environment.NewLine}{exc}");
+ }
+ }
+ return fatto;
+ }
+
#endregion Public Methods
#region Private Fields
diff --git a/MagMan.Data.Tenant/Services/TenantService.cs b/MagMan.Data.Tenant/Services/TenantService.cs
index 02b378f..b3643b1 100644
--- a/MagMan.Data.Tenant/Services/TenantService.cs
+++ b/MagMan.Data.Tenant/Services/TenantService.cs
@@ -1322,6 +1322,31 @@ namespace MagMan.Data.Tenant.Services
return fatto;
}
+ ///
+ /// Update record Project + refresh cache x info archived
+ ///
+ /// Key di riferimento
+ /// IDizionario ProdId / IsArchived da impostare
+ /// Bool aggiornamento
+ public async Task ProjectUpdArchived(int nKey, Dictionary newData)
+ {
+ bool fatto = false;
+ string cString = ConnString(nKey);
+ try
+ {
+ fatto = dbController.ProjectUpdArchived(cString, newData);
+ if (fatto)
+ {
+ await FlushRedisCache();
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error during ProjectUpdArchived:{Environment.NewLine}{exc}");
+ }
+ return fatto;
+ }
+
///
/// Converte il DTO in ItemModel
///
diff --git a/MagMan.UI/Controllers/ProjectsController.cs b/MagMan.UI/Controllers/ProjectsController.cs
index 5c50485..08dc9ed 100644
--- a/MagMan.UI/Controllers/ProjectsController.cs
+++ b/MagMan.UI/Controllers/ProjectsController.cs
@@ -118,7 +118,7 @@ namespace MagMan.UI.Controllers
// in primis recupero codice chiave da token...
int nKey = await MTAdmService.MainKeyByToken(id);
// formato decodifica stringa DateTime
- string format = "yyyyMMddHHmmss";
+ string format = "yyyyMMddHHmmss";
CultureInfo provider = CultureInfo.InvariantCulture;
DateTime dtRif = DateTime.Now;
try
@@ -147,6 +147,7 @@ namespace MagMan.UI.Controllers
[HttpPost("proj-arch-send/{id}")]
public async Task ProjArchivedSend(string id, [FromBody] RestPayload.ProjStatusData rawData)
{
+ // attenzione: si potrebbe dover verificare la data-ora modifica (per ogni record) x decidere update e/o
bool answ = false;
// verifico ci sia valore da processare
if (!string.IsNullOrEmpty(id) && rawData != null)
@@ -155,25 +156,22 @@ namespace MagMan.UI.Controllers
int nKey = await MTAdmService.MainKeyByToken(id);
if (nKey > 0)
{
-#if false
- // recupero il tipo di info comprese
- if (rawData.ProjectProgress != null)
+ // processo update!
+ if (rawData.ProjStatusList != null)
{
- var cRec = rawData.ProjectProgress;
try
{
- answ = await TService.ProjectSetProgr(nKey, cRec.ProjCloudId, cRec.ProcTimeReal, cRec.ValAct, cRec.ValMax);
+ answ = await TService.ProjectUpdArchived(nKey, rawData.ProjStatusList);
}
catch (Exception exc)
{
- Log.Error($"ProjectsController.upsert | Errore in fase salvataggio ProjectDTO{Environment.NewLine}{exc}");
+ Log.Error($"ProjectsController.ProjArchivedSend | Errore in fase update stato archived per {rawData.ProjStatusList.Count} rec{Environment.NewLine}{exc}");
}
// resetto cache redis
await MTAdmService.FlushRedisCache();
// broadcast update via redis, indico nKey x update puntuale
MService.QueUpdProj.sendMessage($"{nKey}");
- }
-#endif
+ }
}
}
return answ;
diff --git a/MagMan.UI/MagMan.UI.csproj b/MagMan.UI/MagMan.UI.csproj
index 62f7720..bfc8c99 100644
--- a/MagMan.UI/MagMan.UI.csproj
+++ b/MagMan.UI/MagMan.UI.csproj
@@ -2,7 +2,7 @@
net6.0
- 1.0.2407.1709
+ 1.0.2407.1710
enable
enable
true
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index a5b15d8..2f23fa2 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
MagMan - Wood Warehouse Management System
- Versione: 1.0.2407.1709
+ Versione: 1.0.2407.1710
Note di rilascio:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index 908e4a6..d7870a6 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-1.0.2407.1709
+1.0.2407.1710
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index 483588c..2d0bd75 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 1.0.2407.1709
+ 1.0.2407.1710
http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip
http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html
false