From 5d319b750be223cc1b664933f4e5f3c72a4e04fe Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 16 Sep 2024 11:32:21 +0200 Subject: [PATCH] Completata revisione gesstione cert malattia da ADM nuovo --- .../Components/Compo/RegMalattia.razor.cs | 2 +- GPW.CORE.ADM/GPW.CORE.ADM.csproj | 2 +- GPW.CORE.Data/Controllers/GPWController.cs | 50 ++++++++++++---- GPW.CORE.Data/Services/GpwDataService.cs | 59 +++++++++++++++++++ Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 7 files changed, 103 insertions(+), 16 deletions(-) diff --git a/GPW.CORE.ADM/Components/Compo/RegMalattia.razor.cs b/GPW.CORE.ADM/Components/Compo/RegMalattia.razor.cs index 199104f..4a48fbe 100644 --- a/GPW.CORE.ADM/Components/Compo/RegMalattia.razor.cs +++ b/GPW.CORE.ADM/Components/Compo/RegMalattia.razor.cs @@ -169,7 +169,7 @@ namespace GPW.CORE.ADM.Components.Compo sendDataVal = 5; sendDataNextVal = 90; await Task.Delay(1); - await GDataServ.RegMalattieUpsert(currRecord); + await GDataServ.RegMalattieAppRif(currRecord); // effettuo insert... sendDataVal = 100; sendDataNextVal = 100; diff --git a/GPW.CORE.ADM/GPW.CORE.ADM.csproj b/GPW.CORE.ADM/GPW.CORE.ADM.csproj index e856a39..a910fca 100644 --- a/GPW.CORE.ADM/GPW.CORE.ADM.csproj +++ b/GPW.CORE.ADM/GPW.CORE.ADM.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 4.1.2409.1610 + 4.1.2409.1611 diff --git a/GPW.CORE.Data/Controllers/GPWController.cs b/GPW.CORE.Data/Controllers/GPWController.cs index 7766fd9..0676d82 100644 --- a/GPW.CORE.Data/Controllers/GPWController.cs +++ b/GPW.CORE.Data/Controllers/GPWController.cs @@ -1474,14 +1474,14 @@ namespace GPW.CORE.Data.Controllers using (GPWContext localDbCtx = new GPWContext(_configuration)) { SqlParameter parInizio = new SqlParameter("@inizio", inizio); - SqlParameter parFine = new SqlParameter("@pCodGiust", fine); + SqlParameter parFine = new SqlParameter("@pCodCert", fine); SqlParameter parNotOkApp = new SqlParameter("@notOkApp", notOkApp); SqlParameter parNotOkTim = new SqlParameter("@notOkTim", notOkTim); SqlParameter parNotOkLav = new SqlParameter("@notOkLav", notOkLav); var rawResult = localDbCtx .DbSetDipAndAnom - .FromSqlRaw("EXEC stp_DipendentiAndAnomalie @inizio,@pCodGiust,@notOkApp,@notOkTim,@notOkLav", parInizio, parFine, parNotOkApp, parNotOkTim, parNotOkLav) + .FromSqlRaw("EXEC stp_DipendentiAndAnomalie @inizio,@pCodCert,@notOkApp,@notOkTim,@notOkLav", parInizio, parFine, parNotOkApp, parNotOkTim, parNotOkLav) .ToList(); if (rawResult == null) { @@ -1944,12 +1944,12 @@ namespace GPW.CORE.Data.Controllers { var idxDipendente = new SqlParameter("@IdxDip", idxDip); var inizio = new SqlParameter("@inizio", dataStart); - var fine = new SqlParameter("@pCodGiust", dataEnd); + var fine = new SqlParameter("@pCodCert", dataEnd); var maxRes = new SqlParameter("@maxRes", maxResult); dbResult = localDbCtx .DbSetParetoRegAtt - .FromSqlRaw("EXEC stp_freqProjByDipPeriodo @IdxDip, @inizio,@pCodGiust,@maxRes", idxDipendente, inizio, fine, maxRes) + .FromSqlRaw("EXEC stp_freqProjByDipPeriodo @IdxDip, @inizio,@pCodCert,@maxRes", idxDipendente, inizio, fine, maxRes) .ToList(); } return dbResult; @@ -2203,6 +2203,37 @@ namespace GPW.CORE.Data.Controllers return answ; } + /// + /// Aggiorna record registro malattie approvando o rifiutando la richiesta e gestendo i + /// giustificativi associati Da impiegare con pagiina ADM + /// + /// + public bool RegMalattieAppRif(RegMalattieModel currItem) + { + bool answ = false; + using (GPWContext localDbCtx = new GPWContext(_configuration)) + { + try + { + // versione stored-based che sistema tutti i record dipendenti + SqlParameter pIdxRich = new SqlParameter("@Original_IdxRegMal", currItem.IdxRegMal); + SqlParameter pCodCert = new SqlParameter("@CodCert", currItem.CodCert); + SqlParameter pNumGG = new SqlParameter("@NumGG", currItem.NumGG); + SqlParameter pConf = new SqlParameter("@Conf", currItem.Conf); + + int result = localDbCtx + .Database + .ExecuteSqlRaw("EXEC stp_RM_updateQuery @Original_IdxRegMal, @CodCert, @NumGG, @Conf", pIdxRich, pCodCert, pNumGG, pConf); + answ = result != 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione in RegMalattieAppRif{Environment.NewLine}{exc}"); + } + } + return answ; + } + /// /// Elimina record registro malattie (SE non confermato) /// @@ -2357,7 +2388,6 @@ namespace GPW.CORE.Data.Controllers .Add(currItem); } - localDbCtx.SaveChanges(); answ = true; } @@ -2370,8 +2400,8 @@ namespace GPW.CORE.Data.Controllers } /// - /// Aggiorna record registro richieste approvando o rifiutando la richiesta e gestendo i giustificativi associati - /// Da impiegare con pagiina ADM + /// Aggiorna record registro richieste approvando o rifiutando la richiesta e gestendo i + /// giustificativi associati Da impiegare con pagiina ADM /// /// public bool RegRichiesteAppRif(RegRichiesteModel currItem) @@ -2391,7 +2421,6 @@ namespace GPW.CORE.Data.Controllers .Database .ExecuteSqlRaw("EXEC stp_RR_updateQuery @Original_IdxRegRich, @Conf, @CodGiust, @Note", pIdxRich, pConf, pCodGiust, pNote); answ = result != 0; - } catch (Exception exc) { @@ -2467,7 +2496,6 @@ namespace GPW.CORE.Data.Controllers { try { - var currRec = localDbCtx .DbSetRegRichieste .FirstOrDefault(x => x.IdxRegRich == currItem.IdxRegRich); @@ -2702,11 +2730,11 @@ namespace GPW.CORE.Data.Controllers { SqlParameter parIdxDip = new SqlParameter("@IdxDip", idxDipendente); SqlParameter parInizio = new SqlParameter("@inizio", inizio); - SqlParameter parFine = new SqlParameter("@pCodGiust", fine); + SqlParameter parFine = new SqlParameter("@pCodCert", fine); dbResult = localDbCtx .DbSetTimbratureExpl - .FromSqlRaw("EXEC stp_timbratureExpl_getContinuato @IdxDip,@inizio,@pCodGiust", parIdxDip, parInizio, parFine) + .FromSqlRaw("EXEC stp_timbratureExpl_getContinuato @IdxDip,@inizio,@pCodCert", parIdxDip, parInizio, parFine) .ToList(); } return dbResult; diff --git a/GPW.CORE.Data/Services/GpwDataService.cs b/GPW.CORE.Data/Services/GpwDataService.cs index b417602..b38e6f1 100644 --- a/GPW.CORE.Data/Services/GpwDataService.cs +++ b/GPW.CORE.Data/Services/GpwDataService.cs @@ -2171,6 +2171,65 @@ namespace GPW.CORE.Data.Services return dbResult; } + /// + /// Registra o aggiorna record registro malattie + /// + /// + /// + public async Task RegMalattieAppRif(RegMalattieModel currItem) + { + bool answ = false; + try + { + // scrivo su DB + answ = dbController.RegMalattieAppRif(currItem); + if (answ) + { + // recupero info dipendente + var listDip = await DipendentiGetAll(); + var currDip = listDip.FirstOrDefault(x => x.IdxDipendente == currItem.IdxDipendente); + // gestisco email notifica... + string emailDest = _configuration.GetValue("MailDest:InfoMal") ?? "info@egalware.com"; + if (!emailDest.Contains(currDip.Email)) + { + emailDest += $",{currDip.Email}"; + } + if (currDip.idxResp > 0) + { + string mailResp = await emailResp(currDip.idxResp); + if (!string.IsNullOrEmpty(mailResp) && !emailDest.Contains(mailResp)) + { + emailDest += $",{mailResp}"; + } + } + string urlRedir = _configuration.GetValue("AdmApp:LinkMal") ?? ""; + StringBuilder sbMain = new StringBuilder(); + DateTime adesso = DateTime.Now; + sbMain.AppendLine($"Il giorno {adesso:yyyy.MM.dd} alle ore {adesso:HH:mm:ss} รจ stato inserito/modificato un record di registrazione malattia"); + sbMain.AppendLine(""); + sbMain.Append("
"); + sbMain.Append($"{currDip.Cognome} {currDip.Nome} ({currDip.Matricola})"); + sbMain.Append("
"); + sbMain.AppendLine("
"); + string stato = currItem.Conf ? "CONFERMATA" : "RICHIESTA"; + sbMain.AppendLine($"Stato: {stato}"); + sbMain.AppendLine($"Data Inizio: {currItem.DtInizio}"); + sbMain.AppendLine($"Numero Giorni: {currItem.NumGG}"); + sbMain.AppendLine($"Certificato: {currItem.CodCert}"); + sbMain.AppendLine("
"); + sbMain.AppendLine($"Cliccare sul seguente link per accedere alla pagina di gestione"); + + string msgBody = sbMain.ToString(); + await sendEmail(emailDest, "Aggiornamento record Malattia Dipendente", msgBody.Replace($"{Environment.NewLine}", "
")); + } + // invalido la cache... + await ExecFlushRedisPattern($"{rKeyDipendenti}:*"); + } + catch + { } + return answ; + } + /// /// Registra o aggiorna record registro malattie /// diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 5d90c44..cdb2134 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GPW - Gestione Presenze Web -

Versione: 4.1.2409.1610

+

Versione: 4.1.2409.1611


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 42392f2..a91c292 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -4.1.2409.1610 +4.1.2409.1611 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 79d7a06..c2dd997 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 4.1.2409.1610 + 4.1.2409.1611 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false