From 2c1919c290b208e69bd8fee61d85a21dc58b1083 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 7 Aug 2024 17:34:12 +0200 Subject: [PATCH] Bozza gestione release applicativi --- LiMan.Api/Data/ApiDataService.cs | 8 +- LiMan.DB/Controllers/DbController.cs | 65 +++++++--- LiMan.Transfer/Resources/ChangeLog.html | 2 +- LiMan.Transfer/Resources/VersNum.txt | 2 +- LiMan.Transfer/Resources/manifest.xml | 2 +- LiMan.UI/Components/ListApplicazioni.razor | 38 +++--- LiMan.UI/Components/ListApplicazioni.razor.cs | 28 +++-- LiMan.UI/Components/ListReleases.razor | 68 ++++++++++ LiMan.UI/Components/ListReleases.razor.cs | 116 ++++++++++++++++++ LiMan.UI/Data/LiManDataService.cs | 37 ++++++ LiMan.UI/LiMan.UI.csproj | 2 +- LiMan.UI/Pages/Applicazioni.razor | 9 -- LiMan.UI/Pages/Applicazioni.razor.cs | 12 ++ LiMan.UI/Resources/ChangeLog.html | 2 +- LiMan.UI/Resources/VersNum.txt | 2 +- LiMan.UI/Resources/manifest.xml | 2 +- LiMan.sln | 2 +- 17 files changed, 337 insertions(+), 60 deletions(-) create mode 100644 LiMan.UI/Components/ListReleases.razor create mode 100644 LiMan.UI/Components/ListReleases.razor.cs create mode 100644 LiMan.UI/Pages/Applicazioni.razor.cs diff --git a/LiMan.Api/Data/ApiDataService.cs b/LiMan.Api/Data/ApiDataService.cs index c76031b..d9e07de 100644 --- a/LiMan.Api/Data/ApiDataService.cs +++ b/LiMan.Api/Data/ApiDataService.cs @@ -100,10 +100,10 @@ namespace LiMan.APi.Data List dbResult = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.ReleaseGetByApp(CodApp); + dbResult = dbController.ReleaseDtoGetByApp(CodApp); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per ReleaseGetByApp | {CodApp} | {ts.TotalMilliseconds} ms"); + Log.Trace($"Effettuata lettura da DB per ReleaseDtoGetByApp | {CodApp} | {ts.TotalMilliseconds} ms"); return dbResult; } /// @@ -118,10 +118,10 @@ namespace LiMan.APi.Data List dbResult = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.ReleaseGetByAppVers(CodApp, VersMin); + dbResult = dbController.ReleaseDtoGetByAppVers(CodApp, VersMin); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Trace($"Effettuata lettura da DB per ReleaseGetByAppVers | {CodApp} | vers >= {VersMin} | {ts.TotalMilliseconds} ms"); + Log.Trace($"Effettuata lettura da DB per ReleaseDtoGetByAppVers | {CodApp} | vers >= {VersMin} | {ts.TotalMilliseconds} ms"); return dbResult; } diff --git a/LiMan.DB/Controllers/DbController.cs b/LiMan.DB/Controllers/DbController.cs index e0abda5..0a3a519 100644 --- a/LiMan.DB/Controllers/DbController.cs +++ b/LiMan.DB/Controllers/DbController.cs @@ -1167,9 +1167,9 @@ namespace LiMan.DB.Controllers /// /// Codice applicativo /// - public List ReleaseGetByApp(string CodApp) + public List ReleaseGetByApp(string CodApp) { - List dbResult = new List(); + List dbResult = new List(); using (LMDbContext localDbCtx = new LMDbContext(_configuration)) { // calcolo DTO applicativi @@ -1177,13 +1177,6 @@ namespace LiMan.DB.Controllers .DbSetReleases .Where(x => (x.CodApp.ToLower() == CodApp.ToLower())) .OrderBy(o => o.ReleaseDate) - .Select(x => new ReleaseDTO() - { - CodApp = x.CodApp, - ReleaseDate = x.ReleaseDate, - VersNum = x.VersNum, - VersText = x.VersText - }) .ToList(); } return dbResult; @@ -1195,9 +1188,9 @@ namespace LiMan.DB.Controllers /// Codice applicativo /// Versione minima richiesta /// - public List ReleaseGetByAppVers(string CodApp, string MinVers) + public List ReleaseGetByAppVers(string CodApp, string MinVers) { - List dbResult = new List(); + List dbResult = new List(); using (LMDbContext localDbCtx = new LMDbContext(_configuration)) { // calcolo DTO applicativi @@ -1205,18 +1198,54 @@ namespace LiMan.DB.Controllers .DbSetReleases .Where(x => (x.CodApp.ToLower() == CodApp.ToLower()) && x.VersNum.CompareTo(MinVers) > 0) .OrderBy(o => o.ReleaseDate) - .Select(x => new ReleaseDTO() - { - CodApp = x.CodApp, - ReleaseDate = x.ReleaseDate, - VersNum = x.VersNum, - VersText = x.VersText - }) .ToList(); } return dbResult; } + /// + /// Elenco release (completo) dato un applicativo applicativi + /// + /// Codice applicativo + /// + public List ReleaseDtoGetByApp(string CodApp) + { + List dbResult = new List(); + var rawData = ReleaseGetByApp(CodApp); + dbResult = rawData + .Select(x => new ReleaseDTO() + { + CodApp = x.CodApp, + ReleaseDate = x.ReleaseDate, + VersNum = x.VersNum, + VersText = x.VersText + }). + ToList(); + return dbResult; + } + + /// + /// Elenco release (completo) dato un applicativo applicativi + /// + /// Codice applicativo + /// Versione minima richiesta + /// + public List ReleaseDtoGetByAppVers(string CodApp, string MinVers) + { + List dbResult = new List(); + var rawData = ReleaseGetByAppVers(CodApp, MinVers); + dbResult = rawData + .Select(x => new ReleaseDTO() + { + CodApp = x.CodApp, + ReleaseDate = x.ReleaseDate, + VersNum = x.VersNum, + VersText = x.VersText + }). + ToList(); + return dbResult; + } + /// /// Annulla modifiche su una specifica entity (cancel update) /// diff --git a/LiMan.Transfer/Resources/ChangeLog.html b/LiMan.Transfer/Resources/ChangeLog.html index 43a97c2..3d041a3 100644 --- a/LiMan.Transfer/Resources/ChangeLog.html +++ b/LiMan.Transfer/Resources/ChangeLog.html @@ -1,6 +1,6 @@ License Manager -

