From 446d376a9fbc0e2388d1a3c1576c37f8f787caeb Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 18 Nov 2022 12:51:35 +0100 Subject: [PATCH] bozza paging --- MP.INVE/Data/DataPagerParams.cs | 52 +++++++++++++++++++++++ MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Session.razor | 2 +- MP.INVE/Pages/Session.razor.cs | 45 +++++++++++++++++--- MP.INVE/Pages/Starter.razor | 63 +++++++++++++++++++++++---- MP.INVE/Pages/Starter.razor.cs | 73 +++++++++++++++++++++++++++++--- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- MP.INVE/Shared/NavMenu.razor | 2 +- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 14 files changed, 224 insertions(+), 29 deletions(-) create mode 100644 MP.INVE/Data/DataPagerParams.cs diff --git a/MP.INVE/Data/DataPagerParams.cs b/MP.INVE/Data/DataPagerParams.cs new file mode 100644 index 00000000..e4535b62 --- /dev/null +++ b/MP.INVE/Data/DataPagerParams.cs @@ -0,0 +1,52 @@ +using MP.Data; + +namespace MP.INVE.Data +{ + public class DataPagerParams + { + #region Public Constructors + + public DataPagerParams() + { } + + #endregion Public Constructors + + #region Public Properties + + public int CurrPage { get; set; } = 1; + public int NumRec { get; set; } = 10; + public int TotCount { get; set; } = 0; + public int MaxRecord { get; set; } = 100; + + #endregion Public Properties + + #region Public Methods + + public override bool Equals(object obj) + { + if (!(obj is DataPagerParams item)) + return false; + + if (MaxRecord != item.MaxRecord) + return false; + + if (TotCount != item.TotCount) + return false; + + if (NumRec != item.NumRec) + + if (CurrPage != item.CurrPage) + return false; + + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 76815806..18862210 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2211.1809 + 6.16.2211.1812 diff --git a/MP.INVE/Pages/Session.razor b/MP.INVE/Pages/Session.razor index e88dafeb..738d2ada 100644 --- a/MP.INVE/Pages/Session.razor +++ b/MP.INVE/Pages/Session.razor @@ -184,7 +184,7 @@ diff --git a/MP.INVE/Pages/Session.razor.cs b/MP.INVE/Pages/Session.razor.cs index 58f3c0a7..9cea287c 100644 --- a/MP.INVE/Pages/Session.razor.cs +++ b/MP.INVE/Pages/Session.razor.cs @@ -26,10 +26,15 @@ namespace MP.INVE.Pages [Inject] private MiDataService MIDataservice { get; set; } = null!; + DataPagerParams currParams = new DataPagerParams(); + private List? elencoSessioni; + private List? SearchRecords; private List? elencoOperatori; private List? elencoMagazzini; + private DataPager pagerSession = null!; + protected override async Task OnInitializedAsync() { //await FilterChanged.InvokeAsync(actFilter); @@ -62,7 +67,6 @@ namespace MP.INVE.Pages } } - private bool reqNew { get; set; } = false; private void openNew() { @@ -114,24 +118,44 @@ namespace MP.INVE.Pages } } + private bool reqNew { get; set; } = false; private bool isLoading { get; set; } = false; - private int magazzino { get; set; } = 0; private string matrOpr { get; set; } = ""; + private int magazzino { get; set; } = 0; private string desc { get; set; } = ""; + private int totalCount + { + get => currParams.TotCount; + set=> currParams.TotCount = value; + } + private int numRecord + { + get => currParams.NumRec; + set => currParams.NumRec = value; + } + private int currPage + { + get => currParams.CurrPage; + set => currParams.CurrPage = value; + } private async Task reloadData() - { - await Task.Delay(1); + { elencoSessioni = null; isLoading = true; if (inCorso) { - elencoSessioni = MIDataservice.InventSessCurrList(); + SearchRecords = MIDataservice.InventSessCurrList(); } else { - elencoSessioni = MIDataservice.InventSessHistList(dtStart, dtEnd); + SearchRecords = MIDataservice.InventSessHistList(dtStart, dtEnd); } + totalCount = SearchRecords.Count; + elencoSessioni = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + await Task.Delay(1); isLoading = false; } protected async Task getCurrSess(int idSess) @@ -150,6 +174,15 @@ namespace MP.INVE.Pages [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } protected async Task getId() { diff --git a/MP.INVE/Pages/Starter.razor b/MP.INVE/Pages/Starter.razor index fd79030c..a23b7545 100644 --- a/MP.INVE/Pages/Starter.razor +++ b/MP.INVE/Pages/Starter.razor @@ -12,23 +12,70 @@
-
- @*@if (isLoading) + @if (isLoading) { - }*@ - @*else + } + else { @if (reqNew) { - - }*@ +
+
+
+
+
+ Avvia una nuova sessione +
+
+
+
+
+
+
+
+ Codice magazzino + +
+
+
+
+ Descrizione + +
+
+
+
+
+
+
+
+
+
+ +
+
+
+ @if (codMag != "") + { +
+ +
+ } +
+
+
+
+
+
+ } @@ -59,7 +106,7 @@ @item.DescMag @@ -69,7 +116,7 @@ }
-
- @*}*@ + }