From dc8ce10b51bed4e2bef86b363f458d3299ff82f6 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 26 Aug 2021 18:02:01 +0200 Subject: [PATCH] Update x ricerca utenti --- GWMS.UI/GWMS.UI.csproj | 2 +- GWMS.UI/Pages/UserAdmin.razor.cs | 36 +++++++++++++++++++++++++++++++- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index 78b999b..4087884 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net5.0 - 1.0.2108.2617 + 1.0.2108.2618 95c9f021-52d1-4390-a670-5810b7b777b0 diff --git a/GWMS.UI/Pages/UserAdmin.razor.cs b/GWMS.UI/Pages/UserAdmin.razor.cs index 5f2aed7..1335743 100644 --- a/GWMS.UI/Pages/UserAdmin.razor.cs +++ b/GWMS.UI/Pages/UserAdmin.razor.cs @@ -103,6 +103,9 @@ namespace GWMS.UI.Pages private bool isLoading { get; set; } = false; + [Inject] + private MessageService MessageService { get; set; } + private int numRecord { get => _numRecord; @@ -151,6 +154,18 @@ namespace GWMS.UI.Pages #endregion Protected Properties + #region Public Properties + + public string searchVal + { + get + { + return MessageService.SearchVal; + } + } + + #endregion Public Properties + #region Private Methods private void AddNewUser() @@ -427,6 +442,7 @@ namespace GWMS.UI.Pages AppMService.ShowSearch = true; AppMService.PageName = "Gestione Utenti"; AppMService.PageIcon = "fas fa-users pr-2"; + AppMService.EA_SearchUpdated += OnSeachUpdated; // lettura dati await GetUsers(); await CheckSuperAdmin(); @@ -443,6 +459,7 @@ namespace GWMS.UI.Pages public void Dispose() { + AppMService.EA_SearchUpdated -= OnSeachUpdated; } /// @@ -455,7 +472,15 @@ namespace GWMS.UI.Pages // Collection to hold users UsersList = new List(); // get users from _UserManager - RawList = _UserManager.Users.ToList(); + var allData = _UserManager.Users.ToList(); + if (!string.IsNullOrEmpty(searchVal)) + { + RawList = allData.Where(x => x.NormalizedEmail.Contains(searchVal.ToUpper()) || x.NormalizedUserName.Contains(searchVal.ToUpper())).ToList(); + } + else + { + RawList = allData; + } var user = RawList.Skip(numRecord * (currPage - 1)).Take(numRecord).Select(x => new IdentityUser { Id = x.Id, @@ -481,6 +506,15 @@ namespace GWMS.UI.Pages } } + public async void OnSeachUpdated() + { + await GetUsers(); + await InvokeAsync(() => + { + StateHasChanged(); + }); + } + public string ShowClaims(List ClaimList) { string answ = string.Join(",", ClaimList); diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 420728e..b9189c5 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ GWMS - Gas Warehouse Management System -

Versione: 1.0.2108.2617

+

Versione: 1.0.2108.2618


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 7df1950..4785336 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2108.2617 +1.0.2108.2618 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index ef8c0a4..317fc1e 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2108.2617 + 1.0.2108.2618 http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html false