diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index e6c65cb3..cae8eef3 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -125,6 +125,42 @@ namespace MP.Data.Controllers return fatto; } + /// + /// modifica di un record magazzino + /// + /// + public async Task UpdateMag(AnagMagModel magRec) + { + bool fatto = false; + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + try + { + var dbResult = + dbCtx + .DbAnagMag + .AsNoTracking() + .Where(x => x.MagID == magRec.MagID) + .FirstOrDefault(); + if (dbResult != null) + { + if (dbResult.DescMag != magRec.DescMag) + { + dbResult.DescMag = magRec.DescMag.ToUpper(); + dbCtx.Entry(dbResult).State = EntityState.Modified; + } + } + await dbCtx.SaveChangesAsync(); + fatto = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante UpdateMag{Environment.NewLine}{exc}"); + } + } + return fatto; + } + /// /// delete magazzino /// diff --git a/MP.INVE/Components/MagList.razor b/MP.INVE/Components/MagList.razor index d8a0cec8..f3ac97a6 100644 --- a/MP.INVE/Components/MagList.razor +++ b/MP.INVE/Components/MagList.razor @@ -1,5 +1,6 @@ @if (reqNew) { +
@@ -15,13 +16,27 @@
Codice magazzino - + @if (mod) + { + + } + else + { + + }
-
+
Descrizione - + @if (mod) + { + + } + else + { + + }
@@ -42,6 +57,15 @@
} + @if (mod) + { + @if (!currMag.DescMag.Contains("NON USARE")) + { +
+ +
+ } + }
@@ -79,8 +103,8 @@ @item.DescMag - diff --git a/MP.INVE/Components/MagList.razor.cs b/MP.INVE/Components/MagList.razor.cs index 9f41e6b6..4b2b22f0 100644 --- a/MP.INVE/Components/MagList.razor.cs +++ b/MP.INVE/Components/MagList.razor.cs @@ -54,10 +54,13 @@ namespace MP.INVE.Components { reqNew = false; codMag = ""; + mod = false; desc = ""; } private List? elencoMagazzini; private List? SearchRecords; + private AnagMagModel currMag { get; set; } = null!; + private bool mod { get; set; } = false; private async Task insertNewMag() { var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler creare un nuovo magazzino?"); @@ -95,15 +98,27 @@ namespace MP.INVE.Components await Task.Delay(1); isLoading = false; } - private async Task deleteMag(AnagMagModel mag) + private async Task modMag(AnagMagModel mag) { - var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler eliminare il magazzino selezionato?"); + var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler modificare il magazzino selezionato?"); if (alert) { - await MIDataservice.DeleteMag(mag); - NavManager.NavigateTo("Elencomagazzini", true); + + await MIDataservice.UpdateMag(currMag); + NavManager.NavigateTo(NavManager.Uri, true); await reloadData(); } + else + { + closeNew(); + } + } + private async Task reqModMag(AnagMagModel mag) + { + await Task.Delay(1); + mod = true; + reqNew = true; + currMag = mag; } private bool reqNew { diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index ead59261..bcd79e69 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -113,6 +113,21 @@ namespace MP.INVE.Data return result; // aggiungo record al DB } + public async Task UpdateMag(AnagMagModel Mag) + { + bool result = false; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + result = await dbController.UpdateMag(Mag); + // elimino cache redis... + RedisValue pattern = new RedisValue($"{redisMagList}"); + bool answ = await ExecFlushRedisPattern(pattern); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"UpdateMag | Codice magazzino: {Mag.CodMag} | Descrizione magazzino: {Mag.DescMag} | {ts.TotalMilliseconds}ms"); + return result; + // aggiungo record al DB + } public async Task DeleteMag(AnagMagModel Mag) { bool result = false; diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index ee51c709..89270117 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2211.2110 + 6.16.2211.2112 diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 1f572910..6508fb1f 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2211.2110

+

Versione: 6.16.2211.2112


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 297be395..264c3829 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2110 +6.16.2211.2112 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 53362599..7b8d894f 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2110 + 6.16.2211.2112 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false