Update x gestione "rilascio licenze" con modifica data veto da admin
This commit is contained in:
@@ -176,6 +176,32 @@ namespace LiMan.DB.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
public bool AttivazioniUnlock(int idxSubLic)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
|
||||
{
|
||||
DateTime oggi = DateTime.Today;
|
||||
|
||||
// recupero record
|
||||
var currData = localDbCtx
|
||||
.DbSetSubLicenze
|
||||
.Where(x => x.IdxSubLic == idxSubLic && x.VetoUnlock > oggi)
|
||||
.FirstOrDefault();
|
||||
// se ho qualcosa procedo...
|
||||
if (currData != null)
|
||||
{
|
||||
currData.VetoUnlock = oggi;
|
||||
localDbCtx.Entry(currData).State = EntityState.Modified;
|
||||
// salvo
|
||||
localDbCtx.SaveChanges();
|
||||
}
|
||||
// comunque true se ci ha provato
|
||||
fatto = true;
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
public bool DbForceMigrate()
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
@@ -15,18 +15,9 @@
|
||||
{
|
||||
<tr class="@checkSelect(record.IdxLic)">
|
||||
<td class="text-nowrap">
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit record">
|
||||
<i class="oi oi-pencil"></i>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled">
|
||||
<i class="oi oi-pencil"></i>
|
||||
</button>
|
||||
}
|
||||
<button class="btn btn-sm btn-info" @onclick="() => UnLock(record)" title="Edit record">
|
||||
<i class="oi oi-lock-unlocked"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<b>@record.IdxSubLic</b>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using LiMan.DB.DBModels;
|
||||
using LiMan.UI.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -42,6 +43,9 @@ namespace LiMan.UI.Components
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
@@ -119,18 +123,6 @@ namespace LiMan.UI.Components
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected void Edit(SubLicenzaModel selRecord)
|
||||
{
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
#if false
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadAllData();
|
||||
}
|
||||
#endif
|
||||
|
||||
protected async Task PagerReloadNum(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
@@ -150,6 +142,16 @@ namespace LiMan.UI.Components
|
||||
await fullReload();
|
||||
}
|
||||
|
||||
protected async Task UnLock(SubLicenzaModel selRecord)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il blocco? la data di scadenza verrà impostata a ieri liberando la licenza per cancellazioni o rimozioni."))
|
||||
return;
|
||||
|
||||
// chiamo procedura sblocco...
|
||||
DataService.AttivazioneUnlock(selRecord.IdxSubLic);
|
||||
await ResetData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -98,6 +98,22 @@ namespace LiMan.UI.Data
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua sblocco di una licenza impostando data veto a oggi
|
||||
/// </summary>
|
||||
/// <param name="idxSubLic"></param>
|
||||
/// <returns></returns>
|
||||
internal bool AttivazioneUnlock(int idxSubLic)
|
||||
{
|
||||
bool fatto = false;
|
||||
dbControllerNext.AttivazioniUnlock(idxSubLic);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user