Versione: 1.1.2408.0619

+

Versione: 1.1.2408.0717


Note di rilascio:
    diff --git a/LiMan.Transfer/Resources/VersNum.txt b/LiMan.Transfer/Resources/VersNum.txt index eb254ab..5004433 100644 --- a/LiMan.Transfer/Resources/VersNum.txt +++ b/LiMan.Transfer/Resources/VersNum.txt @@ -1 +1 @@ -1.1.2408.0619 +1.1.2408.0717 diff --git a/LiMan.Transfer/Resources/manifest.xml b/LiMan.Transfer/Resources/manifest.xml index b92add4..8bbf284 100644 --- a/LiMan.Transfer/Resources/manifest.xml +++ b/LiMan.Transfer/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.1.2408.0619 + 1.1.2408.0717 https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.Transfer.zip https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html false diff --git a/LiMan.UI/Components/ListApplicazioni.razor b/LiMan.UI/Components/ListApplicazioni.razor index b1f43af..6332679 100644 --- a/LiMan.UI/Components/ListApplicazioni.razor +++ b/LiMan.UI/Components/ListApplicazioni.razor @@ -12,9 +12,9 @@
    - @if (currRecord != null) + @if (recordEdit != null) { - + } @if (ListRecords == null) { @@ -27,13 +27,16 @@ else {
    -
    +
    - + @if (recordSel == null) + { + + } @@ -41,33 +44,40 @@ { - + @if (recordSel == null) + { + + } }
    ApplicazioneDescrizioneDescrizione
    - @if (currRecord == null) + @if (recordEdit == null) { if (@record.CodApp != "-") { - + + } } else { - + + } @record.CodApp -
    @record.Descrizione
    -
    +
    @record.Descrizione
    +
    + @if (recordSel != null) + { +
    + +
    + }
    }
    diff --git a/LiMan.UI/Components/ListApplicazioni.razor.cs b/LiMan.UI/Components/ListApplicazioni.razor.cs index b3a23fe..26362a9 100644 --- a/LiMan.UI/Components/ListApplicazioni.razor.cs +++ b/LiMan.UI/Components/ListApplicazioni.razor.cs @@ -13,7 +13,8 @@ namespace LiMan.UI.Components { #region Private Fields - private ApplicativoModel currRecord = null; + private ApplicativoModel recordEdit = null; + private ApplicativoModel recordSel = null; private List ListRecords; private List SearchRecords; @@ -77,7 +78,8 @@ namespace LiMan.UI.Components private async Task fullReload() { - currRecord = null; + recordEdit = null; + recordSel = null; await DataService.InvalidateAllCache(); await ReloadAllData(); } @@ -99,16 +101,28 @@ namespace LiMan.UI.Components protected void AddNew() { - currRecord = new ApplicativoModel() + recordEdit = new ApplicativoModel() { CodApp = $"CodApp_{DateTime.Now:yyyyMMdd_HHmmss}", Descrizione = "Descrizione Nuovo Applicativo" }; } - protected void Edit(ApplicativoModel selRecord) + protected string mainCss { - currRecord = selRecord; + get => recordSel != null ? "col-4" : "col-12"; + } + protected string detCss = "col-8"; + + protected void DoEdit(ApplicativoModel selRecord) + { + recordEdit = selRecord; + recordSel = null; + } + protected void DoSelect(ApplicativoModel selRecord) + { + recordEdit = null; + recordSel = selRecord; } protected override async Task OnInitializedAsync() @@ -147,11 +161,11 @@ namespace LiMan.UI.Components public string checkSelect(string CodApp) { string answ = ""; - if (currRecord != null) + if (recordEdit != null) { try { - answ = (currRecord.CodApp == CodApp) ? "table-info" : ""; + answ = (recordEdit.CodApp == CodApp) ? "table-info" : ""; } catch { } diff --git a/LiMan.UI/Components/ListReleases.razor b/LiMan.UI/Components/ListReleases.razor new file mode 100644 index 0000000..cf406c3 --- /dev/null +++ b/LiMan.UI/Components/ListReleases.razor @@ -0,0 +1,68 @@ +
    +
    +
    +
    +
    Elenco Releases Applicativo @CurrRecord.CodApp
    +
    +
    + +
    +
    +
    +
    + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
    Nessun record trovato
    + } + else + { + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + } + +
    ApplicazioneRilascioVers. NumVers. Text
    + @if (recordEdit == null) + { + + } + else + { + + } + + @record.CodApp + + @($"{record.ReleaseDate:yyyy.MM.dd}") + + @record.VersNum + + @record.VersText +
    + } +
    + +
    \ No newline at end of file diff --git a/LiMan.UI/Components/ListReleases.razor.cs b/LiMan.UI/Components/ListReleases.razor.cs new file mode 100644 index 0000000..5554aa5 --- /dev/null +++ b/LiMan.UI/Components/ListReleases.razor.cs @@ -0,0 +1,116 @@ +using LiMan.DB.DBModels; +using LiMan.UI.Data; +using Microsoft.AspNetCore.Components; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LiMan.UI.Components +{ + public partial class ListReleases + { + #region Public Properties + + [Parameter] + public ApplicativoModel CurrRecord { get; set; } + + [Parameter] + public EventCallback DataReset { get; set; } + + #endregion Public Properties + + #region Public Methods + + public string checkSelect(int idxRel) + { + string answ = ""; + if (recordEdit != null) + { + try + { + answ = (recordEdit.IdxRel == idxRel) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + #endregion Public Methods + + #region Protected Properties + + [Inject] + protected LiManDataService DataService { get; set; } + + #endregion Protected Properties + + #region Protected Methods + + protected void DoEdit(ReleaseModel selRecord) + { + recordEdit = selRecord; + } + + protected override async Task OnParametersSetAsync() + { + await ReloadAllData(); + } + + protected async Task PagerReloadNum(int newNum) + { + numRecord = newNum; + await ReloadAllData(); + isLoading = false; + } + + protected async Task PagerReloadPage(int newNum) + { + currPage = newNum; + await ReloadAllData(); + isLoading = false; + } + + #endregion Protected Methods + + #region Private Fields + + private List ListRecords; + + private ReleaseModel recordEdit = null; + + private List SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private int currPage { get; set; } = 1; + + private bool isLoading { get; set; } = false; + + private int numRecord { get; set; } = 10; + + private int totalCount { get; set; } = 0; + + #endregion Private Properties + + #region Private Methods + + private async Task DoClose() + { + await DataReset.InvokeAsync(0); + } + + private async Task ReloadAllData() + { + isLoading = true; + SearchRecords = await DataService.ReleaseGetByApp(CurrRecord.CodApp); + totalCount = SearchRecords.Count(); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/LiMan.UI/Data/LiManDataService.cs b/LiMan.UI/Data/LiManDataService.cs index 29d5d46..14a131b 100644 --- a/LiMan.UI/Data/LiManDataService.cs +++ b/LiMan.UI/Data/LiManDataService.cs @@ -3,6 +3,7 @@ using Core.DTO; using Liman.CadCam.DbModel; using LiMan.DB.Controllers; using LiMan.DB.DBModels; +using LiMan.DB.DTO; using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Distributed; @@ -867,6 +868,42 @@ namespace LiMan.UI.Data return await Task.FromResult(done); } + /// + /// Elenco Release dato Applicativo + /// + /// Codice Applicazione + /// + public async Task> ReleaseGetByApp(string CodApp) + { + await Task.Delay(1); + List dbResult = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbControllerNext.ReleaseGetByApp(CodApp); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Trace($"Effettuata lettura da DB per ReleaseGetByApp | {CodApp} | {ts.TotalMilliseconds} ms"); + return dbResult; + } + /// + /// Elenco Release dato Applicativo + versione minima + /// + /// Codice Applicazione + /// Versione minima richiesta + /// + public async Task> ReleaseGetByAppVers(string CodApp, string VersMin) + { + await Task.Delay(1); + List dbResult = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + dbResult = dbControllerNext.ReleaseGetByAppVers(CodApp, VersMin); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Trace($"Effettuata lettura da DB per ReleaseGetByAppVers | {CodApp} | vers >= {VersMin} | {ts.TotalMilliseconds} ms"); + return dbResult; + } + public void rollBackEditGLS(object item) { dbControllerGLS.rollBackEntity(item); diff --git a/LiMan.UI/LiMan.UI.csproj b/LiMan.UI/LiMan.UI.csproj index c6f1fcc..01d82fa 100644 --- a/LiMan.UI/LiMan.UI.csproj +++ b/LiMan.UI/LiMan.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.1.2408.0619 + 1.1.2408.0717 LiMan.UI LiMan.UI diff --git a/LiMan.UI/Pages/Applicazioni.razor b/LiMan.UI/Pages/Applicazioni.razor index f0d70a5..6fe67fa 100644 --- a/LiMan.UI/Pages/Applicazioni.razor +++ b/LiMan.UI/Pages/Applicazioni.razor @@ -7,12 +7,3 @@ @inject MessageService AppMService - -@code { - protected override void OnInitialized() - { - AppMService.ShowSearch = false; - AppMService.PageName = "Elenco Applicazioni"; - AppMService.PageIcon = "fas fa-store pr-1"; - } -} \ No newline at end of file diff --git a/LiMan.UI/Pages/Applicazioni.razor.cs b/LiMan.UI/Pages/Applicazioni.razor.cs new file mode 100644 index 0000000..90929cd --- /dev/null +++ b/LiMan.UI/Pages/Applicazioni.razor.cs @@ -0,0 +1,12 @@ +namespace LiMan.UI.Pages +{ + public partial class Applicazioni + { + protected override void OnInitialized() + { + AppMService.ShowSearch = false; + AppMService.PageName = "Elenco Applicazioni"; + AppMService.PageIcon = "fas fa-store pr-1"; + } + } +} \ No newline at end of file diff --git a/LiMan.UI/Resources/ChangeLog.html b/LiMan.UI/Resources/ChangeLog.html index aa9d9cf..1024a4d 100644 --- a/LiMan.UI/Resources/ChangeLog.html +++ b/LiMan.UI/Resources/ChangeLog.html @@ -1,6 +1,6 @@ License Manager -

    Versione: 1.1.2408.0619

    +

    Versione: 1.1.2408.0717


    Note di rilascio:
    • diff --git a/LiMan.UI/Resources/VersNum.txt b/LiMan.UI/Resources/VersNum.txt index eb254ab..5004433 100644 --- a/LiMan.UI/Resources/VersNum.txt +++ b/LiMan.UI/Resources/VersNum.txt @@ -1 +1 @@ -1.1.2408.0619 +1.1.2408.0717 diff --git a/LiMan.UI/Resources/manifest.xml b/LiMan.UI/Resources/manifest.xml index 641835d..936564b 100644 --- a/LiMan.UI/Resources/manifest.xml +++ b/LiMan.UI/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.1.2408.0619 + 1.1.2408.0717 https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html false diff --git a/LiMan.sln b/LiMan.sln index c55c5a4..dc1c73d 100644 --- a/LiMan.sln +++ b/LiMan.sln @@ -22,7 +22,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Liman.CadCam", "Liman.CadCam\Liman.CadCam.csproj", "{06E8F9A8-9CBE-4207-A65A-A507E38319F6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiMan.DbSync", "LiMan.DbSync\LiMan.DbSync.csproj", "{AD302CBB-60F9-440E-A4C3-4D9C9DD7FA8E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiMan.DbSync", "LiMan.DbSync\LiMan.DbSync.csproj", "{AD302CBB-60F9-440E-A4C3-4D9C9DD7FA8E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution