From cdb7251275fe896dd6c7b2af793c93cff93ce9c0 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 8 Oct 2021 13:36:13 +0200 Subject: [PATCH 1/7] Bozza monopagina Legacy --- LiMan.DB/Controllers/LicManController.cs | 4 +- LiMan.DB/DatabaseModels/AnagApplicazioni.cs | 2 +- LiMan.DB/DatabaseModels/AnagInstallazioni.cs | 2 +- LiMan.DB/DatabaseModels/LicManContext.cs | 2 +- LiMan.DB/DatabaseModels/LicenzeAttive.cs | 2 +- LiMan.DB/DatabaseModels/Permessi.cs | 2 +- LiMan.DB/DatabaseModels/Permessi2Funzione.cs | 2 +- .../20211008094940_InitDb.Designer.cs | 30 +-- LiMan.DB/Migrations/20211008094940_InitDb.cs | 2 +- .../Migrations/LicManContextModelSnapshot.cs | 30 +-- LiMan.GLS/DatabaseModels/LicManContext.cs | 2 +- LiMan.Serv/LiMan.Serv.csproj | 1 + LiMan.UI/Components/ListApplicazioni.razor | 82 ++++++++ LiMan.UI/Components/ListApplicazioni.razor.cs | 149 +++++++++++++++ LiMan.UI/Components/ListInstallazioni.razor | 90 +++++++++ .../Components/ListInstallazioni.razor.cs | 149 +++++++++++++++ LiMan.UI/Components/ListLicenze.razor | 98 ++++++++++ LiMan.UI/Components/ListLicenze.razor.cs | 177 ++++++++++++++++++ LiMan.UI/Data/LiManDataService.cs | 26 +-- LiMan.UI/LiMan.UI.csproj | 1 + LiMan.UI/Pages/LiManGLS.razor | 52 +++++ LiMan.UI/Pages/LiManGLS.razor.cs | 11 ++ LiMan.UI/Shared/NavMenu.razor | 5 + LiMan.sln | 6 + 24 files changed, 876 insertions(+), 51 deletions(-) create mode 100644 LiMan.UI/Components/ListApplicazioni.razor create mode 100644 LiMan.UI/Components/ListApplicazioni.razor.cs create mode 100644 LiMan.UI/Components/ListInstallazioni.razor create mode 100644 LiMan.UI/Components/ListInstallazioni.razor.cs create mode 100644 LiMan.UI/Components/ListLicenze.razor create mode 100644 LiMan.UI/Components/ListLicenze.razor.cs create mode 100644 LiMan.UI/Pages/LiManGLS.razor create mode 100644 LiMan.UI/Pages/LiManGLS.razor.cs diff --git a/LiMan.DB/Controllers/LicManController.cs b/LiMan.DB/Controllers/LicManController.cs index a41d7e3..e5f9c17 100644 --- a/LiMan.DB/Controllers/LicManController.cs +++ b/LiMan.DB/Controllers/LicManController.cs @@ -1,4 +1,4 @@ -using LiMan.GLS.DatabaseModels; +using LiMan.DB.DatabaseModels; using Microsoft.Extensions.Configuration; using NLog; using System; @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace LiMan.GLS.Controllers +namespace LiMan.DB.Controllers { public class LicManController : IDisposable { diff --git a/LiMan.DB/DatabaseModels/AnagApplicazioni.cs b/LiMan.DB/DatabaseModels/AnagApplicazioni.cs index 9d16596..44ff0f4 100644 --- a/LiMan.DB/DatabaseModels/AnagApplicazioni.cs +++ b/LiMan.DB/DatabaseModels/AnagApplicazioni.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; #nullable disable -namespace LiMan.GLS.DatabaseModels +namespace LiMan.DB.DatabaseModels { public partial class AnagApplicazioni { diff --git a/LiMan.DB/DatabaseModels/AnagInstallazioni.cs b/LiMan.DB/DatabaseModels/AnagInstallazioni.cs index 5fce942..af1498a 100644 --- a/LiMan.DB/DatabaseModels/AnagInstallazioni.cs +++ b/LiMan.DB/DatabaseModels/AnagInstallazioni.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema; #nullable disable -namespace LiMan.GLS.DatabaseModels +namespace LiMan.DB.DatabaseModels { // // This is here so CodeMaid doesn't reorganize this document diff --git a/LiMan.DB/DatabaseModels/LicManContext.cs b/LiMan.DB/DatabaseModels/LicManContext.cs index 82a847a..167a0b7 100644 --- a/LiMan.DB/DatabaseModels/LicManContext.cs +++ b/LiMan.DB/DatabaseModels/LicManContext.cs @@ -6,7 +6,7 @@ using NLog; #nullable disable -namespace LiMan.GLS.DatabaseModels +namespace LiMan.DB.DatabaseModels { public partial class LicManContext : DbContext { diff --git a/LiMan.DB/DatabaseModels/LicenzeAttive.cs b/LiMan.DB/DatabaseModels/LicenzeAttive.cs index f7519ef..b39fa1e 100644 --- a/LiMan.DB/DatabaseModels/LicenzeAttive.cs +++ b/LiMan.DB/DatabaseModels/LicenzeAttive.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; #nullable disable -namespace LiMan.GLS.DatabaseModels +namespace LiMan.DB.DatabaseModels { public partial class LicenzeAttive { diff --git a/LiMan.DB/DatabaseModels/Permessi.cs b/LiMan.DB/DatabaseModels/Permessi.cs index 4a07001..33ef1cd 100644 --- a/LiMan.DB/DatabaseModels/Permessi.cs +++ b/LiMan.DB/DatabaseModels/Permessi.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; #nullable disable -namespace LiMan.GLS.DatabaseModels +namespace LiMan.DB.DatabaseModels { public partial class Permessi { diff --git a/LiMan.DB/DatabaseModels/Permessi2Funzione.cs b/LiMan.DB/DatabaseModels/Permessi2Funzione.cs index 3657c95..9489562 100644 --- a/LiMan.DB/DatabaseModels/Permessi2Funzione.cs +++ b/LiMan.DB/DatabaseModels/Permessi2Funzione.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; #nullable disable -namespace LiMan.GLS.DatabaseModels +namespace LiMan.DB.DatabaseModels { public partial class Permessi2Funzione { diff --git a/LiMan.DB/Migrations/20211008094940_InitDb.Designer.cs b/LiMan.DB/Migrations/20211008094940_InitDb.Designer.cs index d5178c3..c38b0f5 100644 --- a/LiMan.DB/Migrations/20211008094940_InitDb.Designer.cs +++ b/LiMan.DB/Migrations/20211008094940_InitDb.Designer.cs @@ -1,13 +1,13 @@ // using System; -using LiMan.GLS.DatabaseModels; +using LiMan.DB.DatabaseModels; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace LiMan.GLS.Migrations +namespace LiMan.DB.Migrations { [DbContext(typeof(LicManContext))] [Migration("20211008094940_InitDb")] @@ -22,7 +22,7 @@ namespace LiMan.GLS.Migrations .HasAnnotation("ProductVersion", "5.0.10") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.AnagApplicazioni", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagApplicazioni", b => { b.Property("Applicativo") .HasMaxLength(50) @@ -39,7 +39,7 @@ namespace LiMan.GLS.Migrations b.ToTable("AnagApplicazioni"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.AnagInstallazioni", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagInstallazioni", b => { b.Property("Installazione") .HasMaxLength(50) @@ -66,7 +66,7 @@ namespace LiMan.GLS.Migrations b.ToTable("AnagInstallazioni"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.LicenzeAttive", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.LicenzeAttive", b => { b.Property("IdxLic") .ValueGeneratedOnAdd() @@ -120,7 +120,7 @@ namespace LiMan.GLS.Migrations b.ToTable("LicenzeAttive"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.Permessi", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi", b => { b.Property("CodPermesso") .HasMaxLength(50) @@ -160,7 +160,7 @@ namespace LiMan.GLS.Migrations b.ToTable("Permessi"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.Permessi2Funzione", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi2Funzione", b => { b.Property("CodPermesso") .HasMaxLength(50) @@ -185,14 +185,14 @@ namespace LiMan.GLS.Migrations b.ToTable("Permessi2Funzione"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.LicenzeAttive", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.LicenzeAttive", b => { - b.HasOne("LiMan.GLS.DatabaseModels.AnagApplicazioni", "ApplicativoNavigation") + b.HasOne("LiMan.DB.DatabaseModels.AnagApplicazioni", "ApplicativoNavigation") .WithMany("LicenzeAttives") .HasForeignKey("Applicativo") .HasConstraintName("FK_AnagKeyValue_AnagApplicazioni"); - b.HasOne("LiMan.GLS.DatabaseModels.AnagInstallazioni", "InstallazioneNavigation") + b.HasOne("LiMan.DB.DatabaseModels.AnagInstallazioni", "InstallazioneNavigation") .WithMany("LicenzeAttives") .HasForeignKey("Installazione") .HasConstraintName("FK_AnagKeyValue_AnagInstallazioni"); @@ -202,9 +202,9 @@ namespace LiMan.GLS.Migrations b.Navigation("InstallazioneNavigation"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.Permessi2Funzione", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi2Funzione", b => { - b.HasOne("LiMan.GLS.DatabaseModels.Permessi", "CodPermessoNavigation") + b.HasOne("LiMan.DB.DatabaseModels.Permessi", "CodPermessoNavigation") .WithMany("Permessi2Funziones") .HasForeignKey("CodPermesso") .HasConstraintName("FK_Permessi2Funzione_Permessi") @@ -213,17 +213,17 @@ namespace LiMan.GLS.Migrations b.Navigation("CodPermessoNavigation"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.AnagApplicazioni", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagApplicazioni", b => { b.Navigation("LicenzeAttives"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.AnagInstallazioni", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagInstallazioni", b => { b.Navigation("LicenzeAttives"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.Permessi", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi", b => { b.Navigation("Permessi2Funziones"); }); diff --git a/LiMan.DB/Migrations/20211008094940_InitDb.cs b/LiMan.DB/Migrations/20211008094940_InitDb.cs index 451dbaf..102af8e 100644 --- a/LiMan.DB/Migrations/20211008094940_InitDb.cs +++ b/LiMan.DB/Migrations/20211008094940_InitDb.cs @@ -1,7 +1,7 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -namespace LiMan.GLS.Migrations +namespace LiMan.DB.Migrations { public partial class InitDb : Migration { diff --git a/LiMan.DB/Migrations/LicManContextModelSnapshot.cs b/LiMan.DB/Migrations/LicManContextModelSnapshot.cs index d8bdc29..f231b76 100644 --- a/LiMan.DB/Migrations/LicManContextModelSnapshot.cs +++ b/LiMan.DB/Migrations/LicManContextModelSnapshot.cs @@ -1,12 +1,12 @@ // using System; -using LiMan.GLS.DatabaseModels; +using LiMan.DB.DatabaseModels; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace LiMan.GLS.Migrations +namespace LiMan.DB.Migrations { [DbContext(typeof(LicManContext))] partial class LicManContextModelSnapshot : ModelSnapshot @@ -20,7 +20,7 @@ namespace LiMan.GLS.Migrations .HasAnnotation("ProductVersion", "5.0.10") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.AnagApplicazioni", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagApplicazioni", b => { b.Property("Applicativo") .HasMaxLength(50) @@ -37,7 +37,7 @@ namespace LiMan.GLS.Migrations b.ToTable("AnagApplicazioni"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.AnagInstallazioni", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagInstallazioni", b => { b.Property("Installazione") .HasMaxLength(50) @@ -64,7 +64,7 @@ namespace LiMan.GLS.Migrations b.ToTable("AnagInstallazioni"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.LicenzeAttive", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.LicenzeAttive", b => { b.Property("IdxLic") .ValueGeneratedOnAdd() @@ -118,7 +118,7 @@ namespace LiMan.GLS.Migrations b.ToTable("LicenzeAttive"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.Permessi", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi", b => { b.Property("CodPermesso") .HasMaxLength(50) @@ -158,7 +158,7 @@ namespace LiMan.GLS.Migrations b.ToTable("Permessi"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.Permessi2Funzione", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi2Funzione", b => { b.Property("CodPermesso") .HasMaxLength(50) @@ -183,14 +183,14 @@ namespace LiMan.GLS.Migrations b.ToTable("Permessi2Funzione"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.LicenzeAttive", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.LicenzeAttive", b => { - b.HasOne("LiMan.GLS.DatabaseModels.AnagApplicazioni", "ApplicativoNavigation") + b.HasOne("LiMan.DB.DatabaseModels.AnagApplicazioni", "ApplicativoNavigation") .WithMany("LicenzeAttives") .HasForeignKey("Applicativo") .HasConstraintName("FK_AnagKeyValue_AnagApplicazioni"); - b.HasOne("LiMan.GLS.DatabaseModels.AnagInstallazioni", "InstallazioneNavigation") + b.HasOne("LiMan.DB.DatabaseModels.AnagInstallazioni", "InstallazioneNavigation") .WithMany("LicenzeAttives") .HasForeignKey("Installazione") .HasConstraintName("FK_AnagKeyValue_AnagInstallazioni"); @@ -200,9 +200,9 @@ namespace LiMan.GLS.Migrations b.Navigation("InstallazioneNavigation"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.Permessi2Funzione", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi2Funzione", b => { - b.HasOne("LiMan.GLS.DatabaseModels.Permessi", "CodPermessoNavigation") + b.HasOne("LiMan.DB.DatabaseModels.Permessi", "CodPermessoNavigation") .WithMany("Permessi2Funziones") .HasForeignKey("CodPermesso") .HasConstraintName("FK_Permessi2Funzione_Permessi") @@ -211,17 +211,17 @@ namespace LiMan.GLS.Migrations b.Navigation("CodPermessoNavigation"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.AnagApplicazioni", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagApplicazioni", b => { b.Navigation("LicenzeAttives"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.AnagInstallazioni", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.AnagInstallazioni", b => { b.Navigation("LicenzeAttives"); }); - modelBuilder.Entity("LiMan.GLS.DatabaseModels.Permessi", b => + modelBuilder.Entity("LiMan.DB.DatabaseModels.Permessi", b => { b.Navigation("Permessi2Funziones"); }); diff --git a/LiMan.GLS/DatabaseModels/LicManContext.cs b/LiMan.GLS/DatabaseModels/LicManContext.cs index 9b818b7..dffb75b 100644 --- a/LiMan.GLS/DatabaseModels/LicManContext.cs +++ b/LiMan.GLS/DatabaseModels/LicManContext.cs @@ -71,7 +71,7 @@ namespace LiMan.GLS.DatabaseModels { if (!optionsBuilder.IsConfigured) { - string connString = _configuration.GetConnectionString("LiMan.DB"); + string connString = _configuration.GetConnectionString("LiMan.GLS"); if (!string.IsNullOrEmpty(connString)) { optionsBuilder.UseSqlServer(connString); diff --git a/LiMan.Serv/LiMan.Serv.csproj b/LiMan.Serv/LiMan.Serv.csproj index 84892a4..17f70a4 100644 --- a/LiMan.Serv/LiMan.Serv.csproj +++ b/LiMan.Serv/LiMan.Serv.csproj @@ -9,6 +9,7 @@ + \ No newline at end of file diff --git a/LiMan.UI/Components/ListApplicazioni.razor b/LiMan.UI/Components/ListApplicazioni.razor new file mode 100644 index 0000000..6c23d1f --- /dev/null +++ b/LiMan.UI/Components/ListApplicazioni.razor @@ -0,0 +1,82 @@ +@using LiMan.UI.Components + +
+
+
+
+
+
+

Applicazioni

+
+
+
+ @**@ +
+
+
+
+
+
+
+ @if (currRecord != null) + { + @**@ + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + } + +
ApplicazioneDescrizione
+ @if (currRecord == null) + { + + } + else + { + + } + + @record.Applicativo + +
@record.Descrizione
+
+
+
+ } +
+ +
\ No newline at end of file diff --git a/LiMan.UI/Components/ListApplicazioni.razor.cs b/LiMan.UI/Components/ListApplicazioni.razor.cs new file mode 100644 index 0000000..59d95a5 --- /dev/null +++ b/LiMan.UI/Components/ListApplicazioni.razor.cs @@ -0,0 +1,149 @@ +using LiMan.GLS.DatabaseModels; +using LiMan.UI.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LiMan.UI.Components +{ + public partial class ListApplicazioni : ComponentBase, IDisposable + { + #region Private Fields + + private AnagApplicazioni currRecord = null; + private List ListRecords; + private List SearchRecords; + + #endregion Private Fields + + #region Protected Fields + + protected int totalCount = 0; + + #endregion Protected Fields + + #region Private Properties + + private int currPage + { + get + { + return AppMService.PageNum; + } + set + { + AppMService.PageNum = value; + } + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get + { + return AppMService.PageSize; + } + set + { + AppMService.PageSize = value; + } + } + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected MessageService AppMService { get; set; } + + [Inject] + protected LiManDataService DataService { get; set; } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + protected bool showCamera { get; set; } = false; + + #endregion Protected Properties + + #region Private Methods + + private async Task ReloadAllData() + { + isLoading = true; + await Task.Delay(1); + //ListRecords = null; + SearchRecords = await DataService.ApplicazioniGetAll(); + totalCount = SearchRecords.Count(); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected void Edit(AnagApplicazioni selRecord) + { + currRecord = selRecord; + } + + protected override async Task OnInitializedAsync() + { + AppMService.ShowSearch = false; + AppMService.PageName = "Applicazioni"; + AppMService.PageIcon = "fas fa-gas-pump pr-2"; + 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; + } + + protected void ResetData() + { + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(string Applicativo) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.Applicativo == Applicativo) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/LiMan.UI/Components/ListInstallazioni.razor b/LiMan.UI/Components/ListInstallazioni.razor new file mode 100644 index 0000000..02006db --- /dev/null +++ b/LiMan.UI/Components/ListInstallazioni.razor @@ -0,0 +1,90 @@ +@using LiMan.UI.Components + +
+
+
+
+
+
+

Installazioni

+
+
+
+ @**@ +
+
+
+
+
+
+
+ @if (currRecord != null) + { + @**@ + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + } + +
InstallazioneDescrizioneContattoEmail
+ @if (currRecord == null) + { + + } + else + { + + } + + @record.Installazione + +
@record.Descrizione
+
+
@record.Contatto
+
+
@record.Email
+
+
+
+ } +
+ +
\ No newline at end of file diff --git a/LiMan.UI/Components/ListInstallazioni.razor.cs b/LiMan.UI/Components/ListInstallazioni.razor.cs new file mode 100644 index 0000000..86ab56d --- /dev/null +++ b/LiMan.UI/Components/ListInstallazioni.razor.cs @@ -0,0 +1,149 @@ +using LiMan.GLS.DatabaseModels; +using LiMan.UI.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LiMan.UI.Components +{ + public partial class ListInstallazioni : ComponentBase, IDisposable + { + #region Private Fields + + private AnagInstallazioni currRecord = null; + private List ListRecords; + private List SearchRecords; + + #endregion Private Fields + + #region Protected Fields + + protected int totalCount = 0; + + #endregion Protected Fields + + #region Private Properties + + private int currPage + { + get + { + return AppMService.PageNum; + } + set + { + AppMService.PageNum = value; + } + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get + { + return AppMService.PageSize; + } + set + { + AppMService.PageSize = value; + } + } + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected MessageService AppMService { get; set; } + + [Inject] + protected LiManDataService DataService { get; set; } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + protected bool showCamera { get; set; } = false; + + #endregion Protected Properties + + #region Private Methods + + private async Task ReloadAllData() + { + isLoading = true; + await Task.Delay(1); + //ListRecords = null; + SearchRecords = await DataService.InstallazioniGetAll(); + totalCount = SearchRecords.Count(); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + protected void Edit(AnagInstallazioni selRecord) + { + currRecord = selRecord; + } + + protected override async Task OnInitializedAsync() + { + AppMService.ShowSearch = false; + AppMService.PageName = "Installazioni"; + AppMService.PageIcon = "fas fa-gas-pump pr-2"; + 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; + } + + protected void ResetData() + { + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(string Installazione) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.Installazione == Installazione) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/LiMan.UI/Components/ListLicenze.razor b/LiMan.UI/Components/ListLicenze.razor new file mode 100644 index 0000000..8ad1ede --- /dev/null +++ b/LiMan.UI/Components/ListLicenze.razor @@ -0,0 +1,98 @@ +@using LiMan.UI.Components + +
+
+
+
+
+
+

Installazioni

+
+
+
+ @**@ +
+
+
+
+
+
+
+ @if (currRecord != null) + { + @**@ + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
InstallazioneApplicativoScadenzaNum LicenzeCodice LicenzaDescrizione
+ @if (currRecord == null) + { + + } + else + { + + } + + @record.Installazione + + @record.Applicativo + + @($"{record.Scadenza:yyyy.MM.dd}") + +
@record.NumLicenze
+
+
@record.Licenza
+
+
@record.Descrizione
+
+
+
+ } +
+ +
\ No newline at end of file diff --git a/LiMan.UI/Components/ListLicenze.razor.cs b/LiMan.UI/Components/ListLicenze.razor.cs new file mode 100644 index 0000000..0851394 --- /dev/null +++ b/LiMan.UI/Components/ListLicenze.razor.cs @@ -0,0 +1,177 @@ +using LiMan.GLS.DatabaseModels; +using LiMan.UI.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LiMan.UI.Components +{ + public partial class ListLicenze : ComponentBase, IDisposable + { + #region Private Fields + + private LicenzeAttive currRecord = null; + private List ListRecords; + private List SearchRecords; + + #endregion Private Fields + + #region Protected Fields + + protected int totalCount = 0; + + #endregion Protected Fields + + #region Private Properties + + private int currPage + { + get + { + return AppMService.PageNum; + } + set + { + AppMService.PageNum = value; + } + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get + { + return AppMService.PageSize; + } + set + { + AppMService.PageSize = value; + } + } + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected MessageService AppMService { get; set; } + + [Inject] + protected LiManDataService DataService { get; set; } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + protected bool showCamera { get; set; } = false; + + #endregion Protected Properties + + #region Private Methods + + private async Task ReloadAllData() + { + isLoading = true; + await Task.Delay(1); + //ListRecords = null; + SearchRecords = await DataService.LicenzeGetAll(); + totalCount = SearchRecords.Count(); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + isLoading = false; + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// formatta testo secondo scadenza: + /// scadenza > 60gg --> verde + /// 0 < scadenza < 60 gg --> giallo + /// scadenza < 0 --> rosso + /// + /// + /// + protected string cssScadenza(DateTime scadenza) + { + string answ = "text-dark"; + double periodo = scadenza.Subtract(DateTime.Today).TotalDays; + if (periodo > 60) + { + answ = "text-success"; + } + else if (periodo > 0) + { + answ = "text-warning"; + } + else + { + answ = "text-danger"; + } + + return answ; + } + + protected void Edit(LicenzeAttive selRecord) + { + currRecord = selRecord; + } + + protected override async Task OnInitializedAsync() + { + AppMService.ShowSearch = false; + AppMService.PageName = "Licenze"; + AppMService.PageIcon = "fas fa-gas-pump pr-2"; + 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; + } + + protected void ResetData() + { + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(int IdxLic) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxLic == IdxLic) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/LiMan.UI/Data/LiManDataService.cs b/LiMan.UI/Data/LiManDataService.cs index 95ece38..ac8d720 100644 --- a/LiMan.UI/Data/LiManDataService.cs +++ b/LiMan.UI/Data/LiManDataService.cs @@ -46,7 +46,9 @@ namespace LiMan.UI.Data #region Public Fields - public static LiMan.GLS.Controllers.LicManController dbController; + public static LiMan.GLS.Controllers.LicManController dbControllerGLS; + + public static LiMan.DB.Controllers.LicManController dbControllerNext; #endregion Public Fields @@ -60,15 +62,17 @@ namespace LiMan.UI.Data this.memoryCache = memoryCache; this.distributedCache = distributedCache; // conf DB - string connStr = _configuration.GetConnectionString("LiMan.DB"); - if (string.IsNullOrEmpty(connStr)) + string connStrGLS = _configuration.GetConnectionString("LiMan.GLS"); + string connStrDB = _configuration.GetConnectionString("LiMan.DB"); + if (string.IsNullOrEmpty(connStrDB) || string.IsNullOrEmpty(connStrGLS)) { - _logger.LogError("ConnString empty!"); + _logger.LogError("Almost one ConnString empty!"); } else { - dbController = new LiMan.GLS.Controllers.LicManController(configuration); - _logger.LogInformation("DbController OK"); + dbControllerGLS = new LiMan.GLS.Controllers.LicManController(configuration); + dbControllerNext = new LiMan.DB.Controllers.LicManController(configuration); + _logger.LogInformation("DbControllers OK"); } } @@ -122,7 +126,7 @@ namespace LiMan.UI.Data { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.GetApplicazioni(); + dbResult = dbControllerGLS.GetApplicazioni(); rawData = JsonConvert.SerializeObject(dbResult); redisDataList = Encoding.UTF8.GetBytes(rawData); await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false)); @@ -135,13 +139,13 @@ namespace LiMan.UI.Data public async Task DbForceMigrate() { - return await Task.FromResult(dbController.DbForceMigrate()); + return await Task.FromResult(dbControllerGLS.DbForceMigrate()); } public void Dispose() { // Clear database controller - dbController.Dispose(); + dbControllerGLS.Dispose(); } public async Task> InstallazioniGetAll() @@ -159,7 +163,7 @@ namespace LiMan.UI.Data { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.GetInstallazioni(); + dbResult = dbControllerGLS.GetInstallazioni(); rawData = JsonConvert.SerializeObject(dbResult); redisDataList = Encoding.UTF8.GetBytes(rawData); await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false)); @@ -199,7 +203,7 @@ namespace LiMan.UI.Data { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - dbResult = dbController.GetLicenze(); + dbResult = dbControllerGLS.GetLicenze(); rawData = JsonConvert.SerializeObject(dbResult); redisDataList = Encoding.UTF8.GetBytes(rawData); await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false)); diff --git a/LiMan.UI/LiMan.UI.csproj b/LiMan.UI/LiMan.UI.csproj index 2bc28f9..aecd9e7 100644 --- a/LiMan.UI/LiMan.UI.csproj +++ b/LiMan.UI/LiMan.UI.csproj @@ -20,6 +20,7 @@ + diff --git a/LiMan.UI/Pages/LiManGLS.razor b/LiMan.UI/Pages/LiManGLS.razor new file mode 100644 index 0000000..eb4e46f --- /dev/null +++ b/LiMan.UI/Pages/LiManGLS.razor @@ -0,0 +1,52 @@ +@page "/LiManGLS" + +@using LiMan.UI.Components + +...mostro 3 selettori Tab: Applicazioni / Installazioni / licenze + +
+
+ @**@ + +
+
+
+ @*tre moduli opzionalmente visibili*@ + +
+
+ +
+ + +
+
+
+
\ No newline at end of file diff --git a/LiMan.UI/Pages/LiManGLS.razor.cs b/LiMan.UI/Pages/LiManGLS.razor.cs new file mode 100644 index 0000000..2514316 --- /dev/null +++ b/LiMan.UI/Pages/LiManGLS.razor.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LiMan.UI.Pages +{ + public partial class LiManGLS + { + } +} \ No newline at end of file diff --git a/LiMan.UI/Shared/NavMenu.razor b/LiMan.UI/Shared/NavMenu.razor index 2f95600..fe2c14b 100644 --- a/LiMan.UI/Shared/NavMenu.razor +++ b/LiMan.UI/Shared/NavMenu.razor @@ -27,6 +27,11 @@ Elenco Licenze + diff --git a/LiMan.sln b/LiMan.sln index fb9bfa1..63ab092 100644 --- a/LiMan.sln +++ b/LiMan.sln @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiMan.GLS", "LiMan.GLS\LiMa EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiMan.UI", "LiMan.UI\LiMan.UI.csproj", "{34200CA2-489C-435A-A60B-34DE7B7BA04D}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiMan.DB", "LiMan.DB\LiMan.DB.csproj", "{C052CE93-FFDE-4B45-B1BC-BD9882797667}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {34200CA2-489C-435A-A60B-34DE7B7BA04D}.Debug|Any CPU.Build.0 = Debug|Any CPU {34200CA2-489C-435A-A60B-34DE7B7BA04D}.Release|Any CPU.ActiveCfg = Release|Any CPU {34200CA2-489C-435A-A60B-34DE7B7BA04D}.Release|Any CPU.Build.0 = Release|Any CPU + {C052CE93-FFDE-4B45-B1BC-BD9882797667}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C052CE93-FFDE-4B45-B1BC-BD9882797667}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C052CE93-FFDE-4B45-B1BC-BD9882797667}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C052CE93-FFDE-4B45-B1BC-BD9882797667}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 3b73a43598429b45339e1283c9fdf68c4179bc15 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 8 Oct 2021 15:04:32 +0200 Subject: [PATCH 2/7] COmpletata prima versione (no edit) --- LiMan.UI/Components/ListApplicazioni.razor | 132 +++++++--------- LiMan.UI/Components/ListInstallazioni.razor | 148 ++++++++---------- LiMan.UI/Components/ListLicenze.razor | 164 +++++++++----------- LiMan.UI/Pages/LiManGLS.razor | 47 ++---- LiMan.UI/Shared/NavMenu.razor | 10 +- 5 files changed, 206 insertions(+), 295 deletions(-) diff --git a/LiMan.UI/Components/ListApplicazioni.razor b/LiMan.UI/Components/ListApplicazioni.razor index 6c23d1f..0f1d4bc 100644 --- a/LiMan.UI/Components/ListApplicazioni.razor +++ b/LiMan.UI/Components/ListApplicazioni.razor @@ -1,82 +1,58 @@ @using LiMan.UI.Components -
-
-
-
-
-
-

Applicazioni

-
-
-
- @**@ -
-
-
-
+@if (currRecord != null) +{ + @**@ +} +@if (ListRecords == null) +{ + +} +else if (totalCount == 0) +{ +
Nessun record trovato
+} +else +{ +
+
+ + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + } + +
ApplicazioneDescrizione
+ @if (currRecord == null) + { + + } + else + { + + } + + @record.Applicativo + +
@record.Descrizione
+
-
- @if (currRecord != null) - { - @**@ - } - @if (ListRecords == null) - { - - } - else if (totalCount == 0) - { -
Nessun record trovato
- } - else - { -
-
- - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - } - -
ApplicazioneDescrizione
- @if (currRecord == null) - { - - } - else - { - - } - - @record.Applicativo - -
@record.Descrizione
-
-
-
- } -
- -
\ No newline at end of file +} + \ No newline at end of file diff --git a/LiMan.UI/Components/ListInstallazioni.razor b/LiMan.UI/Components/ListInstallazioni.razor index 02006db..094bc6d 100644 --- a/LiMan.UI/Components/ListInstallazioni.razor +++ b/LiMan.UI/Components/ListInstallazioni.razor @@ -1,90 +1,66 @@ @using LiMan.UI.Components -
-
-
-
-
-
-

Installazioni

-
-
-
- @**@ -
-
-
-
+@if (currRecord != null) +{ + @**@ +} +@if (ListRecords == null) +{ + +} +else if (totalCount == 0) +{ +
Nessun record trovato
+} +else +{ +
+
+ + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + } + +
InstallazioneDescrizioneContattoEmail
+ @if (currRecord == null) + { + + } + else + { + + } + + @record.Installazione + +
@record.Descrizione
+
+
@record.Contatto
+
+
@record.Email
+
-
- @if (currRecord != null) - { - @**@ - } - @if (ListRecords == null) - { - - } - else if (totalCount == 0) - { -
Nessun record trovato
- } - else - { -
-
- - - - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - - - } - -
InstallazioneDescrizioneContattoEmail
- @if (currRecord == null) - { - - } - else - { - - } - - @record.Installazione - -
@record.Descrizione
-
-
@record.Contatto
-
-
@record.Email
-
-
-
- } -
- -
\ No newline at end of file +} + \ No newline at end of file diff --git a/LiMan.UI/Components/ListLicenze.razor b/LiMan.UI/Components/ListLicenze.razor index 8ad1ede..49a02ea 100644 --- a/LiMan.UI/Components/ListLicenze.razor +++ b/LiMan.UI/Components/ListLicenze.razor @@ -1,98 +1,76 @@ @using LiMan.UI.Components -
-
-
-
-
-
-

Installazioni

-
-
-
- @**@ -
-
-
-
+@if (currRecord != null) +{ + @**@ +} +@if (ListRecords == null) +{ + +} +else if (totalCount == 0) +{ +
Nessun record trovato
+} +else +{ +
+
+ + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
InstallazioneApplicativoScadenzaNum LicenzeCodice LicenzaDescrizione
+ @if (currRecord == null) + { + + } + else + { + + } + + @record.Installazione + + @record.Applicativo + + @($"{record.Scadenza:yyyy.MM.dd}") + +
@record.NumLicenze
+
+
@record.Licenza
+
+
@record.Descrizione
+
-
- @if (currRecord != null) - { - @**@ - } - @if (ListRecords == null) - { - - } - else if (totalCount == 0) - { -
Nessun record trovato
- } - else - { -
-
- - - - - - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - - - - - } - -
InstallazioneApplicativoScadenzaNum LicenzeCodice LicenzaDescrizione
- @if (currRecord == null) - { - - } - else - { - - } - - @record.Installazione - - @record.Applicativo - - @($"{record.Scadenza:yyyy.MM.dd}") - -
@record.NumLicenze
-
-
@record.Licenza
-
-
@record.Descrizione
-
-
-
- } -
- +} +
+
\ No newline at end of file diff --git a/LiMan.UI/Pages/LiManGLS.razor b/LiMan.UI/Pages/LiManGLS.razor index eb4e46f..61c6762 100644 --- a/LiMan.UI/Pages/LiManGLS.razor +++ b/LiMan.UI/Pages/LiManGLS.razor @@ -2,50 +2,31 @@ @using LiMan.UI.Components -...mostro 3 selettori Tab: Applicazioni / Installazioni / licenze -
- @**@ -
-
- @*tre moduli opzionalmente visibili*@ - -
-
- -
- - + +
+
+ +
+
+ +
+
+
diff --git a/LiMan.UI/Shared/NavMenu.razor b/LiMan.UI/Shared/NavMenu.razor index fe2c14b..18da493 100644 --- a/LiMan.UI/Shared/NavMenu.razor +++ b/LiMan.UI/Shared/NavMenu.razor @@ -12,6 +12,11 @@ Home + -
From 8393670ce3d850bfe41304f509d614be0dd54d9a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 8 Oct 2021 15:51:52 +0200 Subject: [PATCH 3/7] COmpletato editing tab applicazione GLS --- LiMan.GLS/Controllers/LicManController.cs | 54 ++++++++ LiMan.UI/Components/EditApplicazioni.razor | 40 ++++++ LiMan.UI/Components/EditApplicazioni.razor.cs | 115 ++++++++++++++++++ LiMan.UI/Components/ListApplicazioni.razor | 2 +- LiMan.UI/Components/ListApplicazioni.razor.cs | 12 +- LiMan.UI/Data/LiManDataService.cs | 20 +++ 6 files changed, 241 insertions(+), 2 deletions(-) create mode 100644 LiMan.UI/Components/EditApplicazioni.razor create mode 100644 LiMan.UI/Components/EditApplicazioni.razor.cs diff --git a/LiMan.GLS/Controllers/LicManController.cs b/LiMan.GLS/Controllers/LicManController.cs index a41d7e3..64564ff 100644 --- a/LiMan.GLS/Controllers/LicManController.cs +++ b/LiMan.GLS/Controllers/LicManController.cs @@ -1,4 +1,5 @@ using LiMan.GLS.DatabaseModels; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using NLog; using System; @@ -89,6 +90,59 @@ namespace LiMan.GLS.Controllers return dbResult; } + /// + /// Annulla modifiche su una specifica entity (cancel update) + /// + /// + /// + public bool rollBackEntity(object item) + { + bool answ = false; + using (LicManContext localDbCtx = new LicManContext(_configuration)) + { + try + { + if (localDbCtx.Entry(item).State == EntityState.Deleted || localDbCtx.Entry(item).State == EntityState.Modified) + { + localDbCtx.Entry(item).Reload(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}"); + } + } + return answ; + } + + public bool UpdateApplicazioni(AnagApplicazioni updItem) + { + bool done = false; + using (LicManContext localDbCtx = new LicManContext(_configuration)) + { + try + { + AnagApplicazioni currData = localDbCtx + .DbSetApplicazioni + .Where(x => x.Applicativo == updItem.Applicativo) + .FirstOrDefault(); + if (currData != null) + { + // aggiorno valori + currData.Descrizione = updItem.Descrizione; + localDbCtx.Entry(currData).State = EntityState.Modified; + localDbCtx.SaveChanges(); + } + done = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione in UpdateApplicazioni:{Environment.NewLine}{exc}"); + } + } + return done; + } + #endregion Public Methods } } \ No newline at end of file diff --git a/LiMan.UI/Components/EditApplicazioni.razor b/LiMan.UI/Components/EditApplicazioni.razor new file mode 100644 index 0000000..0e9519e --- /dev/null +++ b/LiMan.UI/Components/EditApplicazioni.razor @@ -0,0 +1,40 @@ +@using LiMan.UI.Components +@using Microsoft.AspNetCore.Components.Authorization +@using LiMan.UI.Data +@using Microsoft.Extensions.Configuration + +
+
+ Modifica +
+
+ + +
+
+
+
+

