- spostamento sel calendario inDataLayer
- Fix display info personali in dettaglio DTO
- Fix selettore mese
- Clòeanup vari
This commit is contained in:
Samuele Locatelli
2024-09-07 10:33:10 +02:00
parent adaa2657be
commit 565c20e396
11 changed files with 412 additions and 301 deletions
+147 -128
View File
@@ -530,29 +530,115 @@ namespace GPW.CORE.Data.Controllers
return dbResult;
}
/// <summary>
/// Recupera l'elenco delle ultime attività inserite da un dipendente
/// Recupera l'elenco dei dettaglio giornaliero attività di tutti i dipendenti, dato giorno riferimento
/// </summary>
/// <param name="idxDipendente">Dipendente interessato</param>
/// <param name="numRec">Num record da recuperare</param>
/// <param name="dtRif">Data di riferimento</param>
/// <returns></returns>
public List<RegAttivitaModel> UserLastRec(int idxDipendente, int numRec)
public List<DailyDataDTO> DailyDetailAllDip(DateTime dtRif)
{
List<RegAttivitaModel> listRec = new List<RegAttivitaModel>();
//resetto valoredtRif a giornata (mezzanotte)
dtRif = dtRif.Date;
// init dati necessari
List<DailyDataDTO> dbResult = new List<DailyDataDTO>();
List<TimbratureExplModel> rawTimbExp = new List<TimbratureExplModel>();
List<TimbratureModel> rawTimbr = new List<TimbratureModel>();
List<RegAttivitaModel> rawRegAtt = new List<RegAttivitaModel>();
List<RilievoTempModel> rawRilTemp = new List<RilievoTempModel>();
List<CheckVc19Model> rawCheckC19 = new List<CheckVc19Model>();
// fermate/festività/ferie
List<CalFesteFerieModel> rawFermateAz = new List<CalFesteFerieModel>();
List<RegMalattieModel> rawMalattie = new List<RegMalattieModel>();
List<RegRichiesteModel> rawRichDip = new List<RegRichiesteModel>();
// cerco su DB recuperando set di dati....
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
listRec = localDbCtx
.DbSetRegAttivita
.Where(x => x.IdxDipendente == idxDipendente)
.Include(a => a.FasiNav).ThenInclude(p => p.ProgettoNav).ThenInclude(c => c.ClienteNav)
.OrderByDescending(x => x.IdxRa)
.Take(numRec)
.AsNoTracking()
// recupero intero set dati timbrature e attività....
rawTimbExp = localDbCtx
.DbSetTimbratureExpl
.Where(x => dtRif == x.DataLav)
.ToList();
rawTimbr = localDbCtx
.DbSetTimbrature
.Where(x => dtRif == x.DataOra.Date)
.ToList();
rawRegAtt = localDbCtx
.DbSetRegAttivita
.Where(x => dtRif == x.Inizio.Date)
.Include(a => a.FasiNav).ThenInclude(p => p.ProgettoNav).ThenInclude(c => c.ClienteNav)
.ToList();
rawRilTemp = localDbCtx
.DbSetRilievoTemp
.Where(x => dtRif <= x.DtRilievo.Date)
.ToList();
rawCheckC19 = localDbCtx
.DbSetCheckVc19
.Where(x => dtRif <= x.DtCheck.Date)
.ToList();
// recupero fermate e malattie/permessi del dipendente...
rawFermateAz = localDbCtx
.DbSetCalFesteFerie
.Where(x => x.data == dtRif)
.ToList();
rawMalattie = localDbCtx
.DbSetRegMalattie
.Where(x => x.DtInizio.Date <= dtRif && x.DtInizio.AddDays(x.NumGG) >= dtRif)
.ToList();
rawRichDip = localDbCtx
.DbSetRegRichieste
.Where(x => x.DtStart.Date <= dtRif && x.DtEnd >= dtRif)
.ToList();
// calcolo elenco DIP
List<int> listDip = rawTimbExp.Select(x => x.IdxDipendente).Distinct().ToList();
// x ogni giorno scompongo il set di info...
foreach (var idxDip in listDip)
{
DailyDataDTO currDayDto = new DailyDataDTO()
{
IdxDipendente = idxDip,
DtRif = dtRif,
ListRA = rawRegAtt
.Where(x => x.IdxDipendente == idxDip)
.OrderBy(x => x.Inizio)
.ToList(),
ListTimbr = rawTimbr
.Where(x => x.IdxDipendente == idxDip)
.OrderBy(x => x.DataOra)
.ToList(),
TimbrExpl = rawTimbExp
.Where(x => x.IdxDipendente == idxDip)
.FirstOrDefault(),
ListRilTemp = rawRilTemp
.Where(x => x.IdxDipendente == idxDip)
.ToList(),
ListCheckC19 = rawCheckC19
.Where(x => x.IdxDipendente == idxDip)
.ToList(),
ListFermateAzienda = rawFermateAz,
ListMalattie = rawMalattie
.Where(x => x.IdxDipendente == idxDip)
.ToList(),
ListFerieDip = rawRichDip
.Where(x => x.IdxDipendente == idxDip)
.ToList(),
ListRichiesteDip = rawRichDip
.Where(x => x.IdxDipendente == idxDip)
.ToList()
};
dbResult.Add(currDayDto);
}
}
return listRec;
return dbResult;
}
/// <summary>
@@ -669,117 +755,6 @@ namespace GPW.CORE.Data.Controllers
return dbResult;
}
/// <summary>
/// Recupera l'elenco dei dettaglio giornaliero attività di tutti i dipendenti, dato giorno riferimento
/// </summary>
/// <param name="dtRif">Data di riferimento</param>
/// <returns></returns>
public List<DailyDataDTO> DailyDetailAllDip(DateTime dtRif)
{
//resetto valoredtRif a giornata (mezzanotte)
dtRif = dtRif.Date;
// init dati necessari
List<DailyDataDTO> dbResult = new List<DailyDataDTO>();
List<TimbratureExplModel> rawTimbExp = new List<TimbratureExplModel>();
List<TimbratureModel> rawTimbr = new List<TimbratureModel>();
List<RegAttivitaModel> rawRegAtt = new List<RegAttivitaModel>();
List<RilievoTempModel> rawRilTemp = new List<RilievoTempModel>();
List<CheckVc19Model> rawCheckC19 = new List<CheckVc19Model>();
// fermate/festività/ferie
List<CalFesteFerieModel> rawFermateAz = new List<CalFesteFerieModel>();
List<RegMalattieModel> rawMalattie = new List<RegMalattieModel>();
List<RegRichiesteModel> rawRichDip = new List<RegRichiesteModel>();
// cerco su DB recuperando set di dati....
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
// recupero intero set dati timbrature e attività....
rawTimbExp = localDbCtx
.DbSetTimbratureExpl
.Where(x => dtRif == x.DataLav)
.ToList();
rawTimbr = localDbCtx
.DbSetTimbrature
.Where(x => dtRif == x.DataOra.Date)
.ToList();
rawRegAtt = localDbCtx
.DbSetRegAttivita
.Where(x => dtRif == x.Inizio.Date)
.Include(a => a.FasiNav).ThenInclude(p => p.ProgettoNav).ThenInclude(c => c.ClienteNav)
.ToList();
rawRilTemp = localDbCtx
.DbSetRilievoTemp
.Where(x => dtRif <= x.DtRilievo.Date)
.ToList();
rawCheckC19 = localDbCtx
.DbSetCheckVc19
.Where(x => dtRif <= x.DtCheck.Date)
.ToList();
// recupero fermate e malattie/permessi del dipendente...
rawFermateAz = localDbCtx
.DbSetCalFesteFerie
.Where(x => x.data == dtRif)
.ToList();
rawMalattie = localDbCtx
.DbSetRegMalattie
.Where(x => x.DtInizio.Date <= dtRif && x.DtInizio.AddDays(x.NumGG) >= dtRif)
.ToList();
rawRichDip = localDbCtx
.DbSetRegRichieste
.Where(x => x.DtStart.Date <= dtRif && x.DtEnd >= dtRif)
.ToList();
// calcolo elenco DIP
List<int> listDip = rawTimbExp.Select(x => x.IdxDipendente).Distinct().ToList();
// x ogni giorno scompongo il set di info...
foreach (var idxDip in listDip)
{
DailyDataDTO currDayDto = new DailyDataDTO()
{
IdxDipendente = idxDip,
DtRif = dtRif,
ListRA = rawRegAtt
.Where(x => x.IdxDipendente == idxDip)
.OrderBy(x => x.Inizio)
.ToList(),
ListTimbr = rawTimbr
.Where(x => x.IdxDipendente == idxDip)
.OrderBy(x => x.DataOra)
.ToList(),
TimbrExpl = rawTimbExp
.Where(x => x.IdxDipendente == idxDip)
.FirstOrDefault(),
ListRilTemp = rawRilTemp
.Where(x => x.IdxDipendente == idxDip)
.ToList(),
ListCheckC19 = rawCheckC19
.Where(x => x.IdxDipendente == idxDip)
.ToList(),
ListFermateAzienda = rawFermateAz,
ListMalattie = rawMalattie
.Where(x => x.IdxDipendente == idxDip)
.ToList(),
ListFerieDip = rawRichDip
.Where(x => x.IdxDipendente == idxDip)
.ToList(),
ListRichiesteDip = rawRichDip
.Where(x => x.IdxDipendente == idxDip)
.ToList()
};
dbResult.Add(currDayDto);
}
}
return dbResult;
}
public bool DbForceMigrate()
{
bool answ = false;
@@ -1253,7 +1228,6 @@ namespace GPW.CORE.Data.Controllers
currRec.Fine = currItem.Fine;
currRec.Descrizione = currItem.Descrizione;
localDbCtx.Entry(currRec).State = EntityState.Modified;
localDbCtx
@@ -1374,11 +1348,10 @@ namespace GPW.CORE.Data.Controllers
}
/// <summary>
/// recupera elenco reg malattie del dipendente
/// Recupera elenco reg malattie (tutte, dato max dalla + recente)
/// </summary>
/// <param name="maxRecord"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<RegMalattieModel> RegMalattieGetAll(int maxRecord)
{
List<RegMalattieModel> dbResult = new List<RegMalattieModel>();
@@ -1422,6 +1395,28 @@ namespace GPW.CORE.Data.Controllers
return dbResult;
}
/// <summary>
/// Recupera elenco reg malattie dato periodo
/// </summary>
/// <param name="DtFrom"></param>
/// <param name="DtTo"></param>
/// <returns></returns>
public List<RegMalattieModel> RegMalattieGetByPeriod(DateTime DtFrom, DateTime DtTo)
{
List<RegMalattieModel> dbResult = new List<RegMalattieModel>();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
DateTime oggi = DateTime.Today;
dbResult = localDbCtx
.DbSetRegMalattie
.Where(x => (x.DtInizio.AddDays(x.NumGG) >= DtFrom && x.DtInizio <= DtTo))
.Include(d => d.DipNav)
.OrderByDescending(x => x.DtInizio)
.ToList();
}
return dbResult;
}
/// <summary>
/// Inserisce/Aggiorna record registro malattie
/// </summary>
@@ -1914,6 +1909,30 @@ namespace GPW.CORE.Data.Controllers
return answ;
}
/// <summary>
/// Recupera l'elenco delle ultime attività inserite da un dipendente
/// </summary>
/// <param name="idxDipendente">Dipendente interessato</param>
/// <param name="numRec">Num record da recuperare</param>
/// <returns></returns>
public List<RegAttivitaModel> UserLastRec(int idxDipendente, int numRec)
{
List<RegAttivitaModel> listRec = new List<RegAttivitaModel>();
// cerco su DB recuperando set di dati....
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
listRec = localDbCtx
.DbSetRegAttivita
.Where(x => x.IdxDipendente == idxDipendente)
.Include(a => a.FasiNav).ThenInclude(p => p.ProgettoNav).ThenInclude(c => c.ClienteNav)
.OrderByDescending(x => x.IdxRa)
.Take(numRec)
.AsNoTracking()
.ToList();
}
return listRec;
}
/// <summary>
/// Recupera overview di un periodo settimanale x dipendente, data riferimento, numero
/// settimane precedenti
@@ -124,6 +124,8 @@ namespace GPW.CORE.WRKLOG.Components.Compo
await Task.Delay(1);
if (UseRadz)
{
// il mese viene preimpostato sul trimestre corrente...
startMonth = (Month)((DateTime.Today.Month / 6) * 6);
ToggleData = new SelectGlobalToggle()
{
leftString = "Personali",
@@ -144,9 +146,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
protected override void OnParametersSet()
{
// il mese viene preimpostato sul trimestre corrente...
startMonth = (Month)((DateTime.Today.Month / 6) * 6);
//startMonth = DateTime.Today.Month <= 6 ? Month.January : Month.July;
FilterData();
TaskList = EvDtoList.Select(x => Converter.ToBlazorCalTask(x)).ToList();
scheduler.Reload();
@@ -236,10 +235,6 @@ namespace GPW.CORE.WRKLOG.Components.Compo
}
}
#if false
private List<Tasks> TasksFilt { get; set; } = new List<Tasks>();
#endif
private void FixCalendar()
{
ModoDisplay = ToggleData.isActive ? DisplayedView.Annual : DisplayedView.Monthly;
@@ -22,6 +22,15 @@
}
</div>
</li>
@if (model.DtEnd.Subtract(model.DtStart).TotalHours < 24)
{
<li class="list-group-item">
<div class="d-flex justify-content-between">
<div class="px-0">Data:</div>
<div class="px-0"><b>@($"{model.DtStart:ddd yyyy-MM-dd}")</b></div>
</div>
</li>
}
<li class="list-group-item">
<div class="d-flex justify-content-between">
<div class="px-0">Inizio:</div>
@@ -34,6 +43,15 @@
<div class="px-0"><b>@(EventDTO.DateForm(model.CodTipo, model.DtEnd))</b></div>
</div>
</li>
@if (model.IdxDipendente == idxDipendente)
{
<li class="list-group-item">
<div class="d-flex justify-content-between">
<div class="px-0">Note:</div>
<div class="px-0"><b>@model.Note</b></div>
</div>
</li>
}
</ul>
</div>
@@ -41,11 +59,17 @@
[Parameter]
public EventDTO ThisTask { get; set; } = null!;
[Inject]
protected MessageService AppMServ { get; set; } = null!;
EventDTO model = new EventDTO();
protected override void OnParametersSet()
{
model = ThisTask;
}
protected int idxDipendente
{
get => AppMServ.IdxDipendente;
}
}
@@ -49,8 +49,7 @@ namespace GPW.CORE.WRKLOG.Components.Pages
int.TryParse(monthConf.valore, out intVal);
numMesi = intVal > 0 ? intVal : numMesi;
}
// fix iniziale date...
// setup periodo (da rivedere in funzione eventi cambio mese dei controlli?!?)
// fix iniziale date... setup periodo (da rivedere in funzione eventi cambio mese dei controlli?!?)
DateTime oggi = DateTime.Today;
dtMin = new DateTime(oggi.Year - 1, 1, 1);
dtMax = dtMin.AddYears(3);
@@ -67,14 +66,17 @@ namespace GPW.CORE.WRKLOG.Components.Pages
#region Private Properties
private List<CalFesteFerieModel> ListFermateAzienda { get; set; } = new List<CalFesteFerieModel>();
private List<RegMalattieModel> ListMalattie { get; set; } = new List<RegMalattieModel>();
private List<RegRichiesteModel> ListRichiesteDip { get; set; } = new List<RegRichiesteModel>();
/// <summary>
/// Elenco eventi formato originale (EventDTO)
/// </summary>
private List<EventDTO> SchedEvList { get; set; } = new List<EventDTO>();
private List<CalFesteFerieModel> ListFermateAzienda { get; set; } = new List<CalFesteFerieModel>();
private List<RegMalattieModel> ListMalattie { get; set; } = new List<RegMalattieModel>();
private List<RegRichiesteModel> ListRichiesteDip { get; set; } = new List<RegRichiesteModel>();
private bool showMalattie { get; set; } = false;
private SelectGlobalToggle ToggleData { get; set; } = new SelectGlobalToggle();
@@ -94,15 +96,22 @@ namespace GPW.CORE.WRKLOG.Components.Pages
await ReloadData();
}
private async Task SetMonth(int newNum)
private void initToggler()
{
if (numMesi != newNum)
ToggleData = new SelectGlobalToggle()
{
numMesi = newNum;
}
await ReloadData();
leftString = "Malattie",
rightString = "Ferie e Permessi",
placardCss = "bg-light border-light text-dark",
};
}
private async Task ReloadData()
{
isLoading = true;
// recupero direttamente da oggetto DB
SchedEvList = await DataService.EventListPeriodo(idxDipendente, dtMin, dtMax);
isLoading = false;
}
private async Task SetDate(DateTime newDate)
@@ -122,94 +131,14 @@ namespace GPW.CORE.WRKLOG.Components.Pages
await ReloadData();
}
}
private void initToggler()
private async Task SetMonth(int newNum)
{
ToggleData = new SelectGlobalToggle()
if (numMesi != newNum)
{
leftString = "Malattie",
rightString = "Ferie e Permessi",
placardCss = "bg-light border-light text-dark",
};
}
private async Task ReloadData()
{
isLoading = true;
// Reset poi recupero e converto i dati in EventDTO
SchedEvList = new List<EventDTO>();
// recupero le fermate aziendali
ListFermateAzienda = await DataService.CalFestFeriePeriodo(dtMin, dtMax);
if (ListFermateAzienda.Count > 0)
{
// conversione fermate in EvDTO...
var evAzienda = ListFermateAzienda.Select(x => new EventDTO
{
DtStart = x.data,
DtEnd = x.data.AddDays(1),
CodTipo = x.codGiust,
IdxDipendente = 0,
Titolo = x.descrizione,
Descrizione = x.descrizione,
Note = x.descrizione,
IsDraggable = false,
IsCompany = true,
Conf = true,
Tooltip = $"{x.codGiust} | {x.descrizione}",
}).ToList();
SchedEvList.AddRange(evAzienda);
numMesi = newNum;
}
// recupero e converto le richieste dipendente...
ListRichiesteDip = await DataService.RegRichiesteGetByDip(0, dtMin, dtMax);
if (ListRichiesteDip.Count > 0)
{
// conversione fermate in elenco task x calendario...
var evDip = ListRichiesteDip.Select(x => new EventDTO
{
DtStart = x.DtStart,
DtEnd = x.DtEnd,
CodTipo = x.CodGiust, //$"{x.CodGiust} | {x.DipNav.Abbrev}",
Titolo = x.DipNav.Abbrev,
IdxDipendente = x.IdxDipendente,
Abbrev = x.DipNav.Abbrev,
CognomeNome = $"{x.DipNav.Cognome} {x.DipNav.Nome}",
Descrizione = $"{x.CodGiust} | {x.DipNav.Abbrev} | {EventDTO.DateForm(x.CodGiust, x.DtStart)} &rarr; {EventDTO.DateForm(x.CodGiust, x.DtEnd)}",
//Descrizione = x.CodGiust == "PERM" ? $"{x.CodGiust} | {x.DipNav.Abbrev} | {x.DtStart:HH:mm}--> {x.DtEnd:HH:mm}" : $"{x.CodGiust} | {x.DipNav.Abbrev} | {x.DtStart:yyyy/MM/dd} -> {x.DtEnd:yyyy/MM/dd}",
Note = x.Note,
IsDraggable = x.IdxDipendente == idxDipendente && !x.Conf,
IsCompany = false,
Conf = x.Conf,
Tooltip = $"{x.CodGiust} | {x.DipNav.Abbrev} | {EventDTO.DateForm(x.CodGiust, x.DtStart)} &rarr; {EventDTO.DateForm(x.CodGiust, x.DtEnd)}",
}).ToList();
SchedEvList.AddRange(evDip);
}
// recupero e converto le malattie...
ListMalattie = await DataService.RegMalattieGetAll(100);
if (ListMalattie.Count > 0)
{
// conversione fermate in elenco task x calendario...
var evDip = ListMalattie.Select(x => new EventDTO
{
DtStart = x.DtInizio,
DtEnd = x.DtInizio.AddDays(x.NumGG - 1),
CodTipo = "MAL",
Titolo = x.DipNav.Abbrev,
IdxDipendente = x.IdxDipendente,
Abbrev = x.DipNav.Abbrev,
CognomeNome = $"{x.DipNav.Cognome} {x.DipNav.Nome}",
Descrizione = $"MAL | {x.DipNav.Abbrev} {x.DtInizio:yyyy/MM/dd} -> {x.DtInizio.AddDays(x.NumGG - 1):yyyy/MM/dd}",
Note = x.CodCert,
IsDraggable = x.IdxDipendente == idxDipendente && !x.Conf,
IsCompany = false,
Conf = x.Conf,
Tooltip = $"MAL | {x.DipNav.Abbrev} {x.DtInizio:yyyy/MM/dd} -> {x.DtInizio.AddDays(x.NumGG - 1):yyyy/MM/dd}"
}).ToList();
SchedEvList.AddRange(evDip);
}
isLoading = false;
await ReloadData();
}
#endregion Private Methods
+206 -62
View File
@@ -43,7 +43,7 @@ namespace GPW.CORE.WRKLOG.Data
var strVeto = _configuration["VetoIns"];
_ = bool.TryParse(strVeto, out VetoInsert);
// Conf DB
string connStr = _configuration.GetConnectionString("GPW.DB")?? "Server=W2019-SQL-STEAM;Database=GPW; integrated security=True; App=GPW.CORE.WRKLOG; TrustServerCertificate=True;";
string connStr = _configuration.GetConnectionString("GPW.DB") ?? "Server=W2019-SQL-STEAM;Database=GPW; integrated security=True; App=GPW.CORE.WRKLOG; TrustServerCertificate=True;";
if (string.IsNullOrEmpty(connStr))
{
_logger.LogError("ConnString empty!");
@@ -769,51 +769,6 @@ namespace GPW.CORE.WRKLOG.Data
return dbResult;
}
/// <summary>
/// Recupera l'elenco delle ultime attività inserite da un dipendente
/// </summary>
/// <param name="idxDipendente">Dipendente interessato</param>
/// <param name="numRec">Num record da recuperare</param>
/// <returns></returns>
public async Task<List<RegAttivitaModel>> UserLastRec(int idxDipendente, int numRec)
{
string source = "DB";
DateTime oggi = DateTime.Today;
List<RegAttivitaModel>? dbResult = new List<RegAttivitaModel>();
string currKey = $"{rKeyLastRegAtt}:{idxDipendente}:{oggi.ToString("yyyy-MM-dd")}:{numRec}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<RegAttivitaModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<RegAttivitaModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.UserLastRec(idxDipendente, numRec);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (dbResult == null)
{
dbResult = new List<RegAttivitaModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"UserLastRec | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Recupera l'elenco dei dettagli giornalieri attività di un dipendente, dato periodo riferimento
/// </summary>
@@ -909,7 +864,119 @@ namespace GPW.CORE.WRKLOG.Data
public string EncriptData(string rawData)
{
return EgwCoreLib.Utils.SteamCrypto.EncryptString(rawData, passPhrase);
return SteamCrypto.EncryptString(rawData, passPhrase);
}
/// <summary>
/// Lista Eventi dato periodo (TUTTI!)
/// </summary>
/// <param name="dtStart"></param>
/// <param name="dtEnd"></param>
/// <returns></returns>
public async Task<List<EventDTO>> EventListPeriodo(int idxDipendente, DateTime dtStart, DateTime dtEnd)
{
string source = "DB";
List<EventDTO>? SchedEvList = new List<EventDTO>();
string currKey = $"{rKeyEventListDip}:{idxDipendente}:{dtStart:yyyyMMdd}:{dtEnd:yyyyMMdd}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<EventDTO>>(rawData);
if (tempResult == null)
{
SchedEvList = new List<EventDTO>();
}
else
{
SchedEvList = tempResult;
}
}
else
{
// recupero le fermate aziendali
var ListFermateAzienda = await CalFestFeriePeriodo(dtStart, dtEnd);
if (ListFermateAzienda.Count > 0)
{
// conversione fermate in EvDTO...
var evAzienda = ListFermateAzienda.Select(x => new EventDTO
{
DtStart = x.data,
DtEnd = x.data.AddDays(1),
CodTipo = x.codGiust,
IdxDipendente = 0,
Titolo = x.descrizione,
Descrizione = x.descrizione,
Note = x.descrizione,
IsDraggable = false,
IsCompany = true,
Conf = true,
Tooltip = $"{x.codGiust} | {x.descrizione}",
}).ToList();
SchedEvList.AddRange(evAzienda);
}
// recupero e converto le richieste dipendente...
var ListRichiesteDip = await RegRichiesteGetByDip(0, dtStart, dtEnd);
if (ListRichiesteDip.Count > 0)
{
// conversione fermate in elenco task x calendario...
var evDip = ListRichiesteDip.Select(x => new EventDTO
{
DtStart = x.DtStart,
DtEnd = x.DtEnd,
CodTipo = x.CodGiust, //$"{x.CodGiust} | {x.DipNav.Abbrev}",
Titolo = x.DipNav.Abbrev,
IdxDipendente = x.IdxDipendente,
Abbrev = x.DipNav.Abbrev,
CognomeNome = $"{x.DipNav.Cognome} {x.DipNav.Nome}",
Descrizione = $"{x.CodGiust} | {x.DipNav.Abbrev} | {EventDTO.DateForm(x.CodGiust, x.DtStart)} &rarr; {EventDTO.DateForm(x.CodGiust, x.DtEnd)}",
//Descrizione = x.CodGiust == "PERM" ? $"{x.CodGiust} | {x.DipNav.Abbrev} | {x.DtStart:HH:mm}--> {x.DtEnd:HH:mm}" : $"{x.CodGiust} | {x.DipNav.Abbrev} | {x.DtStart:yyyy/MM/dd} -> {x.DtEnd:yyyy/MM/dd}",
Note = x.Note,
IsDraggable = x.IdxDipendente == idxDipendente && !x.Conf,
IsCompany = false,
Conf = x.Conf,
Tooltip = $"{x.CodGiust} | {x.DipNav.Abbrev} | {EventDTO.DateForm(x.CodGiust, x.DtStart)} &rarr; {EventDTO.DateForm(x.CodGiust, x.DtEnd)}",
}).ToList();
SchedEvList.AddRange(evDip);
}
// recupero e converto le malattie...
var ListMalattie = await RegMalattieGetByPeriod(dtStart, dtEnd);
if (ListMalattie.Count > 0)
{
// conversione fermate in elenco task x calendario...
var evDip = ListMalattie.Select(x => new EventDTO
{
DtStart = x.DtInizio,
DtEnd = x.DtInizio.AddDays(x.NumGG - 1),
CodTipo = "MAL",
Titolo = x.DipNav.Abbrev,
IdxDipendente = x.IdxDipendente,
Abbrev = x.DipNav.Abbrev,
CognomeNome = $"{x.DipNav.Cognome} {x.DipNav.Nome}",
Descrizione = $"MAL | {x.DipNav.Abbrev} {x.DtInizio:yyyy/MM/dd} -> {x.DtInizio.AddDays(x.NumGG - 1):yyyy/MM/dd}",
Note = x.CodCert,
IsDraggable = x.IdxDipendente == idxDipendente && !x.Conf,
IsCompany = false,
Conf = x.Conf,
Tooltip = $"MAL | {x.DipNav.Abbrev} {x.DtInizio:yyyy/MM/dd} -> {x.DtInizio.AddDays(x.NumGG - 1):yyyy/MM/dd}"
}).ToList();
SchedEvList.AddRange(evDip);
}
rawData = JsonConvert.SerializeObject(SchedEvList, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (SchedEvList == null)
{
SchedEvList = new List<EventDTO>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"EventListPeriodo | {source} in: {ts.TotalMilliseconds} ms");
return SchedEvList;
}
public async Task<bool> FlushRedisCache()
@@ -1162,7 +1229,7 @@ namespace GPW.CORE.WRKLOG.Data
{
string source = "DB";
List<RegMalattieModel>? dbResult = new List<RegMalattieModel>();
string currKey = $"{rKeyDipendenti}:ALL:RegMal:{maxRecord}";
string currKey = $"{rKeyDipendenti}:ALL:RegMalLast:{maxRecord}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
@@ -1238,6 +1305,49 @@ namespace GPW.CORE.WRKLOG.Data
return dbResult;
}
/// <summary>
/// Recupera elenco reg malattie dato periodo
/// </summary>
/// <param name="DtFrom"></param>
/// <param name="DtTo"></param>
/// <returns></returns>
public async Task<List<RegMalattieModel>> RegMalattieGetByPeriod(DateTime DtFrom, DateTime DtTo)
{
string source = "DB";
List<RegMalattieModel>? dbResult = new List<RegMalattieModel>();
string currKey = $"{rKeyDipendenti}:ALL:RegMal:{DtFrom:yyyyMMdd}:{DtTo:yyyyMMdd}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<RegMalattieModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<RegMalattieModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.RegMalattieGetByPeriod(DtFrom, DtTo);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (dbResult == null)
{
dbResult = new List<RegMalattieModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"RegMalattieGetByPeriod | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Registra o aggiorna record registro malattie
/// </summary>
@@ -1625,6 +1735,50 @@ namespace GPW.CORE.WRKLOG.Data
return answ;
}
/// <summary>
/// Recupera l'elenco delle ultime attività inserite da un dipendente
/// </summary>
/// <param name="idxDipendente">Dipendente interessato</param>
/// <param name="numRec">Num record da recuperare</param>
/// <returns></returns>
public async Task<List<RegAttivitaModel>> UserLastRec(int idxDipendente, int numRec)
{
string source = "DB";
DateTime oggi = DateTime.Today;
List<RegAttivitaModel>? dbResult = new List<RegAttivitaModel>();
string currKey = $"{rKeyLastRegAtt}:{idxDipendente}:{oggi.ToString("yyyy-MM-dd")}:{numRec}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<RegAttivitaModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<RegAttivitaModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.UserLastRec(idxDipendente, numRec);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (dbResult == null)
{
dbResult = new List<RegAttivitaModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"UserLastRec | {source} in: {ts.TotalMilliseconds} ms");
return dbResult;
}
#endregion Public Methods
#region Protected Fields
@@ -1644,27 +1798,17 @@ namespace GPW.CORE.WRKLOG.Data
protected const string rKeyCalendari = $"{redisBaseAddr}:Cache:Calendari";
protected const string rKeyCliAll = $"{redisBaseAddr}:Cache:CliAll";
protected const string rKeyConfig = $"{redisBaseAddr}:Cache:Config";
protected const string rKeyDailyData = $"{redisBaseAddr}:Cache:DailyData";
protected const string rKeyLastRegAtt = $"{redisBaseAddr}:Cache:LastRegAtt";
protected const string rKeyDipendenti = $"{redisBaseAddr}:Cache:Dipendenti";
protected const string rKeyEventListDip = $"{redisBaseAddr}:Cache:EventListDip";
protected const string rKeyFasiAll = $"{redisBaseAddr}:Cache:FasiAll";
protected const string rKeyFasiByProj = $"{redisBaseAddr}:Cache:FasiByProj";
protected const string rKeyFasiSearch = $"{redisBaseAddr}:Cache:FasiSearch";
protected const string rKeyGiust = $"{redisBaseAddr}:Cache:Giustif";
protected const string rKeyGrpAll = $"{redisBaseAddr}:Cache:GrpAll";
protected const string rKeyGrpUser = $"{redisBaseAddr}:Cache:GrpUser";
protected const string rKeyLastRegAtt = $"{redisBaseAddr}:Cache:LastRegAtt";
protected const string rKeyParetoRegAtt = $"{redisBaseAddr}:Cache:ParetoRegAtt";
protected const string rKeyProjAll = $"{redisBaseAddr}:Cache:ProjAll";
@@ -1748,12 +1892,12 @@ namespace GPW.CORE.WRKLOG.Data
private readonly IEmailSender _emailSender;
/// <summary>
/// Durata cache lunga IN SECONDI
/// Durata cache lunga IN SECONDI (5 min std)
/// </summary>
private int cacheTtlLong = 60 * 5;
/// <summary>
/// Durata cache breve IN SECONDI
/// Durata cache breve IN SECONDI (1 min)
/// </summary>
private int cacheTtlShort = 60 * 1;
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>4.1.2409.0619</Version>
<Version>4.1.2409.0710</Version>
</PropertyGroup>
<ItemGroup>
@@ -7,7 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAw3dMMgC4FUywyOTV2xvCRgAAAAACAAAAAAADZgAAwAAAABAAAADrbAogtj/xpZqylbgs9Hb3AAAAAASAAACgAAAAEAAAAFm1lcdH7oj+NFy4QgZ7q18YAAAAROPsyRR12dhPTKfMEQ5yNCAZJ5K7C4pvFAAAAEFBVTwItjyYP2BlOTsuK1g9myQ8</EncryptedPassword>
<History>True|2024-09-06T16:20:28.3994458Z||;True|2024-09-05T10:43:51.3246848+02:00||;True|2024-09-05T10:26:17.6114175+02:00||;True|2024-09-05T09:25:03.5122942+02:00||;True|2024-09-04T18:21:49.9717603+02:00||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||;</History>
<History>True|2024-09-06T17:01:32.2132061Z||;True|2024-09-06T18:20:28.3994458+02:00||;True|2024-09-05T10:43:51.3246848+02:00||;True|2024-09-05T10:26:17.6114175+02:00||;True|2024-09-05T09:25:03.5122942+02:00||;True|2024-09-04T18:21:49.9717603+02:00||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
@@ -7,7 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAw3dMMgC4FUywyOTV2xvCRgAAAAACAAAAAAADZgAAwAAAABAAAACGzXDK3zvXrM23DG9mcGE7AAAAAASAAACgAAAAEAAAAGyTdpfrCO34B/zMyya7+GAYAAAA0bmIiJbto8OwHhtlJG6RVMBv+aGxPm7pFAAAAF/Yr6uOS9vHRpx6NybbZsJ0uMXC</EncryptedPassword>
<History>True|2024-09-06T16:19:44.1573989Z||;True|2024-09-05T10:44:09.9210584+02:00||;True|2024-09-05T10:25:37.0910150+02:00||;True|2024-09-05T10:22:08.9121789+02:00||;True|2024-09-05T09:25:44.4904558+02:00||;True|2024-09-04T18:03:12.0806897+02:00||;True|2023-04-27T16:41:43.3590124+02:00||;True|2023-04-27T16:40:30.4059588+02:00||;True|2023-03-24T19:29:18.9230558+01:00||;True|2022-04-21T18:35:38.6752750+02:00||;False|2022-04-21T18:33:27.2112658+02:00||;</History>
<History>True|2024-09-06T17:02:31.7174140Z||;True|2024-09-06T18:19:44.1573989+02:00||;True|2024-09-05T10:44:09.9210584+02:00||;True|2024-09-05T10:25:37.0910150+02:00||;True|2024-09-05T10:22:08.9121789+02:00||;True|2024-09-05T09:25:44.4904558+02:00||;True|2024-09-04T18:03:12.0806897+02:00||;True|2023-04-27T16:41:43.3590124+02:00||;True|2023-04-27T16:40:30.4059588+02:00||;True|2023-03-24T19:29:18.9230558+01:00||;True|2022-04-21T18:35:38.6752750+02:00||;False|2022-04-21T18:33:27.2112658+02:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 4.1.2409.0619</h4>
<h4>Versione: 4.1.2409.0710</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
4.1.2409.0619
4.1.2409.0710
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>4.1.2409.0619</version>
<version>4.1.2409.0710</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>