From c35d625c36a4cb98318ebf9080e6292263b2d041 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 4 Jul 2022 19:11:55 +0200 Subject: [PATCH] Gestioen QRCode filt - completata correzione selezione con distinct - fix join come richeista Gian --- MP.AppAuth/Controllers/AppAuthController.cs | 12 ++++++---- MP.Land/Components/DataPager.razor | 6 ++--- MP.Land/Components/DataPager.razor.cs | 2 +- MP.Land/Components/UserCard.razor | 2 +- MP.Land/Data/AppAuthService.cs | 7 +++++- MP.Land/Data/SelectData.cs | 2 +- MP.Land/MP.Land.csproj | 2 +- MP.Land/Pages/UserQr.razor.cs | 16 ++++++------- MP.Land/Pages/_Host.cshtml | 26 --------------------- MP.Land/Resources/ChangeLog.html | 2 +- MP.Land/Resources/VersNum.txt | 2 +- MP.Land/Resources/manifest.xml | 2 +- MP.Land/wwwroot/lib/qrHelper.js | 4 ++-- 13 files changed, 33 insertions(+), 52 deletions(-) diff --git a/MP.AppAuth/Controllers/AppAuthController.cs b/MP.AppAuth/Controllers/AppAuthController.cs index 28e2c0c3..d11119dc 100644 --- a/MP.AppAuth/Controllers/AppAuthController.cs +++ b/MP.AppAuth/Controllers/AppAuthController.cs @@ -85,7 +85,7 @@ namespace MP.AppAuth.Controllers // ritorno return dbResult; } - public List AnagOpByGruppoGetAll(string codGruppo, string searchVal) + public List AnagOpByGruppoGetFilt(string codGruppo, string searchVal) { List dbResult = new List(); using (AppAuthContext localDbCtx = new AppAuthContext(_configuration)) @@ -94,25 +94,27 @@ namespace MP.AppAuth.Controllers { dbResult = localDbCtx .DbSetGruppi2Oper - .Where(x => x.CodGruppo == codGruppo) + .Where(x => x.CodGruppo == codGruppo || string.IsNullOrEmpty(codGruppo)) .Join( localDbCtx.DbSetAnagOpr.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal)), gruppo => gruppo.MatrOpr, operatore => operatore.MatrOpr, (gruppo, operatore) => operatore - ).ToList(); + ) + .ToList(); } else { dbResult = localDbCtx .DbSetGruppi2Oper - .Where(x => x.CodGruppo == codGruppo) + .Where(x => x.CodGruppo == codGruppo || string.IsNullOrEmpty(codGruppo)) .Join( localDbCtx.DbSetAnagOpr, gruppo => gruppo.MatrOpr, operatore => operatore.MatrOpr, (gruppo, operatore) => operatore - ).ToList(); + ) + .ToList(); } } // ritorno diff --git a/MP.Land/Components/DataPager.razor b/MP.Land/Components/DataPager.razor index 111f1ae0..7c046b68 100644 --- a/MP.Land/Components/DataPager.razor +++ b/MP.Land/Components/DataPager.razor @@ -42,9 +42,9 @@ {
} diff --git a/MP.Land/Components/DataPager.razor.cs b/MP.Land/Components/DataPager.razor.cs index 3b6266a8..62cd969c 100644 --- a/MP.Land/Components/DataPager.razor.cs +++ b/MP.Land/Components/DataPager.razor.cs @@ -71,7 +71,7 @@ namespace MP.Land.Components protected int _numPage { get; set; } = 1; - protected int _numRecord { get; set; } = 4; + protected int _numRecord { get; set; } = 6; protected int percLoading { get; set; } = 0; diff --git a/MP.Land/Components/UserCard.razor b/MP.Land/Components/UserCard.razor index 38770524..0077a896 100644 --- a/MP.Land/Components/UserCard.razor +++ b/MP.Land/Components/UserCard.razor @@ -31,7 +31,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { - if (!firstRender) + if (firstRender) { await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{CurrItem.MatrOpr}"); await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{CurrItem.MatrOpr}", rawCode); diff --git a/MP.Land/Data/AppAuthService.cs b/MP.Land/Data/AppAuthService.cs index a5f335c3..85391a37 100644 --- a/MP.Land/Data/AppAuthService.cs +++ b/MP.Land/Data/AppAuthService.cs @@ -157,7 +157,12 @@ namespace MP.Land.Data List dbResult = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.AnagOpByGruppoGetAll(codGruppo, searchVal); + var rawData = dbController + .AnagOpByGruppoGetFilt(codGruppo, searchVal); + dbResult = rawData + .GroupBy(user => user.MatrOpr) + .Select(grp => grp.First()) + .ToList(); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; Log.Trace($"Effettuata lettura da DB per AnagOperByGroupList: {ts.TotalMilliseconds} ms"); diff --git a/MP.Land/Data/SelectData.cs b/MP.Land/Data/SelectData.cs index a54fd4a3..30ec5baa 100644 --- a/MP.Land/Data/SelectData.cs +++ b/MP.Land/Data/SelectData.cs @@ -44,7 +44,7 @@ namespace MP.Land.Data public bool OnlyMod { get; set; } = false; public bool OnlyNoTag { get; set; } = false; public int PageNum { get; set; } = 1; - public int PageSize { get; set; } = 4; + public int PageSize { get; set; } = 6; public string SearchVal { get; set; } = ""; public string Tag { get; set; } = ""; diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index fb56fa5f..96bb841d 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.15.2207.0418 + 6.15.2207.0419 diff --git a/MP.Land/Pages/UserQr.razor.cs b/MP.Land/Pages/UserQr.razor.cs index ddda6184..8d6fa48a 100644 --- a/MP.Land/Pages/UserQr.razor.cs +++ b/MP.Land/Pages/UserQr.razor.cs @@ -160,15 +160,15 @@ namespace MP.Land.Pages // importante altrimenti NON mostra update UI await Task.Delay(1); // se ho selezionato qualcosa cerco x gruppo - if (groupName != "") - { + //if (groupName != "") + //{ SearchRecords = await DataService.AnagOperByGroupList(groupName, AppMService.SearchVal); - } - else - { - //altrimenti TUTTI - SearchRecords = await DataService.AnagOperList(AppMService.SearchVal); - } + //} + //else + //{ + // //altrimenti TUTTI + // SearchRecords = await DataService.AnagOperList(AppMService.SearchVal); + //} ListRecords = SearchRecords.Skip((currPage - 1) * numRecord).Take(numRecord).ToList(); totalCount = SearchRecords.Count(); await Task.Delay(1); diff --git a/MP.Land/Pages/_Host.cshtml b/MP.Land/Pages/_Host.cshtml index f058a721..3f885c73 100644 --- a/MP.Land/Pages/_Host.cshtml +++ b/MP.Land/Pages/_Host.cshtml @@ -53,31 +53,5 @@ - @**@ \ No newline at end of file diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 2183c79e..5abaaa2a 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

Versione: 6.15.2207.0418

+

Versione: 6.15.2207.0419


Note di rilascio:
    diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index 83f4cc2b..21dd9517 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.15.2207.0418 +6.15.2207.0419 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 0f65a24d..fd1cc5ed 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.15.2207.0418 + 6.15.2207.0419 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/wwwroot/lib/qrHelper.js b/MP.Land/wwwroot/lib/qrHelper.js index 1fcff906..5ddd7ceb 100644 --- a/MP.Land/wwwroot/lib/qrHelper.js +++ b/MP.Land/wwwroot/lib/qrHelper.js @@ -1,11 +1,11 @@ function clearContent(elementID) { - console.log(elementID); + console.log("Remove " + elementID); document.getElementById(elementID).innerHTML = ""; } // gestione qrcode... da https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity-enable-qrcodes?view=aspnetcore-5.0 //var qrcode = new QRCode("qrCodeImg"); function displayQr(elementName, rawData) { - console.log(elementName); + console.log("Add " + elementName); try { if (elementName != "" && rawData != "") { qrcode = new QRCode(document.getElementById(elementName),