@_currItem.Applicativo

+
+
+
+
+ + Descrizione + +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/LiMan.UI/Components/EditApplicazioni.razor.cs b/LiMan.UI/Components/EditApplicazioni.razor.cs new file mode 100644 index 0000000..a780a82 --- /dev/null +++ b/LiMan.UI/Components/EditApplicazioni.razor.cs @@ -0,0 +1,115 @@ +using LiMan.GLS.DatabaseModels; +using LiMan.UI.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LiMan.UI.Components +{ + public partial class EditApplicazioni + { + #region Protected Fields + + protected AnagApplicazioni _currItem = new AnagApplicazioni(); + + #endregion Protected Fields + + #region Private Properties + + [Inject] + private IJSRuntime JSRuntime { get; set; } + + [Inject] + private NavigationManager NavManager { get; set; } + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected LiManDataService DataService { get; set; } + + protected bool editAll + { + get + { + bool answ = false; + var currMode = GetQueryParm("currMode"); + if (!string.IsNullOrEmpty(currMode)) + { + answ = currMode.Equals("debug"); + } + return answ; + } + } + + [Inject] + protected MessageService MessageService { get; set; } + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public AnagApplicazioni currItem + { + get + { + return _currItem; + } + set + { + _currItem = value; + } + } + + [Parameter] + public EventCallback DataReset { get; set; } + + [Parameter] + public EventCallback DataUpdated { get; set; } + + #endregion Public Properties + + #region Private Methods + + private async Task cancelUpdate() + { + await DataReset.InvokeAsync(0); + } + + private async Task saveUpdate() + { + if (_currItem != null) + { + await DataService.ApplicazioniUpdate(_currItem); + await DataUpdated.InvokeAsync(0); + } + else + { + Console.WriteLine("Record null!"); + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// Blazor: get query parm from the URL + /// + /// + /// + protected string GetQueryParm(string parmName) + { + var uriBuilder = new UriBuilder(NavManager.Uri); + var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query); + return q[parmName] ?? ""; + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/LiMan.UI/Components/ListApplicazioni.razor b/LiMan.UI/Components/ListApplicazioni.razor index 0f1d4bc..85a0ce1 100644 --- a/LiMan.UI/Components/ListApplicazioni.razor +++ b/LiMan.UI/Components/ListApplicazioni.razor @@ -2,7 +2,7 @@ @if (currRecord != null) { - @**@ + } @if (ListRecords == null) { diff --git a/LiMan.UI/Components/ListApplicazioni.razor.cs b/LiMan.UI/Components/ListApplicazioni.razor.cs index 59d95a5..2aa074a 100644 --- a/LiMan.UI/Components/ListApplicazioni.razor.cs +++ b/LiMan.UI/Components/ListApplicazioni.razor.cs @@ -117,8 +117,18 @@ namespace LiMan.UI.Components isLoading = false; } - protected void ResetData() + protected async Task ResetData() { + //DataService.rollBackEditGLS(currRecord); + currRecord = null; + await ReloadAllData(); + } + + protected async Task UpdateData() + { + currRecord = null; + await DataService.InvalidateAllCache(); + await ReloadAllData(); } #endregion Protected Methods diff --git a/LiMan.UI/Data/LiManDataService.cs b/LiMan.UI/Data/LiManDataService.cs index ac8d720..46d13c5 100644 --- a/LiMan.UI/Data/LiManDataService.cs +++ b/LiMan.UI/Data/LiManDataService.cs @@ -137,6 +137,21 @@ namespace LiMan.UI.Data return await Task.FromResult(dbResult); } + public async Task ApplicazioniUpdate(AnagApplicazioni currItem) + { + bool done = false; + try + { + done = dbControllerGLS.UpdateApplicazioni(currItem); + await InvalidateAllCache(); + } + catch (Exception exc) + { + Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}"); + } + return await Task.FromResult(done); + } + public async Task DbForceMigrate() { return await Task.FromResult(dbControllerGLS.DbForceMigrate()); @@ -214,6 +229,11 @@ namespace LiMan.UI.Data return await Task.FromResult(dbResult); } + public void rollBackEditGLS(object item) + { + dbControllerGLS.rollBackEntity(item); + } + #endregion Public Methods } } \ No newline at end of file From 9f8fc56e22a4c6b7b34398751151a8fb4c13f514 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 8 Oct 2021 16:13:05 +0200 Subject: [PATCH 4/7] COmpletata review editing applicazioni/installazioni --- LiMan.GLS/Controllers/LicManController.cs | 30 +++++ LiMan.UI/Components/EditInstallazioni.razor | 60 +++++++++ .../Components/EditInstallazioni.razor.cs | 115 ++++++++++++++++++ LiMan.UI/Components/ListApplicazioni.razor | 9 +- LiMan.UI/Components/ListApplicazioni.razor.cs | 15 ++- LiMan.UI/Components/ListInstallazioni.razor | 11 +- .../Components/ListInstallazioni.razor.cs | 15 ++- LiMan.UI/Data/LiManDataService.cs | 17 ++- LiMan.UI/LiMan.UI.csproj | 6 + LiMan.UI/Pages/Index.razor | 6 +- LiMan.UI/Pages/LiManGLS.razor | 52 ++++---- LiMan.UI/Shared/NavMenu.razor | 30 ++--- 12 files changed, 307 insertions(+), 59 deletions(-) create mode 100644 LiMan.UI/Components/EditInstallazioni.razor create mode 100644 LiMan.UI/Components/EditInstallazioni.razor.cs diff --git a/LiMan.GLS/Controllers/LicManController.cs b/LiMan.GLS/Controllers/LicManController.cs index 64564ff..00e0e5a 100644 --- a/LiMan.GLS/Controllers/LicManController.cs +++ b/LiMan.GLS/Controllers/LicManController.cs @@ -143,6 +143,36 @@ namespace LiMan.GLS.Controllers return done; } + public bool UpdateInstallazioni(AnagInstallazioni updItem) + { + bool done = false; + using (LicManContext localDbCtx = new LicManContext(_configuration)) + { + try + { + AnagInstallazioni currData = localDbCtx + .DbSetInstallazioni + .Where(x => x.Installazione == updItem.Installazione) + .FirstOrDefault(); + if (currData != null) + { + // aggiorno valori + currData.Contatto = updItem.Contatto; + currData.Descrizione = updItem.Descrizione; + currData.Email = updItem.Email; + localDbCtx.Entry(currData).State = EntityState.Modified; + localDbCtx.SaveChanges(); + } + done = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione in UpdateApplicazioni:{Environment.NewLine}{exc}"); + } + } + return done; + } + #endregion Public Methods } } \ No newline at end of file diff --git a/LiMan.UI/Components/EditInstallazioni.razor b/LiMan.UI/Components/EditInstallazioni.razor new file mode 100644 index 0000000..6e43567 --- /dev/null +++ b/LiMan.UI/Components/EditInstallazioni.razor @@ -0,0 +1,60 @@ +@using LiMan.UI.Components +@using Microsoft.AspNetCore.Components.Authorization +@using LiMan.UI.Data +@using Microsoft.Extensions.Configuration + +
+
+ Modifica +
+
+ + +
+
+
+
+ @_currItem.Installazione +
+
+
+
+ + Descrizione + +
+ +
+
+
+
+
+ + Contatto + +
+ +
+
+
+
+
+ + Email + +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/LiMan.UI/Components/EditInstallazioni.razor.cs b/LiMan.UI/Components/EditInstallazioni.razor.cs new file mode 100644 index 0000000..f8d5e25 --- /dev/null +++ b/LiMan.UI/Components/EditInstallazioni.razor.cs @@ -0,0 +1,115 @@ +using LiMan.GLS.DatabaseModels; +using LiMan.UI.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LiMan.UI.Components +{ + public partial class EditInstallazioni + { + #region Protected Fields + + protected AnagInstallazioni _currItem = new AnagInstallazioni(); + + #endregion Protected Fields + + #region Private Properties + + [Inject] + private IJSRuntime JSRuntime { get; set; } + + [Inject] + private NavigationManager NavManager { get; set; } + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected LiManDataService DataService { get; set; } + + protected bool editAll + { + get + { + bool answ = false; + var currMode = GetQueryParm("currMode"); + if (!string.IsNullOrEmpty(currMode)) + { + answ = currMode.Equals("debug"); + } + return answ; + } + } + + [Inject] + protected MessageService MessageService { get; set; } + + #endregion Protected Properties + + #region Public Properties + + [Parameter] + public AnagInstallazioni currItem + { + get + { + return _currItem; + } + set + { + _currItem = value; + } + } + + [Parameter] + public EventCallback DataReset { get; set; } + + [Parameter] + public EventCallback DataUpdated { get; set; } + + #endregion Public Properties + + #region Private Methods + + private async Task cancelUpdate() + { + await DataReset.InvokeAsync(0); + } + + private async Task saveUpdate() + { + if (_currItem != null) + { + await DataService.InstallazioniUpdate(_currItem); + await DataUpdated.InvokeAsync(0); + } + else + { + Console.WriteLine("Record null!"); + } + } + + #endregion Private Methods + + #region Protected Methods + + /// + /// Blazor: get query parm from the URL + /// + /// + /// + protected string GetQueryParm(string parmName) + { + var uriBuilder = new UriBuilder(NavManager.Uri); + var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query); + return q[parmName] ?? ""; + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/LiMan.UI/Components/ListApplicazioni.razor b/LiMan.UI/Components/ListApplicazioni.razor index 85a0ce1..15f19f6 100644 --- a/LiMan.UI/Components/ListApplicazioni.razor +++ b/LiMan.UI/Components/ListApplicazioni.razor @@ -31,9 +31,12 @@ else @if (currRecord == null) { - + if (!record.Applicativo.StartsWith("_")) + { + + } } else { diff --git a/LiMan.UI/Components/ListApplicazioni.razor.cs b/LiMan.UI/Components/ListApplicazioni.razor.cs index 2aa074a..8c63897 100644 --- a/LiMan.UI/Components/ListApplicazioni.razor.cs +++ b/LiMan.UI/Components/ListApplicazioni.razor.cs @@ -75,6 +75,13 @@ namespace LiMan.UI.Components #region Private Methods + private async Task fullReload() + { + currRecord = null; + await DataService.InvalidateAllCache(); + await ReloadAllData(); + } + private async Task ReloadAllData() { isLoading = true; @@ -119,16 +126,12 @@ namespace LiMan.UI.Components protected async Task ResetData() { - //DataService.rollBackEditGLS(currRecord); - currRecord = null; - await ReloadAllData(); + await fullReload(); } protected async Task UpdateData() { - currRecord = null; - await DataService.InvalidateAllCache(); - await ReloadAllData(); + await fullReload(); } #endregion Protected Methods diff --git a/LiMan.UI/Components/ListInstallazioni.razor b/LiMan.UI/Components/ListInstallazioni.razor index 094bc6d..15b4eb9 100644 --- a/LiMan.UI/Components/ListInstallazioni.razor +++ b/LiMan.UI/Components/ListInstallazioni.razor @@ -2,7 +2,7 @@ @if (currRecord != null) { - @**@ + } @if (ListRecords == null) { @@ -33,9 +33,12 @@ else @if (currRecord == null) { - + if (!record.Installazione.StartsWith("_")) + { + + } } else { diff --git a/LiMan.UI/Components/ListInstallazioni.razor.cs b/LiMan.UI/Components/ListInstallazioni.razor.cs index 86ab56d..a607de1 100644 --- a/LiMan.UI/Components/ListInstallazioni.razor.cs +++ b/LiMan.UI/Components/ListInstallazioni.razor.cs @@ -75,6 +75,13 @@ namespace LiMan.UI.Components #region Private Methods + private async Task fullReload() + { + currRecord = null; + await DataService.InvalidateAllCache(); + await ReloadAllData(); + } + private async Task ReloadAllData() { isLoading = true; @@ -117,8 +124,14 @@ namespace LiMan.UI.Components isLoading = false; } - protected void ResetData() + protected async Task ResetData() { + await fullReload(); + } + + protected async Task UpdateData() + { + await fullReload(); } #endregion Protected Methods diff --git a/LiMan.UI/Data/LiManDataService.cs b/LiMan.UI/Data/LiManDataService.cs index 46d13c5..6011f09 100644 --- a/LiMan.UI/Data/LiManDataService.cs +++ b/LiMan.UI/Data/LiManDataService.cs @@ -147,7 +147,7 @@ namespace LiMan.UI.Data } catch (Exception exc) { - Log.Error($"Eccezione in OrderUpdate:{Environment.NewLine}{exc}"); + Log.Error($"Eccezione in ApplicazioniUpdate:{Environment.NewLine}{exc}"); } return await Task.FromResult(done); } @@ -189,6 +189,21 @@ namespace LiMan.UI.Data return await Task.FromResult(dbResult); } + public async Task InstallazioniUpdate(AnagInstallazioni currItem) + { + bool done = false; + try + { + done = dbControllerGLS.UpdateInstallazioni(currItem); + await InvalidateAllCache(); + } + catch (Exception exc) + { + Log.Error($"Eccezione in InstallazioniUpdate:{Environment.NewLine}{exc}"); + } + return await Task.FromResult(done); + } + /// /// invalida tutta la cache in caso di update /// diff --git a/LiMan.UI/LiMan.UI.csproj b/LiMan.UI/LiMan.UI.csproj index aecd9e7..6950544 100644 --- a/LiMan.UI/LiMan.UI.csproj +++ b/LiMan.UI/LiMan.UI.csproj @@ -36,4 +36,10 @@ + + + + EditApplicazioni.razor.cs + + \ No newline at end of file diff --git a/LiMan.UI/Pages/Index.razor b/LiMan.UI/Pages/Index.razor index e54d914..e6afe9f 100644 --- a/LiMan.UI/Pages/Index.razor +++ b/LiMan.UI/Pages/Index.razor @@ -1,7 +1,5 @@ @page "/" -

Hello, world!

+

Gestore licenze EgalWare

-Welcome to your new app. - - +

Prego selezionare il modulo desiderato tra quelli disponibili

\ No newline at end of file diff --git a/LiMan.UI/Pages/LiManGLS.razor b/LiMan.UI/Pages/LiManGLS.razor index 61c6762..c15e279 100644 --- a/LiMan.UI/Pages/LiManGLS.razor +++ b/LiMan.UI/Pages/LiManGLS.razor @@ -2,31 +2,33 @@ @using LiMan.UI.Components -
-
- -
-
- -
-
- -
-
- -
-
- +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
diff --git a/LiMan.UI/Shared/NavMenu.razor b/LiMan.UI/Shared/NavMenu.razor index 18da493..40ff4f0 100644 --- a/LiMan.UI/Shared/NavMenu.razor +++ b/LiMan.UI/Shared/NavMenu.razor @@ -17,21 +17,21 @@ Gestore Licenze Legacy - - - + @**@ + @**@ + @**@
From c2c2f866b16bbc5166d880b5ee459eaeb7f0270e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 8 Oct 2021 17:41:59 +0200 Subject: [PATCH 5/7] Inizio inserimento filtri x licenze --- LiMan.UI/Components/DataPager.razor | 4 +- LiMan.UI/Components/ListApplicazioni.razor | 125 +++++++------ LiMan.UI/Components/ListInstallazioni.razor | 141 ++++++++------- LiMan.UI/Components/ListLicenze.razor | 188 +++++++++++++------- LiMan.UI/Components/ListLicenze.razor.cs | 31 +++- LiMan.UI/Data/MessageService.cs | 18 ++ LiMan.UI/Data/SelectData.cs | 8 +- LiMan.UI/Data/SelectGLS.cs | 55 ++++++ LiMan.UI/Pages/LiManGLS.razor | 25 +-- LiMan.UI/Shared/NavMenu.razor | 2 +- 10 files changed, 388 insertions(+), 209 deletions(-) create mode 100644 LiMan.UI/Data/SelectGLS.cs diff --git a/LiMan.UI/Components/DataPager.razor b/LiMan.UI/Components/DataPager.razor index 3d577d1..619e271 100644 --- a/LiMan.UI/Components/DataPager.razor +++ b/LiMan.UI/Components/DataPager.razor @@ -1,5 +1,5 @@ 
-
+
@if (totalCount > 0) @@ -29,7 +29,7 @@
-
+
@if (!showLoading) diff --git a/LiMan.UI/Components/ListApplicazioni.razor b/LiMan.UI/Components/ListApplicazioni.razor index 15f19f6..7038a47 100644 --- a/LiMan.UI/Components/ListApplicazioni.razor +++ b/LiMan.UI/Components/ListApplicazioni.razor @@ -1,61 +1,70 @@ @using LiMan.UI.Components -@if (currRecord != null) -{ - -} -@if (ListRecords == null) -{ - -} -else if (totalCount == 0) -{ -
Nessun record trovato
-} -else -{ -
-
- - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - } - -
ApplicazioneDescrizione
- @if (currRecord == null) - { - if (!record.Applicativo.StartsWith("_")) - { - - } - } - else - { - - } - - @record.Applicativo - -
@record.Descrizione
-
-
+
+
+

Applicazioni

-} - \ No newline at end of file +
+ @if (currRecord != null) + { + + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + } + +
ApplicazioneDescrizione
+ @if (currRecord == null) + { + if (!record.Applicativo.StartsWith("_")) + { + + } + } + else + { + + } + + @record.Applicativo + +
@record.Descrizione
+
+
+
+ } +
+ +
\ No newline at end of file diff --git a/LiMan.UI/Components/ListInstallazioni.razor b/LiMan.UI/Components/ListInstallazioni.razor index 15b4eb9..f4c9346 100644 --- a/LiMan.UI/Components/ListInstallazioni.razor +++ b/LiMan.UI/Components/ListInstallazioni.razor @@ -1,69 +1,78 @@ @using LiMan.UI.Components -@if (currRecord != null) -{ - -} -@if (ListRecords == null) -{ - -} -else if (totalCount == 0) -{ -
Nessun record trovato
-} -else -{ -
-
- - - - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - - - } - -
InstallazioneDescrizioneContattoEmail
- @if (currRecord == null) - { - if (!record.Installazione.StartsWith("_")) - { - - } - } - else - { - - } - - @record.Installazione - -
@record.Descrizione
-
-
@record.Contatto
-
-
@record.Email
-
-
+
+
+

Installazioni

-} - \ No newline at end of file +
+ @if (currRecord != null) + { + + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + } + +
InstallazioneDescrizioneContattoEmail
+ @if (currRecord == null) + { + if (!record.Installazione.StartsWith("_")) + { + + } + } + else + { + + } + + @record.Installazione + +
@record.Descrizione
+
+
@record.Contatto
+
+
@record.Email
+
+
+
+ } +
+ +
\ No newline at end of file diff --git a/LiMan.UI/Components/ListLicenze.razor b/LiMan.UI/Components/ListLicenze.razor index 49a02ea..0a8f4fa 100644 --- a/LiMan.UI/Components/ListLicenze.razor +++ b/LiMan.UI/Components/ListLicenze.razor @@ -1,76 +1,128 @@ @using LiMan.UI.Components - -@if (currRecord != null) -{ - @**@ -} -@if (ListRecords == null) -{ - -} -else if (totalCount == 0) -{ -
Nessun record trovato
-} -else -{ -
-
- - - - - - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - - - - - } - -
InstallazioneApplicativoScadenzaNum LicenzeCodice LicenzaDescrizione
- @if (currRecord == null) +
+
+
+
+

