Inizio gestione UserLang corretta

This commit is contained in:
Samuele Locatelli
2024-10-12 16:08:01 +02:00
parent ff75bc3d68
commit 38401093df
25 changed files with 304 additions and 154 deletions
@@ -88,7 +88,7 @@
<table class="table table-striped table-sm text-start">
<thead>
<tr class="">
<th>
<th class="text-nowrap">
<button class="btn btn-primary btn-sm" @onclick="() => ForceReload(true)"><i class="fa-solid fa-rotate"></i></button>
</th>
<th>Gruppo <Sorter ParamName="CodGruppo" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter></th>
@@ -103,7 +103,7 @@
@foreach (var item in ListRecords)
{
<tr class="align-middle @CheckSel(item)">
<td>
<td class="text-nowrap">
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(item)"><i class="fa-solid fa-search"></i></button>
@if (SelItem == null)
{
@@ -163,7 +163,6 @@
}
</div>
</div>
</div>
</div>
@@ -27,20 +27,26 @@
}
</div>
<div class="px-1">
@if (showSearch)
{
<div class="px-1">
<div class="input-group" title="ricerca">
<span class="input-group-text"><i class="fas fa-search"></i></span>
<input type="text" class="form-control" @bind="@searchVal" accesskey="/" placeholder="[Alt-/] to select">
<button class="btn btn-outline-secondary" @onclick="resetSearch"><i class="fas fa-ban"></i></button>
<div class="d-flex">
@if (showSearch)
{
<div class="px-1">
<div class="input-group" title="ricerca">
<span class="input-group-text"><i class="fas fa-search"></i></span>
<input type="text" class="form-control" @bind="@searchVal" accesskey="/" placeholder="[Alt-/] to select">
<button class="btn btn-outline-secondary" @onclick="resetSearch"><i class="fas fa-ban"></i></button>
</div>
</div>
}
<div class="px-1">
<select @bind="@UserLang" class="form-select" @bind:after="SaveLang">
@foreach (var item in ListLingue)
{
<option value="@item">@item</option>
}
</select>
</div>
}
else
{
<p>-</p>
}
</div>
</div>
</div>
</AuthorizeView>
@@ -29,9 +29,18 @@ namespace GPW.CORE.ADM.Components.Compo
[Inject]
protected MessageService AppMServ { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
[Inject]
protected AppAuthService AuthServ { get; set; } = null!;
[Inject]
protected AppAuthService AuthService { get; set; } = null!;
[Inject]
protected IConfiguration config { get; set; } = null!;
@@ -45,12 +54,23 @@ namespace GPW.CORE.ADM.Components.Compo
[Inject]
protected LicenseService LicServ { get; set; } = null!;
protected List<string> ListLingue
{
get => AuthServ.Lingue;
}
protected string searchVal
{
get => AppMServ.SearchVal;
set => AppMServ.SearchVal = value;
}
protected string UserLang
{
get => AppMServ.UserLang;
set => AppMServ.UserLang = value;
}
#endregion Protected Properties
#region Protected Methods
@@ -130,6 +150,8 @@ namespace GPW.CORE.ADM.Components.Compo
AppMServ.RigaDip = null;
await Task.Delay(1);
await LoadUtente();
// recupero dati conf lingua...
await ReloadLang();
// verifico attivazione dipendente...
await checkUserLicense();
}
@@ -144,9 +166,6 @@ namespace GPW.CORE.ADM.Components.Compo
await VerifyActiv();
}
[Inject]
protected AppAuthService AuthService { get; set; } = null!;
protected async Task LoadUtente()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
@@ -164,7 +183,7 @@ namespace GPW.CORE.ADM.Components.Compo
userName = $"{rigaDip.Cognome} {rigaDip.Nome}";
idxDipendente = rigaDip.IdxDipendente;
// leggo e salvo in MsgService il menù utente...
var listMenu = await AuthService.MenuUtente(rigaDip.Utente);
var listMenu = await AuthService.MenuUtente(rigaDip.Utente, UserLang);
AppMServ.ListMenu = listMenu;
}
}
@@ -182,6 +201,8 @@ namespace GPW.CORE.ADM.Components.Compo
AppMServ.EA_HideSearch += AppMServ_EA_HideSearch;
AppMServ.EA_ShowSearch += AppMServ_EA_ShowSearch;
AppMServ.EA_PageUpdated += AppMServ_EA_PageUpdated;
// leggo lingue...
UserLang = await AppMServ.UserLangGet();
// leggo lista dip
ListaDip = await GDataServ.DipendentiGetAll();
numTot = ListaDip.Count(x => x.Attivo == true);
@@ -199,27 +220,6 @@ namespace GPW.CORE.ADM.Components.Compo
await VerifPresenze(false);
}
private void AppMServ_EA_PageUpdated()
{
PageTitle = AppMServ.PageName;
PageIcon = AppMServ.PageIcon;
InvokeAsync(StateHasChanged);
}
private string PageTitle = "";
private string PageIcon = "";
private bool showSearch = false;
private void AppMServ_EA_ShowSearch()
{
showSearch = true;
}
private void AppMServ_EA_HideSearch()
{
showSearch = false;
}
protected void resetSearch()
{
searchVal = "";
@@ -256,6 +256,12 @@ namespace GPW.CORE.ADM.Components.Compo
private int numTot = 0;
private string PageIcon = "";
private string PageTitle = "";
private bool showSearch = false;
private string userName = "";
#endregion Private Fields
@@ -271,6 +277,23 @@ namespace GPW.CORE.ADM.Components.Compo
#region Private Methods
private void AppMServ_EA_HideSearch()
{
showSearch = false;
}
private void AppMServ_EA_PageUpdated()
{
PageTitle = AppMServ.PageName;
PageIcon = AppMServ.PageIcon;
InvokeAsync(StateHasChanged);
}
private void AppMServ_EA_ShowSearch()
{
showSearch = true;
}
private void checkAdmin()
{
// leggo elenco admin
@@ -317,6 +340,11 @@ namespace GPW.CORE.ADM.Components.Compo
}
}
private async Task ReloadLang()
{
UserLang = await AppMServ.UserLangGet();
}
/// <summary>
/// Chiama reset messaggio dopo un periodo di sec richiesto...
/// </summary>
@@ -330,6 +358,13 @@ namespace GPW.CORE.ADM.Components.Compo
await InvokeAsync(StateHasChanged);
}
private async void SaveLang()
{
await AppMServ.UserLangSet(UserLang);
// vado a pagina reload...
NavMan.NavigateTo("ForceReset", true);
}
private void updateDisplay(TimbratureModel timbData)
{
string tipo = timbData.Entrata ?? true ? "IN" : "OUT";
@@ -203,9 +203,14 @@ namespace GPW.CORE.ADM.Components.Compo
await ReloadData();
}
protected string UserLang
{
get => AppMServ.UserLang;
}
protected string Traduci(string lemma)
{
return AuthServ.Traduci(lemma);
return AuthServ.Traduci(lemma, UserLang);
}
#endregion Protected Methods
@@ -19,6 +19,7 @@ namespace GPW.CORE.ADM.Components.Layout
public void Dispose()
{
AppMServ.EA_MenuUpdated -= AppMServ_EA_MenuUpdated;
AppMServ.EA_LangSel -= AppMServ_EA_LangSel;
}
#endregion Public Methods
@@ -54,9 +55,16 @@ namespace GPW.CORE.ADM.Components.Layout
protected override void OnInitialized()
{
AppMServ.EA_MenuUpdated += AppMServ_EA_MenuUpdated;
AppMServ.EA_LangSel += AppMServ_EA_LangSel;
ReloadData();
}
private void AppMServ_EA_LangSel()
{
ReloadData();
InvokeAsync(StateHasChanged);
}
protected void ToggleCompress()
{
showText = !showText;
@@ -10,7 +10,7 @@
{
// imposto pagina e info testata
AppMServ.ShowSearch = false;
AppMServ.PageName = AuthServ.Traduci("ApprTimb");
AppMServ.PageName = AuthServ.Traduci("ApprTimb", AppMServ.UserLang);
AppMServ.PageIcon = AuthServ.Traduci("ApprTimbExpl");
}
}
@@ -1,7 +0,0 @@
@page "/ChLang"
<WIP></WIP>
@code {
}
+1 -1
View File
@@ -10,7 +10,7 @@
{
// imposto pagina e info testata
AppMServ.ShowSearch = true;
AppMServ.PageName = AuthServ.Traduci("ManClienti");
AppMServ.PageName = AuthServ.Traduci("ManClienti", AppMServ.UserLang);
AppMServ.PageIcon = AuthServ.Traduci("ManClientiExpl");
}
}
@@ -9,7 +9,7 @@
{
// imposto pagina e info testata
AppMServ.ShowSearch = false;
AppMServ.PageName = AuthServ.Traduci("ManOrarioTipo");
AppMServ.PageName = AuthServ.Traduci("ManOrarioTipo", AppMServ.UserLang);
AppMServ.PageIcon = AuthServ.Traduci("ManOrarioTipoExpl");
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
{
// imposto pagina e info testata
AppMServ.ShowSearch = false;
AppMServ.PageName = AuthServ.Traduci("ManGruppi");
AppMServ.PageName = AuthServ.Traduci("ManGruppi", AppMServ.UserLang);
AppMServ.PageIcon = AuthServ.Traduci("ManGruppiExpl");
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
protected override void OnInitialized()
{
AppMServ.ShowSearch = true;
AppMServ.PageName = AuthServ.Traduci("ManProg");
AppMServ.PageName = AuthServ.Traduci("ManProg", AppMServ.UserLang);
AppMServ.PageIcon = AuthServ.Traduci("ManProgExpl");
}
}
@@ -10,7 +10,7 @@
{
// imposto pagina e info testata
AppMServ.ShowSearch = true;
AppMServ.PageName = AuthServ.Traduci("reviewTimb");
AppMServ.PageName = AuthServ.Traduci("reviewTimb", AppMServ.UserLang);
AppMServ.PageIcon = AuthServ.Traduci("reviewTimbExpl");
}
}
@@ -8,7 +8,7 @@
protected override void OnInitialized()
{
AppMServ.ShowSearch = true;
AppMServ.PageName = AuthServ.Traduci("SpostaFasi");
AppMServ.PageName = AuthServ.Traduci("SpostaFasi", AppMServ.UserLang);
AppMServ.PageIcon = AuthServ.Traduci("SpostaFasiExpl");
}
}
+1 -1
View File
@@ -11,7 +11,7 @@
{
// imposto pagina e info testata
AppMServ.ShowSearch = true;
AppMServ.PageName = AuthServ.Traduci("ManTags");
AppMServ.PageName = AuthServ.Traduci("ManTags", AppMServ.UserLang);
AppMServ.PageIcon = AuthServ.Traduci("ManTagsExpl");
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>4.1.2410.0409</Version>
<Version>4.1.2410.1215</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-13T17:29:52.0716814Z||;True|2024-09-13T18:38:16.4907845+02:00||;True|2024-09-13T09:22:22.8253732+02:00||;True|2024-09-12T16:07:39.0226825+02:00||;True|2024-09-12T10:58:30.2473031+02:00||;True|2024-09-12T10:03:37.9121520+02:00||;True|2024-09-11T19:18:09.6865317+02:00||;True|2024-09-11T17:21:29.6285775+02:00||;True|2024-09-11T17:06:36.9651346+02:00||;True|2024-09-10T17:58:48.6965236+02:00||;True|2024-09-10T15:56:39.2931971+02:00||;True|2024-09-10T12:27:20.6683309+02:00||;True|2024-09-07T10:37:21.9427027+02:00||;True|2024-09-06T19:01:32.2132061+02:00||;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>
<History>True|2024-10-04T08:17:22.7335334Z||;True|2024-09-13T19:29:52.0716814+02:00||;True|2024-09-13T18:38:16.4907845+02:00||;True|2024-09-13T09:22:22.8253732+02:00||;True|2024-09-12T16:07:39.0226825+02:00||;True|2024-09-12T10:58:30.2473031+02:00||;True|2024-09-12T10:03:37.9121520+02:00||;True|2024-09-11T19:18:09.6865317+02:00||;True|2024-09-11T17:21:29.6285775+02:00||;True|2024-09-11T17:06:36.9651346+02:00||;True|2024-09-10T17:58:48.6965236+02:00||;True|2024-09-10T15:56:39.2931971+02:00||;True|2024-09-10T12:27:20.6683309+02:00||;True|2024-09-07T10:37:21.9427027+02:00||;True|2024-09-06T19:01:32.2132061+02:00||;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>
+5 -5
View File
@@ -56,12 +56,12 @@
"ExternalProviders": {
"MailKit": {
"SMTP": {
"Address": "smtp-mail.outlook.com",
"Address": "smtp.gmail.com",
"Port": "587",
"Account": "steamwarebot@outlook.it",
"Password": "siamoInViaNazionale93!",
"SenderEmail": "steamwarebot@outlook.it",
"SenderName": "Steamware Email BOT"
"Account": "smtp.gmail.com",
"Password": "vpsad24068",
"SenderEmail": "smtp.gmail.com",
"SenderName": "EgalWare Email BOT"
}
}
},
+1
View File
@@ -58,6 +58,7 @@ namespace GPW.CORE.Data
#region Public Properties
public virtual DbSet<LingueModel> DbSetLingue { get; set; }
public virtual DbSet<PermessiModel> DbSetPermessi { get; set; } = null!;
public virtual DbSet<Permessi2FunzioneModel> DbSetPermessi2Funzione { get; set; } = null!;
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
+27 -8
View File
@@ -24,14 +24,28 @@ namespace GPW.CORE.Data.Controllers
#region Public Methods
public void Dispose()
{
// Clear database context
dbCtx.Dispose();
}
/// <summary>
/// Elenco lingue ammesse
/// </summary>
/// <returns></returns>
public List<LingueModel> LingueGetAll()
{
List<LingueModel> dbResult = new List<LingueModel>();
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
{
dbResult = localDbCtx
.DbSetLingue
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco completo permessi2funzione
/// </summary>
@@ -89,14 +103,14 @@ namespace GPW.CORE.Data.Controllers
public List<PermessiModel> PermessiGetByFunc(List<string> ListCodFun)
{
// converto a lower l'elenco...
ListCodFun=ListCodFun.Select(x => x.ToLower()).ToList();
ListCodFun = ListCodFun.Select(x => x.ToLower()).ToList();
List<PermessiModel> dbResult = new List<PermessiModel>();
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
{
var listPer = PermessiGetAll();
var listP2F_all = Permessi2FunzioneGetAll();
//var listP2F = Permessi2FunzioneGetFilt(ListCodFun);
var listP2F= listP2F_all
var listP2F = listP2F_all
.Where(x => ListCodFun.Contains(x.CodFunzione.ToLower()))
.Distinct()
.ToList();
@@ -139,7 +153,7 @@ namespace GPW.CORE.Data.Controllers
}
/// <summary>
/// Elenco Record x gestione Update
/// Vocabolario (completo)
/// </summary>
/// <returns></returns>
public List<VocabolarioModel> VocabolarioGetAll()
@@ -158,10 +172,15 @@ namespace GPW.CORE.Data.Controllers
#region Private Fields
private static IConfiguration _configuration { get; set; } = null!;
private static AppAuthContext dbCtx { get; set; } = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Properties
private static IConfiguration _configuration { get; set; } = null!;
private static AppAuthContext dbCtx { get; set; } = null!;
#endregion Private Properties
}
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GPW.CORE.Data.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("Lingue")]
public partial class LingueModel
{
#region Public Properties
[Key, MaxLength(3)]
public string Lingua { get; set; } = "";
[MaxLength(50)]
public string DescrizioneLingua { get; set; } = "";
#endregion Public Properties
}
}
+96 -77
View File
@@ -23,9 +23,7 @@ namespace GPW.CORE.Data.Services
// diritti (cablòato)
public const string RoleSuperAdmin = "MoonPro_SuperAdmin";
public static AppAuthController dbController { get; set; } = null!;
public static GPWController GpwDbController { get; set; } = null!;
public static AppUserController userController { get; set; } = null!;
public List<string> Lingue = new List<string>();
#endregion Public Fields
@@ -66,8 +64,15 @@ namespace GPW.CORE.Data.Services
#endregion Public Constructors
#region Public Methods
#region Public Properties
public static AppAuthController dbController { get; set; } = null!;
public static GPWController GpwDbController { get; set; } = null!;
public static AppUserController userController { get; set; } = null!;
#endregion Public Properties
#region Public Methods
public async Task<List<AnagKeyValueModel>> AnagKeyValList()
{
@@ -132,6 +137,66 @@ namespace GPW.CORE.Data.Services
CheckVoc();
}
/// <summary>
/// Menu pagine abilitate dato utente
/// </summary>
/// <param name="UserName"></param>
/// <returns></returns>
public async Task<List<MenuItemDTO>> MenuUtente(string UserName, string UserLang)
{
string source = "DB";
List<MenuItemDTO>? dbResult = new List<MenuItemDTO>();
string currKey = $"{rKeyMenuUser}:{UserName}:{UserLang}";
Stopwatch sw = new Stopwatch();
sw.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<MenuItemDTO>>(rawData);
if (tempResult == null)
{
dbResult = new List<MenuItemDTO>();
}
else
{
dbResult = tempResult;
}
}
else
{
// verifica preliminare vocabolario
CheckVoc();
// recupero permessi utente...
List<PermessiModel> userRightList = await PermessiGetByUser(UserName);
// converto in voce menù
dbResult = userRightList
// solo le vere voci di menù x parametri gruppo/numero
.Where(x => x.Numero > 0 && x.Gruppo < 999)
.OrderBy(g => g.Gruppo)
.ThenBy(n => n.Numero)
.Select(x => new MenuItemDTO
{
Url = x.Url,
Title = Traduci(x.Nome ?? x.Url, UserLang),
Descript = Traduci(x.Descrizione ?? "", UserLang),
Group = x.Gruppo ?? 0,
Num = x.Numero ?? 0
})
.ToList();
// salvo in redis...
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (dbResult == null)
{
dbResult = new List<MenuItemDTO>();
}
sw.Stop();
Log.Debug($"MenuUtente | {source} | {sw.ElapsedMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Elenco permessi dato utente
/// </summary>
@@ -182,67 +247,6 @@ namespace GPW.CORE.Data.Services
return dbResult;
}
/// <summary>
/// Menu pagine abilitate dato utente
/// </summary>
/// <param name="UserName"></param>
/// <returns></returns>
public async Task<List<MenuItemDTO>> MenuUtente(string UserName)
{
string source = "DB";
List<MenuItemDTO>? dbResult = new List<MenuItemDTO>();
string currKey = $"{rKeyMenuUser}:{UserName}";
Stopwatch sw = new Stopwatch();
sw.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<MenuItemDTO>>(rawData);
if (tempResult == null)
{
dbResult = new List<MenuItemDTO>();
}
else
{
dbResult = tempResult;
}
}
else
{
// verifica preliminare vocabolario
CheckVoc();
// recupero permessi utente...
List<PermessiModel> userRightList = await PermessiGetByUser(UserName);
// converto in voce menù
dbResult = userRightList
// solo le vere voci di menù x parametri gruppo/numero
.Where(x => x.Numero > 0 && x.Gruppo < 999)
.OrderBy(g => g.Gruppo)
.ThenBy(n => n.Numero)
.Select(x => new MenuItemDTO
{
Url = x.Url,
Title = Traduci(x.Nome??x.Url),
Descript = Traduci(x.Descrizione ?? ""),
Group = x.Gruppo ?? 0,
Num = x.Numero ?? 0
})
.ToList();
// salvo in redis...
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (dbResult == null)
{
dbResult = new List<MenuItemDTO>();
}
sw.Stop();
Log.Debug($"MenuUtente | {source} | {sw.ElapsedMilliseconds} ms");
return dbResult;
}
public string Traduci(string lemma, string lingua = "IT")
{
string answ = $"__{lemma}__";
@@ -256,7 +260,6 @@ namespace GPW.CORE.Data.Services
return answ;
}
#endregion Public Methods
#region Protected Methods
@@ -266,10 +269,31 @@ namespace GPW.CORE.Data.Services
if (Vocabolario.Count == 0)
{
string source = "DB";
string currKey = $"{redisBaseAddr}:MP:VOCAB";
string currKey = "";
string? rawData = "";
Stopwatch sw = new Stopwatch();
sw.Start();
string? rawData = redisDb.StringGet(currKey);
// lingue
currKey = $"{redisBaseAddr}:MP:LANG";
rawData = redisDb.StringGet(currKey);
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
{
var tempResult = JsonConvert.DeserializeObject<List<string>>(rawData);
Lingue = tempResult ?? new List<string>();
}
else
{
Lingue = dbController
.LingueGetAll()
.Select(x => x.Lingua)
.ToList();
rawData = JsonConvert.SerializeObject(Lingue);
redisDb.StringSet(currKey, rawData, UltraLongCache);
}
// vocabolario
currKey = $"{redisBaseAddr}:MP:VOCAB";
rawData = redisDb.StringGet(currKey);
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
{
source = "REDIS";
@@ -295,18 +319,13 @@ namespace GPW.CORE.Data.Services
// gestione key Redis
private const string redisBaseAddr = "GPW:ADM";
private const string rKeyDirittiUser = $"{redisBaseAddr}:DIR_USER";
private const string rKeyPermUser = $"{redisBaseAddr}:PERM_USER";
private const string rKeyMenuUser = $"{redisBaseAddr}:MENU_USER";
private static IConfiguration _configuration { get; set; } = null!;
private const string rKeyPermUser = $"{redisBaseAddr}:PERM_USER";
private static JsonSerializerSettings? JSSettings;
private static Logger Log = LogManager.GetCurrentClassLogger();
private static string Modulo = "";
/// <summary>
@@ -331,13 +350,13 @@ namespace GPW.CORE.Data.Services
private IDatabase redisDb = null!;
private Random rnd = new Random();
private Dictionary<string, string> Vocabolario = new Dictionary<string, string>();
#endregion Private Fields
#region Private Properties
private static IConfiguration _configuration { get; set; } = null!;
private string CodApp { get; set; } = "";
/// <summary>
@@ -397,4 +416,4 @@ namespace GPW.CORE.Data.Services
#endregion Private Methods
}
}
}
+42 -3
View File
@@ -30,6 +30,8 @@ namespace GPW.CORE.Data.Services
public event Action EA_HideSearch = null!;
public event Action EA_LangSel = null!;
public event Action EA_MenuUpdated = null!;
public event Action EA_PageUpdated = null!;
@@ -195,6 +197,22 @@ namespace GPW.CORE.Data.Services
public DateTime targetDate { get; set; } = DateTime.Today;
public string UserLang
{
get => userLang;
set
{
if (userLang != value)
{
userLang = value;
if (EA_LangSel != null)
{
EA_LangSel?.Invoke();
}
}
}
}
public string UserName
{
get
@@ -230,6 +248,24 @@ namespace GPW.CORE.Data.Services
await localStore.SetItemAsync($"{gridName}_nRow", newVal);
}
/// <summary>
/// Lingua richiesta da utente
/// </summary>
public async Task<string> UserLangGet()
{
var answ = await localStore.GetItemAsync<string>("UserLang");
answ = string.IsNullOrEmpty(answ) ? "IT" : answ;
return answ;
}
/// <summary>
/// Salva lingua utente
/// </summary>
public async Task UserLangSet(string userLangl)
{
await localStore.SetItemAsync("UserLang", userLang);
}
/// <summary>
/// Preferenza utente salvata in local storage
/// </summary>
@@ -268,7 +304,6 @@ namespace GPW.CORE.Data.Services
#region Protected Properties
protected List<MenuItemDTO> _listMenu { get; set; } = new List<MenuItemDTO>();
protected ILocalStorageService localStore { get; set; } = null!;
protected ISessionStorageService sessionStore { get; set; } = null!;
@@ -277,15 +312,19 @@ namespace GPW.CORE.Data.Services
#region Private Fields
private string _pageIcon = "";
private string _pageName = "";
private DipendentiModel? _rigaDip;
private string _searchVal = "";
private bool showSearch;
#endregion Private Fields
#region Private Properties
private string userLang { get; set; } = "IT";
#endregion Private Properties
#region Private Methods
private void ReportPageUpd()
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 4.1.2410.0409</h4>
<h4>Versione: 4.1.2410.1215</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
4.1.2410.0409
4.1.2410.1215
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>4.1.2410.0409</version>
<version>4.1.2410.1215</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>