review struttura recupero dati da SQL paginati

This commit is contained in:
Samuele Locatelli
2021-06-19 14:18:30 +02:00
parent 560c0c400f
commit f1ddde0ff4
2 changed files with 66 additions and 2 deletions
+32
View File
@@ -12,10 +12,38 @@ namespace MP.Stats.Data
public string CodArticolo { get; set; } = "*";
public DateTime DateEnd { get; set; } = DateTime.Now.AddMinutes(1);
public DateTime DateStart { get; set; } = DateTime.Now.AddDays(-7);
/// <summary>
/// Primo record x selezione paginata, tipicamente primo della "decina" della pagina corrente
/// </summary>
public int FirstRecord
{
get
{
int primaPag = PageNum % 10;
int decina = PageNum - primaPag;
return PageSize * decina + 1;
}
}
public string IdxMacchina { get; set; } = "*";
public int IdxOdl { get; set; } = -999;
public string KeyRichiesta { get; set; } = "*";
/// <summary>
/// Numero record da recuperare, tipicamente la decina della pag corrente (10 * PageSize)
/// </summary>
public int NumRecord
{
get
{
return PageSize * 10;
}
}
public int PageNum { get; set; } = 1;
public int PageSize { get; set; } = 10;
#endregion Public Properties
#region Public Methods
@@ -44,6 +72,10 @@ namespace MP.Stats.Data
if (!(obj is SelectData item))
return false;
if (PageSize != item.PageSize)
return false;
if (PageNum != item.PageNum)
return false;
if (CodArticolo != item.CodArticolo)
return false;
if (DateEnd != item.DateEnd)