Licenze

+
+
+
+
+
+
+ + Installazione + +
+ +
+
+
+
+
+ + Applicazione + +
+
- @record.Installazione - - @record.Applicativo - - @($"{record.Scadenza:yyyy.MM.dd}") - -
@record.NumLicenze
-
-
@record.Licenza
-
-
@record.Descrizione
-
+ +
+
+
+
-} -
- +
+ @if (currRecord != null) + { + @**@ + } + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
InstallazioneApplicativoScadenzaNum LicenzeCodice LicenzaDescrizione
+ @if (currRecord == null) + { + + } + else + { + + } + + @record.Installazione + + @record.Applicativo + + @($"{record.Scadenza:yyyy.MM.dd}") + +
@record.NumLicenze
+
+
@record.Licenza
+
+
@record.Descrizione
+
+
+
+ } +
+
\ No newline at end of file diff --git a/LiMan.UI/Components/ListLicenze.razor.cs b/LiMan.UI/Components/ListLicenze.razor.cs index 0851394..bd5c102 100644 --- a/LiMan.UI/Components/ListLicenze.razor.cs +++ b/LiMan.UI/Components/ListLicenze.razor.cs @@ -14,6 +14,9 @@ namespace LiMan.UI.Components #region Private Fields private LicenzeAttive currRecord = null; + + private List ListApp; + private List ListInstall; private List ListRecords; private List SearchRecords; @@ -53,6 +56,30 @@ namespace LiMan.UI.Components } } + private string SelApp + { + get + { + return AppMService.DetailGLSFilter.ApplicazioneSel; + } + set + { + AppMService.DetailGLSFilter.ApplicazioneSel = value; + } + } + + private string SelInst + { + get + { + return AppMService.DetailGLSFilter.InstallazioneSel; + } + set + { + AppMService.DetailGLSFilter.InstallazioneSel = value; + } + } + #endregion Private Properties #region Protected Properties @@ -78,8 +105,10 @@ namespace LiMan.UI.Components private async Task ReloadAllData() { isLoading = true; + ListRecords = null; + ListApp = await DataService.ApplicazioniGetAll(); + ListInstall = await DataService.InstallazioniGetAll(); await Task.Delay(1); - //ListRecords = null; SearchRecords = await DataService.LicenzeGetAll(); totalCount = SearchRecords.Count(); ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); diff --git a/LiMan.UI/Data/MessageService.cs b/LiMan.UI/Data/MessageService.cs index 30c7a4e..eabd30b 100644 --- a/LiMan.UI/Data/MessageService.cs +++ b/LiMan.UI/Data/MessageService.cs @@ -10,6 +10,7 @@ namespace LiMan.UI.Data #region Private Fields private SelectData _detailFilter = SelectData.Init(5, 15); + private SelectGLS _detailFilterGLS = SelectGLS.Init(60, -30); private string _pageIcon; private string _pageName; private string _searchVal; @@ -50,6 +51,23 @@ namespace LiMan.UI.Data } } + public SelectGLS DetailGLSFilter + { + get => _detailFilterGLS; + set + { + if (_detailFilterGLS != value) + { + _detailFilterGLS = value; + + if (EA_FilterUpdated != null) + { + EA_FilterUpdated?.Invoke(); + } + } + } + } + public string PageIcon { get => _pageIcon; diff --git a/LiMan.UI/Data/SelectData.cs b/LiMan.UI/Data/SelectData.cs index baf2d6e..9e44656 100644 --- a/LiMan.UI/Data/SelectData.cs +++ b/LiMan.UI/Data/SelectData.cs @@ -20,15 +20,17 @@ namespace LiMan.UI.Data /// Inizializzazione con periodo e arrotondamento /// /// - /// + /// Num giorni PREVIOUS (indietro) per start /// public static SelectData Init(int minRound, int numDayPrev) { - DateTime endRounded = DateTime.Today.AddDays(1); + // se numDayPrev è < 0 --> start oggi e va al futuro + int dayOffset = numDayPrev > 0 ? 1 : -numDayPrev; + DateTime endRounded = DateTime.Today.AddDays(dayOffset); SelectData answ = new SelectData() { DateEnd = endRounded, - DateStart = endRounded.AddDays(-numDayPrev) + DateStart = endRounded.AddDays(-Math.Abs(numDayPrev)) }; return answ; } diff --git a/LiMan.UI/Data/SelectGLS.cs b/LiMan.UI/Data/SelectGLS.cs new file mode 100644 index 0000000..89d1ab1 --- /dev/null +++ b/LiMan.UI/Data/SelectGLS.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LiMan.UI.Data +{ + public class SelectGLS : SelectData + { + #region Public Properties + + public string ApplicazioneSel { get; set; } = ""; + public string InstallazioneSel { get; set; } = ""; + + public bool OnlyActive { get; set; } = false; + + #endregion Public Properties + + #region Public Methods + + /// + /// Inizializzazione con periodo e arrotondamento + /// + /// + /// + /// + public static new SelectGLS Init(int minRound, int numDayPrev) + { + var selD = SelectData.Init(minRound, numDayPrev); + return new SelectGLS() { DateStart = selD.DateStart, DateEnd = selD.DateEnd }; + } + + public override bool Equals(object obj) + { + if (!(obj is SelectGLS item)) + return false; + + if (OnlyActive != item.OnlyActive) + return false; + if (ApplicazioneSel != item.ApplicazioneSel) + return false; + if (InstallazioneSel != item.InstallazioneSel) + return false; + + return ((SelectData)this).Equals((SelectData)obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/LiMan.UI/Pages/LiManGLS.razor b/LiMan.UI/Pages/LiManGLS.razor index c15e279..a3ccb9c 100644 --- a/LiMan.UI/Pages/LiManGLS.razor +++ b/LiMan.UI/Pages/LiManGLS.razor @@ -10,10 +10,7 @@ Licenze -
@@ -21,13 +18,21 @@
- +
+
+ +
+
-
- -
-
- +
+
+
+ +
+
+ +
+
diff --git a/LiMan.UI/Shared/NavMenu.razor b/LiMan.UI/Shared/NavMenu.razor index 40ff4f0..2a23511 100644 --- a/LiMan.UI/Shared/NavMenu.razor +++ b/LiMan.UI/Shared/NavMenu.razor @@ -14,7 +14,7 @@ @*
+
+
+
+
+
+ + +
+
+
diff --git a/LiMan.UI/Components/ListLicenze.razor.cs b/LiMan.UI/Components/ListLicenze.razor.cs index ed45ea4..8138b7e 100644 --- a/LiMan.UI/Components/ListLicenze.razor.cs +++ b/LiMan.UI/Components/ListLicenze.razor.cs @@ -56,6 +56,28 @@ namespace LiMan.UI.Components } } + private bool OnlyActive + { + get + { + bool answ = false; + if (AppMService.DetailGLSFilter != null) + { + answ = AppMService.DetailGLSFilter.OnlyActive; + } + return answ; + } + set + { + if (!AppMService.DetailGLSFilter.OnlyActive.Equals(value)) + { + AppMService.DetailGLSFilter.OnlyActive = value; + var pUpd = Task.Run(async () => await ReloadAllData()); + pUpd.Wait(); + } + } + } + private string SelApp { get