PODL:
- completato editing con delete
This commit is contained in:
@@ -31,6 +31,7 @@ namespace MP.Data.Controllers
|
||||
{
|
||||
return AnagGruppiGetTipo("AZIENDA");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi tipo Fasi
|
||||
/// </summary>
|
||||
@@ -402,6 +403,36 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione Record
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update Record
|
||||
/// </summary>
|
||||
|
||||
@@ -50,10 +50,10 @@ else
|
||||
</td>
|
||||
<td>@record.Note</td>
|
||||
<td>
|
||||
@*@if (ArticoloDelEnabled(record.CodArticolo))
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}*@
|
||||
@if (POdlDelEnabled(record.IdxOdl))
|
||||
{
|
||||
<button @onclick="() => deleteRecord(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezioanto (previa conferma)
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task deleteRecord(PODLModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("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<MP.Data.DatabaseModels.ListValues>? ListStati;
|
||||
private List<ListValues>? ListStati;
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
|
||||
@@ -294,15 +294,16 @@ namespace MP.SPEC.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco aziende
|
||||
/// Restitusice elenco aziende
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<AnagGruppi>> ElencoAziende()
|
||||
{
|
||||
return Task.FromResult(dbController.AnagGruppiAziende());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco fasi
|
||||
/// Restitusice elenco fasi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<AnagGruppi>> ElencoGruppiFase()
|
||||
@@ -402,6 +403,16 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato
|
||||
/// </summary>
|
||||
/// <param name="currRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> PODLDeleteRecord(PODLModel currRec)
|
||||
{
|
||||
return await dbController.PODLDeleteRecord(currRec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiornamento record selezionato
|
||||
/// </summary>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="px-0">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h2>Articoli </h2>
|
||||
<h3>Articoli </h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" @onclick="() => addNew()">Nuovo <i class="bi bi-plus-square"></i></button>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="col-5">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h4><b>ODL</b></h4>
|
||||
<h3><b>ODL</b></h3>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" disabled="!@addEnabled" @onclick="() => reqNewPODL()">Nuovo ODL <i class="bi bi-plus-square"></i></button>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h4><b>P</b>romesse <b>ODL</b></h4>
|
||||
<h3><b>P</b>romesse <b>ODL</b></h3>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group input-group-sm">
|
||||
|
||||
Reference in New Issue
Block a user