diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 57f6d6b7..c64c745b 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -31,6 +31,7 @@ namespace MP.Data.Controllers { return AnagGruppiGetTipo("AZIENDA"); } + /// /// Elenco Gruppi tipo Fasi /// @@ -402,6 +403,36 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Eliminazione Record + /// + /// + /// + public async Task PODLDeleteRecord(DatabaseModels.PODLModel currRec) + { + bool fatto = false; + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + var currVal = dbCtx + .DbSetPODL + .Where(x => x.IdxPromessa == currRec.IdxPromessa) + .FirstOrDefault(); + dbCtx + .DbSetPODL + .Remove(currVal); + await dbCtx.SaveChangesAsync(); + fatto = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante PODLDeleteRecord{Environment.NewLine}{exc}"); + } + } + return fatto; + } + /// /// Update Record /// diff --git a/MP.SPEC/Components/ListPODL.razor b/MP.SPEC/Components/ListPODL.razor index f3f42f4f..f6e3c908 100644 --- a/MP.SPEC/Components/ListPODL.razor +++ b/MP.SPEC/Components/ListPODL.razor @@ -50,10 +50,10 @@ else @record.Note - @*@if (ArticoloDelEnabled(record.CodArticolo)) - { - - }*@ + @if (POdlDelEnabled(record.IdxOdl)) + { + + } } diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index 7dc836fb..51023f56 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -40,11 +40,33 @@ namespace MP.SPEC.Components await RecordSel.InvokeAsync(null); } + protected bool POdlDelEnabled(int idxOdl) + { + return idxOdl == 0; + } + protected async Task selRecord(PODLModel selRec) { await RecordSel.InvokeAsync(selRec); } + + /// + /// Eliminazione record selezioanto (previa conferma) + /// + /// + /// + protected async Task deleteRecord(PODLModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", "Eliminazione Record: sei sicuro di voler procedere?")) + return; + await Task.Delay(1); + var done = await MDService.PODLDeleteRecord(selRec); + currRecord = null; + await reloadData(); + await Task.Delay(1); + } + #endregion Public Methods #region Protected Properties @@ -168,7 +190,7 @@ namespace MP.SPEC.Components } - private List? ListStati; + private List? ListStati; private async Task reloadData() { diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 9e055ad3..539e8d88 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -294,15 +294,16 @@ namespace MP.SPEC.Data } /// - /// Restitusice elenco aziende + /// Restitusice elenco aziende /// /// public Task> ElencoAziende() { return Task.FromResult(dbController.AnagGruppiAziende()); } + /// - /// Restitusice elenco fasi + /// Restitusice elenco fasi /// /// public Task> ElencoGruppiFase() @@ -402,6 +403,16 @@ namespace MP.SPEC.Data return result; } + /// + /// Eliminazione record selezionato + /// + /// + /// + public async Task PODLDeleteRecord(PODLModel currRec) + { + return await dbController.PODLDeleteRecord(currRec); + } + /// /// Aggiornamento record selezionato /// diff --git a/MP.SPEC/Pages/Articoli.razor b/MP.SPEC/Pages/Articoli.razor index 14fdb2d8..f4c1a9ff 100644 --- a/MP.SPEC/Pages/Articoli.razor +++ b/MP.SPEC/Pages/Articoli.razor @@ -9,7 +9,7 @@
-

Articoli

+

Articoli

diff --git a/MP.SPEC/Pages/ODL.razor b/MP.SPEC/Pages/ODL.razor index 55146fa2..c99f8b4d 100644 --- a/MP.SPEC/Pages/ODL.razor +++ b/MP.SPEC/Pages/ODL.razor @@ -6,7 +6,7 @@
-

ODL

+

ODL

diff --git a/MP.SPEC/Pages/PODL.razor b/MP.SPEC/Pages/PODL.razor index e14e2121..17ca1c84 100644 --- a/MP.SPEC/Pages/PODL.razor +++ b/MP.SPEC/Pages/PODL.razor @@ -5,7 +5,7 @@
-

Promesse ODL

+

Promesse ODL