Update pagina malattia (OK lato utente)

This commit is contained in:
Samuele Locatelli
2023-01-02 16:43:23 +01:00
parent b6c6194da3
commit d7bfb7a5d1
13 changed files with 1143 additions and 724 deletions
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -8,7 +8,7 @@ namespace GPW.CORE.Data.DbModels
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("RegMalattie")]
[Table("RegistroMalattie")]
public partial class RegMalattieModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -16,6 +16,7 @@ namespace GPW.CORE.Data.DbModels
public int idxDipendente { get; set; }
public DateTime dtInizio { get; set; } = DateTime.Today;
public int numGG { get; set; } = 1;
public string codCert { get; set; } = "";
public string codCert { get; set; } = "";
public bool conf { get; set; } = false;
}
}
@@ -74,7 +74,6 @@ else
<div class="alert alert-warning">
<b>Attenzione!</b>: progetto inattivo: verificare con amministrazione prima di procedere!
</div>
}
}
</div>
@@ -146,137 +145,4 @@ else
</div>
}
@code {
private int _idxFase = 0;
private int minDur = 30;
private bool doClose = true;
private string descrizione = "";
private string cssCheckOre = "";
private CalcOreFasiModel? CalcOreFasi { get; set; } = null;
private AnagFasiModel? currFase { get; set; } = null;
private AnagFasiModel? ancestFase { get; set; } = null;
private AnagProgettiModel? currProj { get; set; } = null;
[Parameter]
public int idxFase
{
get
{
return _idxFase;
}
set
{
_idxFase = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
[Parameter]
public EventCallback<bool> RecStarted { get; set; }
private bool buttonEnabled
{
get
{
bool answ = !VetoProj;
if (CalcOreFasi != null)
{
if (CalcOreFasi.Attivo!=null && !(bool)CalcOreFasi.Attivo)
{
if (VetoInsert)
{
answ = false;
}
else
{
answ = true;
}
}
}
return answ;
}
}
private bool VetoInsert
{
get => GDataServ.VetoInsert;
}
private bool VetoProj
{
get
{
bool answ = false;
if (currProj != null)
{
var projAttivo = true;
_ = bool.TryParse($"{currProj.Attivo}", out projAttivo);
answ = !projAttivo;
}
return answ;
}
}
private async Task StartRecord()
{
// calcolo dataora chiusura...
DateTime newInizio = CORE.Data.Utils.DateRounded(DateTime.Now, 5, true);
// chiudo attività precedente (se c'è) odierna
if (doClose)
{
var lastRA = await GDataServ.RegAttLastByDip(AppMServ.IdxDipendente, false);
if (lastRA != null && lastRA.Inizio.Date == DateTime.Today)
{
lastRA.Fine = newInizio;
await GDataServ.RegAttUpdate(lastRA);
}
}
// registro nuova attività
RegAttivitaModel newItem = new RegAttivitaModel()
{
IdxDipendente = AppMServ.IdxDipendente,
Inizio = newInizio,
Fine = newInizio.AddMinutes(minDur),
IdxFase = idxFase,
Descrizione = descrizione
};
await GDataServ.RegAttUpdate(newItem);
// segnalo fatto
await RecStarted.InvokeAsync(false);
}
private async Task ClosePage()
{
await RecStarted.InvokeAsync(false);
}
protected async Task ReloadData()
{
// recupero dati fase completi...
currFase = await GDataServ.AnagFasiByKey(idxFase);
if (currFase != null)
{
if (currFase.IdxProgetto != null)
{
currProj = await GDataServ.AnagProjSearch((int)currFase.IdxProgetto);
}
ancestFase = await GDataServ.AnagFasiByKey(currFase.IdxFaseAncest);
int idxFaseTgt = currFase.IdxFaseAncest == 0 ? currFase.IdxFase : currFase.IdxFaseAncest;
CalcOreFasi = await GDataServ.CalcOreFase(idxFaseTgt);
cssCheckOre = "text-success";
if (CalcOreFasi.percUsed > 1)
{
cssCheckOre = "text-danger";
}
else if (CalcOreFasi.percUsed * 100 > 80)
{
cssCheckOre = "text-warning";
}
}
}
}
@@ -0,0 +1,154 @@
using GPW.CORE.Data.DbModels;
using Microsoft.AspNetCore.Components;
namespace GPW.CORE.WRKLOG.Components
{
public partial class RecFaseStart
{
#region Public Properties
[Parameter]
public int idxFase
{
get
{
return _idxFase;
}
set
{
_idxFase = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
[Parameter]
public EventCallback<bool> RecStarted { get; set; }
#endregion Public Properties
#region Protected Methods
protected async Task ReloadData()
{
// recupero dati fase completi...
currFase = await GDataServ.AnagFasiByKey(idxFase);
if (currFase != null)
{
if (currFase.IdxProgetto != null)
{
currProj = await GDataServ.AnagProjSearch((int)currFase.IdxProgetto);
}
ancestFase = await GDataServ.AnagFasiByKey(currFase.IdxFaseAncest);
int idxFaseTgt = currFase.IdxFaseAncest == 0 ? currFase.IdxFase : currFase.IdxFaseAncest;
CalcOreFasi = await GDataServ.CalcOreFase(idxFaseTgt);
cssCheckOre = "text-success";
if (CalcOreFasi.percUsed > 1)
{
cssCheckOre = "text-danger";
}
else if (CalcOreFasi.percUsed * 100 > 80)
{
cssCheckOre = "text-warning";
}
}
}
#endregion Protected Methods
#region Private Fields
private int _idxFase = 0;
private string cssCheckOre = "";
private string descrizione = "";
private bool doClose = true;
private int minDur = 30;
#endregion Private Fields
#region Private Properties
private AnagFasiModel? ancestFase { get; set; } = null;
private bool buttonEnabled
{
get
{
bool answ = !VetoProj;
if (CalcOreFasi != null)
{
if (CalcOreFasi.Attivo != null && !(bool)CalcOreFasi.Attivo)
{
if (VetoInsert)
{
answ = false;
}
else
{
answ = true;
}
}
}
return answ;
}
}
private CalcOreFasiModel? CalcOreFasi { get; set; } = null;
private AnagFasiModel? currFase { get; set; } = null;
private AnagProgettiModel? currProj { get; set; } = null;
private bool VetoInsert { get => GDataServ.VetoInsert; }
private bool VetoProj
{
get
{
bool answ = false;
if (currProj != null)
{
var projAttivo = true;
_ = bool.TryParse($"{currProj.Attivo}", out projAttivo);
answ = !projAttivo;
}
return answ;
}
}
#endregion Private Properties
#region Private Methods
private async Task ClosePage()
{
await RecStarted.InvokeAsync(false);
}
private async Task StartRecord()
{
// calcolo dataora chiusura...
DateTime newInizio = CORE.Data.Utils.DateRounded(DateTime.Now, 5, true);
// chiudo attività precedente (se c'è) odierna
if (doClose)
{
var lastRA = await GDataServ.RegAttLastByDip(AppMServ.IdxDipendente, false);
if (lastRA != null && lastRA.Inizio.Date == DateTime.Today)
{
lastRA.Fine = newInizio;
await GDataServ.RegAttUpdate(lastRA);
}
}
// registro nuova attività
RegAttivitaModel newItem = new RegAttivitaModel()
{ IdxDipendente = AppMServ.IdxDipendente, Inizio = newInizio, Fine = newInizio.AddMinutes(minDur), IdxFase = idxFase, Descrizione = descrizione };
await GDataServ.RegAttUpdate(newItem);
// segnalo fatto
await RecStarted.InvokeAsync(false);
}
#endregion Private Methods
}
}
@@ -0,0 +1,55 @@
@if (isLoading)
{
<LoadingData></LoadingData>
}
else
{
@if (ListRecords == null)
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
@if (ListRecords.Count == 0)
{
<div class="alert alert-warning">
Nessu record registrato
</div>
}
else
{
<table class="table table-sm table-striped table-responsive-md border border-dark">
<thead>
<tr class="bg-dark text-light">
<th>Data</th>
<th class="text-center">Giorni</th>
<th class="text-right">Codice</th>
<th class="text-right"></th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecords.OrderByDescending(x => x.dtInizio))
{
<tr>
<td>
@item.dtInizio.ToString("dd MMM yyyy"), <b>@item.dtInizio.ToString("dddd")</b>
</td>
<td class="text-center">
@item.numGG
</td>
<td class="text-right">
@item.codCert
</td>
<td class="text-right">
@if (!item.conf)
{
<button class="btn btn-danger btn-sm" @onclick="() => DeleteRec(item)"><i class="fas fa-trash-alt"></i></button>
}
</td>
</tr>
}
</tbody>
</table>
}
}
}
@@ -0,0 +1,69 @@
using GPW.CORE.Data.DbModels;
using GPW.CORE.WRKLOG.Data;
using Microsoft.AspNetCore.Components;
namespace GPW.CORE.WRKLOG.Components
{
public partial class RegMalattia
{
#region Protected Properties
[Inject]
protected MessageService AppMServ { get; set; } = null!;
[Inject]
protected GpwDataService DataService { get; set; } = null!;
[Parameter]
public int IdxDipendente { get; set; }
[Parameter]
public bool isLoading
{
get => loading;
set
{
if (loading != value)
{
loading = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
protected bool loading { get; set; } = false;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private List<RegMalattieModel>? ListRecords = null;
#endregion Private Fields
#region Private Methods
private async Task ReloadData()
{
ListRecords = null;
await Task.Delay(1);
ListRecords = await DataService.RegMalattieGetByDip(IdxDipendente, 10);
}
private async Task DeleteRec(RegMalattieModel selItem)
{
await DataService.RegMalattieDelete(selItem);
await ReloadData();
}
#endregion Private Methods
}
}
+214 -139
View File
@@ -10,62 +10,9 @@ namespace GPW.CORE.WRKLOG.Data
{
public class GpwDataService : IDisposable
{
#region Private Fields
private static IConfiguration _configuration = null!;
private static ILogger<GpwDataService> _logger = null!;
private static JsonSerializerSettings? JSSettings;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
//private readonly IEmailSender _emailSender;
//private readonly UserManager<IdentityUser> _userManager;
private readonly IDistributedCache distributedCache;
private readonly IMemoryCache memoryCache;
private List<string> cachedDataList = new List<string>();
/// <summary>
/// Durata assoluta massima della cache IN SECONDI
/// </summary>
private int chAbsExp = 60 * 5;
/// <summary>
/// Durata della cache IN SECONDI in modalità inattiva (non acceduta) prima di venire rimossa
/// NON estende oltre il tempo massimo di validità della cache (chAbsExp)
/// </summary>
private int chSliExp = 60 * 1;
#endregion Private Fields
#region Protected Fields
protected const string rKeyAKV = "Cache:AKV";
protected const string rKeyAnOrDip = "Cache:AnOrariDip";
protected const string rKeyCalcOreFase = "Cache:CalcOreFase";
protected const string rKeyCalcOreProj = "Cache:CalcOreProj";
protected const string rKeyCliAll = "Cache:CliAll";
protected const string rKeyDailyData = "Cache:DailyData";
protected const string rKeyDipendenti = "Cache:Dipendenti";
protected const string rKeyFasiAll = "Cache:FasiAll";
protected const string rKeyFasiByProj = "Cache:FasiByProj";
protected const string rKeyFasiSearch = "Cache:FasiSearch";
protected const string rKeyGrpAll = "Cache:GrpAll";
protected const string rKeyGrpUser = "Cache:GrpUser";
protected const string rKeyParetoRegAtt = "Cache:ParetoRegAtt";
protected const string rKeyProjAll = "Cache:ProjAll";
protected const string rKeyRilTemp = "Cache:RilTemp";
protected const string rKeyVC19 = "Cache:VC19";
protected const string rKeyVetoIns = "Cache:VetoInsert";
protected const string rKeyWeekStats = "Cache:WeekStats";
protected static string connStringBBM = "";
#endregion Protected Fields
#region Public Fields
public static CORE.Data.Controllers.GPWController dbController = null!;
public bool VetoInsert = false;
#endregion Public Fields
@@ -80,9 +27,7 @@ namespace GPW.CORE.WRKLOG.Data
this.memoryCache = memoryCache;
this.distributedCache = distributedCache;
// json serializer...
// FIX errore loop circolare
// https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
JSSettings = new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
@@ -111,40 +56,6 @@ namespace GPW.CORE.WRKLOG.Data
#endregion Public Properties
#region Private Methods
private DistributedCacheEntryOptions cacheOpt(bool fastCache)
{
var numSecAbsExp = fastCache ? chAbsExp : chAbsExp * 10;
var numSecSliExp = fastCache ? chSliExp : chSliExp * 10;
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp));
}
private DistributedCacheEntryOptions cacheOpt(int multFact)
{
var numSecAbsExp = chAbsExp * multFact;
var numSecSliExp = chSliExp * multFact;
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp));
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// Registra in cache chiave se non fosse già in elenco
/// </summary>
/// <param name="newKey"></param>
protected void trackCache(string newKey)
{
if (!cachedDataList.Contains(newKey))
{
cachedDataList.Add(newKey);
}
}
#endregion Protected Methods
#region Public Methods
/// <summary>
@@ -252,6 +163,38 @@ namespace GPW.CORE.WRKLOG.Data
return await Task.FromResult(dbResult);
}
/// <summary>
/// Recupera info x una specifica FASE
/// </summary>
/// <returns></returns>
public async Task<AnagFasiModel?> AnagFasiByKey(int idxFase)
{
AnagFasiModel? dbResult = new AnagFasiModel();
// cerco "secca "in redis...
string currKey = $"{rKeyFasiSearch}:{idxFase}";
string rawData;
var redisDataList = await distributedCache.GetAsync(currKey);
if (redisDataList != null)
{
rawData = Encoding.UTF8.GetString(redisDataList);
dbResult = JsonConvert.DeserializeObject<AnagFasiModel>(rawData);
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.AnagFasiByKey(idxFase);
// salvo in cache
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(currKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per AnagFasiSearch: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
/// <summary>
/// Elenco fasi dato progetto
/// </summary>
@@ -285,38 +228,6 @@ namespace GPW.CORE.WRKLOG.Data
return await Task.FromResult(dbResult);
}
/// <summary>
/// Recupera info x una specifica FASE
/// </summary>
/// <returns></returns>
public async Task<AnagFasiModel?> AnagFasiByKey(int idxFase)
{
AnagFasiModel? dbResult = new AnagFasiModel();
// cerco "secca "in redis...
string currKey = $"{rKeyFasiSearch}:{idxFase}";
string rawData;
var redisDataList = await distributedCache.GetAsync(currKey);
if (redisDataList != null)
{
rawData = Encoding.UTF8.GetString(redisDataList);
dbResult = JsonConvert.DeserializeObject<AnagFasiModel>(rawData);
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.AnagFasiByKey(idxFase);
// salvo in cache
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(currKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per AnagFasiSearch: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
/// <summary>
/// Recupera l'elenco gruppi abilitati x il dipendente
/// </summary>
@@ -781,6 +692,83 @@ namespace GPW.CORE.WRKLOG.Data
return answ;
}
/// <summary>
/// Effettua eliminazione record registro malattie (SE non confermato)
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> RegMalattieDelete(RegMalattieModel currItem)
{
bool answ = false;
try
{
dbController.RegMalattieDelete(currItem);
// invalido la cache...
await InvalidateAllCache();
answ = true;
}
catch
{ }
return answ;
}
/// <summary>
/// Restituisce elenco malattie dipendente
/// </summary>
/// <param name="idxDipendente">Dipendente interessato</param>
/// <param name="maxRecord">max record da recuperare</param>
/// <returns></returns>
public async Task<List<RegMalattieModel>> RegMalattieGetByDip(int idxDipendente, int maxRecord)
{
List<RegMalattieModel>? dbResult = new List<RegMalattieModel>();
string currKey = $"{rKeyDipendenti}:{idxDipendente}:RegMal:{maxRecord}";
trackCache(currKey);
string rawData;
var redisDataList = await distributedCache.GetAsync(currKey);
if (redisDataList != null)
{
rawData = Encoding.UTF8.GetString(redisDataList);
dbResult = JsonConvert.DeserializeObject<List<RegMalattieModel>>(rawData);
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.RegMalattieGetByDip(idxDipendente, maxRecord);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(currKey, redisDataList, cacheOpt(true));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per GetRegMalattieDip: {ts.TotalMilliseconds} ms");
}
if (dbResult == null)
{
dbResult = new List<RegMalattieModel>();
}
return await Task.FromResult(dbResult);
}
/// <summary>
/// Registra o aggiorna record registro malattie
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> RegMalattieUpsert(RegMalattieModel currItem)
{
bool answ = false;
try
{
dbController.RegMalattieUpsert(currItem);
// invalido la cache...
await InvalidateAllCache();
answ = true;
}
catch
{ }
return answ;
}
/// <summary>
/// Recupera l'elenco dei Rilievi temperatura nel periodo indicato x dipendente
/// </summary>
@@ -842,6 +830,24 @@ namespace GPW.CORE.WRKLOG.Data
dbController.rollBackEntity(item);
}
/// <summary>
/// Elenco timbrature di un giorno
/// </summary>
/// <param name="dateRif"></param>
/// <param name="IdxDip"></param>
/// <returns></returns>
public async Task<List<TimbratureModel>> TimbratureDay(DateTime dateRif, int IdxDip)
{
List<TimbratureModel>? dbResult = new List<TimbratureModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.TimbratureDay(dateRif, IdxDip);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per TimbratureDay: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
public async Task<bool> TimbratureDelete(TimbratureModel currItem)
{
bool answ = false;
@@ -871,24 +877,93 @@ namespace GPW.CORE.WRKLOG.Data
{ }
return answ;
}
/// <summary>
/// Elenco timbrature di un giorno
/// </summary>
/// <param name="dateRif"></param>
/// <param name="IdxDip"></param>
/// <returns></returns>
public async Task<List<TimbratureModel>> TimbratureDay(DateTime dateRif, int IdxDip)
{
List<TimbratureModel>? dbResult = new List<TimbratureModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.TimbratureDay(dateRif, IdxDip);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB + caching per TimbratureDay: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
}
#endregion Public Methods
#region Protected Fields
protected const string rKeyAKV = "Cache:AKV";
protected const string rKeyAnOrDip = "Cache:AnOrariDip";
protected const string rKeyCalcOreFase = "Cache:CalcOreFase";
protected const string rKeyCalcOreProj = "Cache:CalcOreProj";
protected const string rKeyCliAll = "Cache:CliAll";
protected const string rKeyDailyData = "Cache:DailyData";
protected const string rKeyDipendenti = "Cache:Dipendenti";
protected const string rKeyFasiAll = "Cache:FasiAll";
protected const string rKeyFasiByProj = "Cache:FasiByProj";
protected const string rKeyFasiSearch = "Cache:FasiSearch";
protected const string rKeyGrpAll = "Cache:GrpAll";
protected const string rKeyGrpUser = "Cache:GrpUser";
protected const string rKeyParetoRegAtt = "Cache:ParetoRegAtt";
protected const string rKeyProjAll = "Cache:ProjAll";
protected const string rKeyRilTemp = "Cache:RilTemp";
protected const string rKeyVC19 = "Cache:VC19";
protected const string rKeyVetoIns = "Cache:VetoInsert";
protected const string rKeyWeekStats = "Cache:WeekStats";
protected static string connStringBBM = "";
#endregion Protected Fields
#region Protected Methods
/// <summary>
/// Registra in cache chiave se non fosse già in elenco
/// </summary>
/// <param name="newKey"></param>
protected void trackCache(string newKey)
{
if (!cachedDataList.Contains(newKey))
{
cachedDataList.Add(newKey);
}
}
#endregion Protected Methods
#region Private Fields
private static IConfiguration _configuration = null!;
private static ILogger<GpwDataService> _logger = null!;
private static JsonSerializerSettings? JSSettings;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
//private readonly IEmailSender _emailSender;
//private readonly UserManager<IdentityUser> _userManager;
private readonly IDistributedCache distributedCache;
private readonly IMemoryCache memoryCache;
private List<string> cachedDataList = new List<string>();
/// <summary>
/// Durata assoluta massima della cache IN SECONDI
/// </summary>
private int chAbsExp = 60 * 5;
/// <summary>
/// Durata della cache IN SECONDI in modalità inattiva (non acceduta) prima di venire
/// rimossa NON estende oltre il tempo massimo di validità della cache (chAbsExp)
/// </summary>
private int chSliExp = 60 * 1;
#endregion Private Fields
#region Private Methods
private DistributedCacheEntryOptions cacheOpt(bool fastCache)
{
var numSecAbsExp = fastCache ? chAbsExp : chAbsExp * 10;
var numSecSliExp = fastCache ? chSliExp : chSliExp * 10;
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp));
}
private DistributedCacheEntryOptions cacheOpt(int multFact)
{
var numSecAbsExp = chAbsExp * multFact;
var numSecSliExp = chSliExp * multFact;
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp));
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2210.1416</Version>
<Version>3.0.2301.0216</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
+56 -17
View File
@@ -1,24 +1,63 @@
@page "/Illness"
<h3>Illness</h3>
<div>
<ul class="list-group">
<li class="list-group-item">Indicazione data inizio (preselezione = oggi)</li>
<li class="list-group-item">Numero giorni dichiarati</li>
<li class="list-group-item">Codice certificato INPS</li>
<li class="list-group-item">
<button class="btn btn-success">Registra evento</button>
</li>
</ul>
...di conseguenza deve
<ul>
<li>Partire un email di segnalazione ad ADMIN (verificare lista configurata...)</li>
<li>registrare voce in permessi/giustificativi di MAL (verificare durata da conf ore dipendente...)</li>
</ul>
<div class="card">
<div class="card-header table-primary">
<h3>Malattia</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-6">
@if (isLoading)
{
<LoadingData></LoadingData>
}
else
{
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between">
<div>
<b>Inizio Malattia</b>
</div>
<div>
<input type="date" aria-label="Last name" class="form-control text-right" @bind="@currRecord.dtInizio">
</div>
</li>
<li class="list-group-item d-flex justify-content-between">
<div>
<b>Giorni Malattia</b>
</div>
<div>
<input type="number" aria-label="Last name" class="form-control text-right" @bind="@currRecord.numGG">
</div>
</li>
<li class="list-group-item d-flex justify-content-between">
<div>
<b>Codice Certificato (INPS)</b>
</div>
<div>
<input type="text" aria-label="Last name" class="form-control text-right" @bind="@currRecord.codCert">
</div>
</li>
<li class="list-group-item text-right">
<button class="btn btn-success btn-block" @onclick="() => insertRecord()">Registra evento</button>
</li>
</ul>
}
...di conseguenza deve
<ul>
<li>Partire un email di segnalazione ad ADMIN (verificare lista configurata...)</li>
<li>registrare voce in permessi/giustificativi di MAL (verificare durata da conf ore dipendente...)</li>
</ul>
</div>
<div class="col-6">
<RegMalattia IdxDipendente="@idxDipendente" isLoading="@isLoading"></RegMalattia>
</div>
</div>
</div>
</div>
+74 -15
View File
@@ -1,23 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using GPW.CORE.Data.DbModels;
using GPW.CORE.WRKLOG.Data;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using GPW.CORE.WRKLOG;
using GPW.CORE.WRKLOG.Shared;
using GPW.CORE.WRKLOG.Components;
namespace GPW.CORE.WRKLOG.Pages
{
public partial class Illness
{
#region Protected Properties
[Inject]
protected MessageService AppMServ { get; set; } = null!;
[Inject]
protected GpwDataService DataService { get; set; } = null!;
protected int idxDipendente
{
get => currRecord.idxDipendente;
set => currRecord.idxDipendente = value;
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Registra il record
/// </summary>
/// <returns></returns>
protected async Task insertRecord()
{
isLoading = true;
// forzo dipendente
idxDipendente = AppMServ.IdxDipendente;
await Task.Delay(1);
// effettuo insert...
await DataService.RegMalattieUpsert(currRecord);
await Task.Delay(1);
// aggiorno display...
idxDipendente = 0;
await Task.Delay(1);
ReloadData();
}
protected override void OnInitialized()
{
ReloadData();
}
#endregion Protected Methods
#region Private Fields
private bool isLoading = false;
#endregion Private Fields
#region Private Properties
private RegMalattieModel currRecord { get; set; } = new RegMalattieModel();
#endregion Private Properties
#region Private Methods
private void ReloadData()
{
isLoading = true;
currRecord = new RegMalattieModel()
{
idxDipendente = AppMServ.IdxDipendente,
dtInizio = DateTime.Today,
numGG = 1,
codCert = "00000000"
};
isLoading = false;
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2210.1416</h4>
<h4>Versione: 3.0.2301.0216</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2210.1416
3.0.2301.0216
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2210.1416</version>
<version>3.0.2301.0216</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>