Bozza metodi data x pag tag mensili
This commit is contained in:
@@ -48,8 +48,11 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
int tOutPeriod = 300000;
|
||||
//int tOutPeriod = 1000;
|
||||
#if DEBUG
|
||||
int tOutPeriod = 1000;
|
||||
#else
|
||||
int tOutPeriod = 10000;
|
||||
#endif
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-1 small">
|
||||
<p>elenco da stored</p>
|
||||
<p>elenco da stored... fare...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using EgwCoreLib.Utils;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using NLog;
|
||||
|
||||
namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
@@ -31,7 +33,7 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
CurrPeriodo.Fine = DateTime.Today.AddDays(1);
|
||||
}
|
||||
@@ -57,6 +59,7 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
private List<DipendentiModel> ListDipendenti { get; set; } = new List<DipendentiModel>();
|
||||
|
||||
private List<MonthTagModel>? ListRecords { get; set; } = null;
|
||||
private List<MonthTagModel>? SearchRecords { get; set; } = null;
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
@@ -83,10 +86,9 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
{
|
||||
ListDipendenti = rawList.Where(x => (x.Attivo ?? false)).ToList();
|
||||
}
|
||||
#if false
|
||||
try
|
||||
{
|
||||
SearchRecords = await GDataServ.TeRaExplGetFilt(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine, ShowInatt, ShowWE, MaxErrMin, MaxErrPlus);
|
||||
SearchRecords = await GDataServ.MonthTagList(IdxDipSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
// verifico filtro per IdxDip
|
||||
if (IdxDipSel > 0)
|
||||
{
|
||||
@@ -100,10 +102,81 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
// tolgo eventuale send data...
|
||||
isSendingData = false;
|
||||
}
|
||||
|
||||
|
||||
private bool sortAsc = true;
|
||||
private string sortField = "";
|
||||
private void SortTable()
|
||||
{
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
switch (sortField)
|
||||
{
|
||||
#if false
|
||||
case "Descrizione":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.Descrizione).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.Descrizione).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CodGruppo":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CodGruppo).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CodGruppo).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "CodTagFase":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.CodTagFase).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.CodTagFase).ToList();
|
||||
}
|
||||
break;
|
||||
|
||||
case "NumFasi":
|
||||
if (sortAsc)
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderBy(x => x.NumFasi).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = SearchRecords.OrderByDescending(x => x.NumFasi).ToList();
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
await Task.Delay(1);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// filtro x display
|
||||
ListRecords = SearchRecords
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListRecords = new List<MonthTagModel>();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SavePeriodo(DtUtils.Periodo newPeiodo)
|
||||
@@ -112,6 +185,7 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-info">Nessun record trovato</div>
|
||||
<div class="alert alert-warning text-bg-danger align-content-center text-center fs-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace GPW.CORE.ADM.Components.Compo
|
||||
Log.Error($"Eccezione in recupero dati{Environment.NewLine}{ex}");
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
SortTable();
|
||||
SortTable();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>4.1.2506.1010</Version>
|
||||
<Version>4.1.2506.1109</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3603,6 +3603,39 @@ namespace GPW.CORE.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati month tag da stored dedicata
|
||||
/// </summary>
|
||||
/// <param name="idxDipendente"></param>
|
||||
/// <param name="dataFrom"></param>
|
||||
/// <param name="dataTo"></param>
|
||||
/// <returns></returns>
|
||||
public List<MonthTagModel> MonthTagList(int idxDipendente, DateTime dataFrom, DateTime dataTo)
|
||||
{
|
||||
// init dati necessari
|
||||
List<MonthTagModel> dbResult = new List<MonthTagModel>();
|
||||
// cerco su DB recuperando set di dati....
|
||||
using (GPWContext dbCtx = new GPWContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var pidxDipendente = new SqlParameter("@idxProgetto", idxDipendente);
|
||||
var pdataFrom = new SqlParameter("@idxProgetto", dataFrom);
|
||||
var pdataTo = new SqlParameter("@idxProgetto", dataTo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMonthTag
|
||||
.FromSqlRaw("EXEC dbo.stp_LTM_ByUserDate @idxDipendente, @dataFrom, @dataTo", idxDipendente, pdataFrom, pdataTo)
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in MonthTagList:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -1223,6 +1223,52 @@ namespace GPW.CORE.Data.Services
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Tag mensili filtrato x dipendente
|
||||
/// </summary>
|
||||
/// <param name="idxDip"></param>
|
||||
/// <param name="dtFrom"></param>
|
||||
/// <param name="dtTo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MonthTagModel>> MonthTagList(int idxDip, DateTime dtFrom, DateTime dtTo)
|
||||
{
|
||||
string source = "DB";
|
||||
List<MonthTagModel>? dbResult = new List<MonthTagModel>();
|
||||
// cerco "secca "in redis...
|
||||
string currKey = $"{rKeyTags}:MONTH";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string? rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
|
||||
{
|
||||
source = "REDIS";
|
||||
var tempResult = JsonConvert.DeserializeObject<List<MonthTagModel>>(rawData);
|
||||
if (tempResult == null)
|
||||
{
|
||||
dbResult = new List<MonthTagModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = tempResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.MonthTagList(idxDip, dtFrom, dtTo);
|
||||
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new List<MonthTagModel>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"MonthTagList | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record TagFasi
|
||||
/// </summary>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>4.1.2506.1009</Version>
|
||||
<Version>4.1.2506.1011</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GPW - Gestione Presenze Web</i>
|
||||
<h4>Versione: 4.1.2506.1010</h4>
|
||||
<h4>Versione: 4.1.2506.1109</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.1.2506.1010
|
||||
4.1.2506.1109
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>4.1.2506.1010</version>
|
||||
<version>4.1.2506.1109</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user