Update metodo controller x sync stato archiviato

This commit is contained in:
Samuele Locatelli
2024-07-17 10:21:13 +02:00
parent 1319496e52
commit 5f4e85df07
7 changed files with 79 additions and 13 deletions
+7 -9
View File
@@ -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<bool> 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;