86 lines
2.0 KiB
C#
86 lines
2.0 KiB
C#
using EgwCoreLib.Lux.Data.DbModel;
|
|
using EgwCoreLib.Lux.Data.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
using static EgwCoreLib.Lux.Core.Enum;
|
|
|
|
namespace Lux.UI.Components.Compo
|
|
{
|
|
public partial class OfferRowMan
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public int OfferID { get; set; } = 0;
|
|
|
|
|
|
[Parameter]
|
|
public DisplayMode DisplayMode { get; set; } =DisplayMode.Standard;
|
|
|
|
#endregion Public Properties
|
|
|
|
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected DataLayerServices DLService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
ReloadData();
|
|
UpdateTable();
|
|
}
|
|
|
|
protected void DoEdit(OfferRowModel curRec)
|
|
{
|
|
EditRecord = curRec;
|
|
}
|
|
|
|
private OfferRowModel? EditRecord = null;
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private List<OfferRowModel> AllRecords = new List<OfferRowModel>();
|
|
private int currPage = 1;
|
|
private bool isLoading = false;
|
|
private List<OfferRowModel> ListRecords = new List<OfferRowModel>();
|
|
private int numRecord = 10;
|
|
private int totalCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Legge i dati dei record completi
|
|
/// </summary>
|
|
private void ReloadData()
|
|
{
|
|
if (OfferID > 0)
|
|
{
|
|
AllRecords = DLService.OfferRowGetByOffer(OfferID);
|
|
totalCount = AllRecords.Count();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Filtro e paginazione
|
|
/// </summary>
|
|
private void UpdateTable()
|
|
{
|
|
// fix paginazione
|
|
ListRecords = AllRecords
|
|
.Skip(numRecord * (currPage - 1))
|
|
.Take(numRecord)
|
|
.ToList();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |