diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 541cde0..c9a4207 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
WebDoorCreator - Egalware
- Version: 0.9.2305.3111
+ Version: 0.9.2305.3114
Release note:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index a5a746c..9dec25a 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-0.9.2305.3111
+0.9.2305.3114
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index 29942b8..c42a4a1 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 0.9.2305.3111
+ 0.9.2305.3114
http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip
http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html
false
diff --git a/WebDoorCreator.UI/Components/Filters/OrderFilter.razor.cs b/WebDoorCreator.UI/Components/Filters/OrderFilter.razor.cs
index 0c2645e..489322e 100644
--- a/WebDoorCreator.UI/Components/Filters/OrderFilter.razor.cs
+++ b/WebDoorCreator.UI/Components/Filters/OrderFilter.razor.cs
@@ -8,23 +8,35 @@ namespace WebDoorCreator.UI.Components.Filters
{
public partial class OrderFilter
{
- private List? ListValuesAll = null;
+ #region Public Properties
[Parameter]
public OrderSelectFilter actFilter { get; set; } = new OrderSelectFilter();
public CompanyModel? compToShow { get; set; } = null;
+ public EventCallback
> E_UserClaims { get; set; }
+ public EventCallback E_UserCurrCompany { get; set; }
+ public EventCallback E_UserId { get; set; }
+ public EventCallback E_UserRole { get; set; }
[Parameter]
public EventCallback FilterUpdated { get; set; }
- public List listCompanies { get; set; } = new List();
- public async void OnNewUserCurrComp()
+
+ public List listRecord { get; set; } = new List();
+
+ public List? userClaimsList
{
- await InvokeAsync(() =>
+ get
{
- StateHasChanged();
- });
+ return WDCUService.userClaims;
+ }
+ set
+ {
+ WDCUService.userClaims = value;
+ reportChangeClaimsList();
+ }
}
+
public int userCurrCompany
{
get
@@ -40,16 +52,105 @@ namespace WebDoorCreator.UI.Components.Filters
}
}
}
- public EventCallback E_UserCurrCompany { get; set; }
- private void reportChangeCompany()
+
+ public string userId
{
- E_UserCurrCompany.InvokeAsync(userCurrCompany);
+ get
+ {
+ return WDCUService.userId;
+ }
+ set
+ {
+ WDCUService.userId = value;
+ reportUserId();
+ }
}
+
+ public string userRole
+ {
+ get
+ {
+ return WDCUService.userRole;
+ }
+ set
+ {
+ WDCUService.userRole = value;
+ reportChangeRole();
+ }
+ }
+
+ #endregion Public Properties
+
+ #region Public Methods
+
+ public async void OnNewUserCurrComp()
+ {
+ await InvokeAsync(() =>
+ {
+ StateHasChanged();
+ });
+ }
+
+ #endregion Public Methods
+
+ #region Protected Properties
+
+ protected bool isMenuShow { get; set; } = false;
+
+ protected List listCompanies
+ {
+ get => WDCUService.UserCompaniesList;
+ set => WDCUService.UserCompaniesList = value;
+ }
+
+ [Inject]
+ protected UserManDataService UDService { get; set; } = null!;
+
+ protected List? userClaims { get; set; } = null;
+
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
[Inject]
protected WebDoorCreatorService WDService { get; set; } = null!;
+
+ #endregion Protected Properties
+
+ #region Protected Methods
+
+ protected async Task closeMenu()
+ {
+ await Task.Delay(1);
+ isMenuShow = false;
+ }
+
+ protected override async Task OnInitializedAsync()
+ {
+ await Task.Delay(1);
+ WDCUService.EA_UserCurrCompany += OnNewUserCurrComp;
+ }
+
+ protected override async Task OnParametersSetAsync()
+ {
+ ListValuesAll = await WDService.ListValuesGetAll("All", "OrderStep");
+ }
+
+ protected async Task showMenu()
+ {
+ await Task.Delay(1);
+ isMenuShow = true;
+ }
+
+ #endregion Protected Methods
+
+ #region Private Fields
+
+ private List? ListValuesAll = null;
+
+ #endregion Private Fields
+
+ #region Private Properties
+
private DateTime dateFrom
{
get => actFilter.DateFrom;
@@ -98,149 +199,35 @@ namespace WebDoorCreator.UI.Components.Filters
}
}
- protected override async Task OnInitializedAsync()
- {
- await Task.Delay(1);
- WDCUService.EA_UserCurrCompany += OnNewUserCurrComp;
- await ReloadData();
- }
+ #endregion Private Properties
- public List listRecord { get; set; } = new List();
- public string userId
- {
- get
- {
- return WDCUService.userId;
- }
- set
- {
- WDCUService.userId = value;
- reportUserId();
- }
- }
- private void reportUserId()
- {
- E_UserId.InvokeAsync(userId);
- }
- public EventCallback E_UserId { get; set; }
- public EventCallback E_UserRole { get; set; }
- public string userRole
- {
- get
- {
- return WDCUService.userRole;
- }
- set
- {
- WDCUService.userRole = value;
- reportChangeRole();
- }
- }
- private void reportChangeRole()
- {
- E_UserRole.InvokeAsync(userRole);
- }
- protected List? userClaims { get; set; } = null;
- protected async Task ReloadData()
- {
- // reset preliminare
- listRecord = new List();
- //if (!NavManager.Uri.Contains("UserAdmin"))
- //{
- if (!string.IsNullOrEmpty(userId) && string.IsNullOrEmpty(userRole))
- {
- var obj = await WDCUService.UserDataGetByName(userId);
- if (obj != null)
- {
- userClaims = obj.Claims.ToList();
- if (userClaims != null)
- {
- if (obj.Roles.Contains("SuperAdmin"))
- {
- listCompanies = await WDService.CompanyGetByKey(0);
- }
- else
- {
- foreach (var item in obj.Claims.ToList())
- {
- List rawComp = await WDService.CompanyGetByKey(int.Parse(item.Value));
- if (rawComp != null)
- {
- CompanyModel comp2Add = rawComp?.FirstOrDefault()!;
- listCompanies.Add(comp2Add);
- }
- }
- }
- }
- // fix role
- if (obj.Roles != null)
- {
- var rawRole = obj.Roles.FirstOrDefault();
- userRole = !string.IsNullOrEmpty(rawRole) ? rawRole : "Undef";
- }
- }
- //fixSelCompany();
- userClaimsList = listRecord;
- }
- //}
- }
+ #region Private Methods
-
- protected bool isMenuShow { get; set; } = false;
- protected async Task showMenu()
- {
- await Task.Delay(1);
- isMenuShow = true;
- }
- protected async Task closeMenu()
- {
- await Task.Delay(1);
- isMenuShow = false;
- }
-
- protected void fixSelCompany()
- {
- // cerco tra le company disponibili quella salvata nel service...
- var selComp = listCompanies
- .Where(x => x.CompanyId == userCurrCompany)
- .FirstOrDefault();
- if (selComp != null)
- {
- // seleziono
- compToShow = selComp;
- }
- else
- {
- // seleziono la prima
- //compToShow = "*";
- }
- userCurrCompany = compToShow.CompanyId;
- }
- private void reportChangeClaimsList()
- {
- E_UserClaims.InvokeAsync(userClaimsList);
- }
- public EventCallback> E_UserClaims { get; set; }
- public List? userClaimsList
- {
- get
- {
- return WDCUService.userClaims;
- }
- set
- {
- WDCUService.userClaims = value;
- reportChangeClaimsList();
- }
- }
- protected override async Task OnParametersSetAsync()
- {
- ListValuesAll = await WDService.ListValuesGetAll("All", "OrderStep");
- //await ReloadData();
- }
private void ReportChange()
{
FilterUpdated.InvokeAsync(actFilter);
}
+
+ private void reportChangeClaimsList()
+ {
+ E_UserClaims.InvokeAsync(userClaimsList);
+ }
+
+ private void reportChangeCompany()
+ {
+ E_UserCurrCompany.InvokeAsync(userCurrCompany);
+ }
+
+ private void reportChangeRole()
+ {
+ E_UserRole.InvokeAsync(userRole);
+ }
+
+ private void reportUserId()
+ {
+ E_UserId.InvokeAsync(userId);
+ }
+
+ #endregion Private Methods
}
}
\ No newline at end of file
diff --git a/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs b/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs
index 7549bc6..2f30d3b 100644
--- a/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs
+++ b/WebDoorCreator.UI/Components/Gen/NavMenuHorizontal.razor.cs
@@ -21,9 +21,6 @@ namespace WebDoorCreator.UI.Components.Gen
public EventCallback E_UserRole { get; set; }
public EventCallback>> E_VocLemmas { get; set; }
- public List listCompanies { get; set; } = new List();
- protected List? userClaims { get; set; } = null;
-
public List listRecord { get; set; } = new List();
public Dictionary>? listVocLemmas
@@ -38,6 +35,7 @@ namespace WebDoorCreator.UI.Components.Gen
reportVocLemmas();
}
}
+
[Inject]
public NavigationManager NavManager { get; set; } = default!;
@@ -157,6 +155,17 @@ namespace WebDoorCreator.UI.Components.Gen
[Inject]
protected AuthenticationStateProvider ASProvider { get; set; } = null!;
+ protected List listCompanies
+ {
+ get => WDCUService.UserCompaniesList;
+ set => WDCUService.UserCompaniesList = value;
+ }
+
+ [Inject]
+ protected UserManDataService UMService { get; set; } = null!;
+
+ protected List? userClaims { get; set; } = null;
+
protected string userLang
{
get => WDCUService.currLanguage ?? "EN";
@@ -168,8 +177,6 @@ namespace WebDoorCreator.UI.Components.Gen
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
- [Inject]
- protected UserManDataService UMService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
@@ -206,7 +213,6 @@ namespace WebDoorCreator.UI.Components.Gen
WDCUService.EA_UserClaims += OnNewUserClaims;
WDCUService.EA_UserCurrCompany += OnNewUserCurrComp;
WDCUService.EA_UserId += OnNewUserId;
- //WDCVService.EA_VocabularyLemmas += OnNewVocLemma;
}
protected override async Task OnParametersSetAsync()
@@ -233,44 +239,41 @@ namespace WebDoorCreator.UI.Components.Gen
{
// reset preliminare
listRecord = new List();
- //if (!NavManager.Uri.Contains("UserAdmin"))
- //{
- if (!string.IsNullOrEmpty(userId) && string.IsNullOrEmpty(userRole))
+ if (!string.IsNullOrEmpty(userId) && string.IsNullOrEmpty(userRole))
+ {
+ var obj = await UMService.UserDataGetByName(userId);
+ if (obj != null)
{
- var obj = await UMService.UserDataGetByName(userId);
- if (obj != null)
+ userClaims = obj.Claims.ToList();
+ if (userClaims != null)
{
- userClaims = obj.Claims.ToList();
- if (userClaims != null)
+ if (obj.Roles.Contains("SuperAdmin"))
{
- if (obj.Roles.Contains("SuperAdmin"))
+ listCompanies = await WDCService.CompanyGetByKey(0);
+ }
+ else
+ {
+ foreach (var item in obj.Claims.ToList())
{
- listCompanies = await WDCService.CompanyGetByKey(0);
- }
- else
- {
- foreach (var item in obj.Claims.ToList())
+ List rawComp = await WDCService.CompanyGetByKey(int.Parse(item.Value));
+ if (rawComp != null)
{
- List rawComp = await WDCService.CompanyGetByKey(int.Parse(item.Value));
- if (rawComp != null)
- {
- CompanyModel comp2Add = rawComp?.FirstOrDefault()!;
- listCompanies.Add(comp2Add);
- }
+ CompanyModel comp2Add = rawComp?.FirstOrDefault()!;
+ listCompanies.Add(comp2Add);
}
}
}
- // fix role
- if (obj.Roles != null)
- {
- var rawRole = obj.Roles.FirstOrDefault();
- userRole = !string.IsNullOrEmpty(rawRole) ? rawRole : "Undef";
- }
}
- fixSelCompany();
- userClaimsList = listRecord;
+ // fix role
+ if (obj.Roles != null)
+ {
+ var rawRole = obj.Roles.FirstOrDefault();
+ userRole = !string.IsNullOrEmpty(rawRole) ? rawRole : "Undef";
+ }
}
- //}
+ fixSelCompany();
+ userClaimsList = listRecord;
+ }
}
#endregion Protected Methods
diff --git a/WebDoorCreator.UI/Data/WDCUserService.cs b/WebDoorCreator.UI/Data/WDCUserService.cs
index 199f3a0..bdd9a75 100644
--- a/WebDoorCreator.UI/Data/WDCUserService.cs
+++ b/WebDoorCreator.UI/Data/WDCUserService.cs
@@ -2,6 +2,7 @@
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
+using WebDoorCreator.Data.DbModels;
namespace WebDoorCreator.UI.Data
{
@@ -101,6 +102,9 @@ namespace WebDoorCreator.UI.Data
}
}
+
+ public List UserCompaniesList { get; set; } = new List();
+
public Dictionary UserPref { get; set; } = new Dictionary();
public string userRole
@@ -354,208 +358,6 @@ namespace WebDoorCreator.UI.Data
#endregion Protected Methods
-#if false
- ///
- /// Dati utente CLAIMS da REDIS o DB
- ///
- ///
- protected async Task> UserClaimsById(IdentityUser UserIdent)
- {
- string source = "DB";
- List dataResult = new List();
- // cerco da cache
- string currKey = $"{Constants.rKeyUsersData}:Claims:{UserIdent.Id}";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string? rawData = await redisDb.StringGetAsync(currKey);
- if (!string.IsNullOrEmpty(rawData))
- {
- source = "REDIS";
- var tempResult = JsonConvert.DeserializeObject>(rawData, new ClaimConverter());
- if (tempResult != null)
- {
- dataResult = tempResult;
- }
- }
- else
- {
- var rawResult = await _userManager.GetClaimsAsync(UserIdent);
- dataResult = rawResult.ToList();
- rawData = JsonConvert.SerializeObject(dataResult, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
- }
- if (dataResult == null)
- {
- dataResult = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"UserClaimsById | {source} in: {ts.TotalMilliseconds} ms");
- return dataResult;
- }
-
- ///
- /// Dati utente IDENTITY da REDIS o DB da UID
- ///
- ///
- protected async Task UserIdentityById(string UserId)
- {
- string source = "DB";
- IdentityUser dataResult = new IdentityUser();
- // cerco da cache
- string currKey = $"{Constants.rKeyUsersData}:Identity:{UserId}";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string? rawData = await redisDb.StringGetAsync(currKey);
- if (!string.IsNullOrEmpty(rawData))
- {
- source = "REDIS";
- var tempResult = JsonConvert.DeserializeObject(rawData);
- if (tempResult != null)
- {
- dataResult = tempResult;
- }
- }
- else
- {
- dataResult = await _userManager.FindByIdAsync(UserId);
- rawData = JsonConvert.SerializeObject(dataResult, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
- }
- if (dataResult == null)
- {
- dataResult = new IdentityUser();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"UserIdentityById | {source} in: {ts.TotalMilliseconds} ms");
- return dataResult;
- }
- ///
- /// Dati utente IDENTITY da REDIS o DB per NAME
- ///
- ///
- protected async Task UserIdentityByName(string uName)
- {
- string source = "DB";
- IdentityUser dataResult = new IdentityUser();
- // cerco da cache
- string currKey = $"{Constants.rKeyUsersData}:UN:{uName}";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string? rawData = await redisDb.StringGetAsync(currKey);
- if (!string.IsNullOrEmpty(rawData))
- {
- source = "REDIS";
- var tempResult = JsonConvert.DeserializeObject(rawData);
- if (tempResult != null)
- {
- dataResult = tempResult;
- }
- }
- else
- {
- dataResult = await _userManager.FindByNameAsync(uName);
- rawData = JsonConvert.SerializeObject(dataResult, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
- }
- if (dataResult == null)
- {
- dataResult = new IdentityUser();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"UserIdentityByName | {source} in: {ts.TotalMilliseconds} ms");
- return dataResult;
- }
-
- ///
- /// Dati utente IDENTITY in modalità SEARCH da REDIS o DB
- ///
- ///
- protected async Task> UserIdentityBySearch(string searchVal)
- {
- string source = "DB";
- List dataResult = new List();
- // cerco da cache
- string currKey = $"{Constants.rKeyUsersDataSearch}:{searchVal}";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string? rawData = await redisDb.StringGetAsync(currKey);
- if (!string.IsNullOrEmpty(rawData))
- {
- source = "REDIS";
- var tempResult = JsonConvert.DeserializeObject>(rawData);
- if (tempResult != null)
- {
- dataResult = tempResult;
- }
- }
- else
- {
- var allData = await UserDataGetAll();
- if (!string.IsNullOrEmpty(searchVal))
- {
- dataResult = allData
- .Where(x => x.NormalizedEmail.Contains(searchVal.ToUpper()) || x.NormalizedUserName.Contains(searchVal.ToUpper())).ToList();
- }
- else
- {
- dataResult = allData;
- }
- rawData = JsonConvert.SerializeObject(dataResult, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
- }
- if (dataResult == null)
- {
- dataResult = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"UserIdentityBySearch | {source} in: {ts.TotalMilliseconds} ms");
- return dataResult;
- }
-
- ///
- /// Dati utente ROLES da REDIS o DB
- ///
- ///
- protected async Task> UserRolesById(IdentityUser UserIdent)
- {
- string source = "DB";
- List dataResult = new List();
- // cerco da cache
- string currKey = $"{Constants.rKeyUsersData}:Roles:{UserIdent.Id}";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string? rawData = await redisDb.StringGetAsync(currKey);
- if (!string.IsNullOrEmpty(rawData))
- {
- source = "REDIS";
- var tempResult = JsonConvert.DeserializeObject>(rawData);
- if (tempResult != null)
- {
- dataResult = tempResult;
- }
- }
- else
- {
- var rawResult = await _userManager.GetRolesAsync(UserIdent);
- dataResult = rawResult.ToList();
- rawData = JsonConvert.SerializeObject(dataResult, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
- }
- if (dataResult == null)
- {
- dataResult = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"UserRolesById | {source} in: {ts.TotalMilliseconds} ms");
- return dataResult;
- }
-#endif
-
#region Private Fields
private static JsonSerializerSettings? JSSettings;
diff --git a/WebDoorCreator.UI/WebDoorCreator.UI.csproj b/WebDoorCreator.UI/WebDoorCreator.UI.csproj
index 12d021a..914e862 100644
--- a/WebDoorCreator.UI/WebDoorCreator.UI.csproj
+++ b/WebDoorCreator.UI/WebDoorCreator.UI.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 0.9.2305.3111
+ 0.9.2305.3114
enable
aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608