From c2c2f866b16bbc5166d880b5ee459eaeb7f0270e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 8 Oct 2021 17:41:59 +0200 Subject: [PATCH] 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 @@ @*