using LiMan.DB.DTO; using Microsoft.AspNetCore.Components; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace LiMan.UI.Components { public partial class ListDevicesDTO { #region Public Properties [Parameter] public EventCallback EC_StatusReq { get; set; } [Parameter] public List SearchRecord { get; set; } = null!; [Parameter] public string Title { get; set; } = "Updaters List"; #endregion Public Properties #region Protected Methods protected void setNumPage(int newNum) { currPage = newNum; ReloadData(); isLoading = false; } protected void setNumRec(int newNum) { currPage = 1; numRecord = newNum; ReloadData(); isLoading = false; } protected async Task ShowDetail(Core.Enum.UpdStatus status) { await EC_StatusReq.InvokeAsync(status); } protected override void OnParametersSet() { ReloadData(); } #endregion Protected Methods #region Private Fields private int currPage = 1; private bool isLoading = false; private int numRecord = 10; private int totalCount = 0; #endregion Private Fields #region Private Properties private List ListRecord { get; set; } = new List(); #endregion Private Properties #region Private Methods private void ReloadData() { totalCount = SearchRecord.Count; // paginazione ListRecord = SearchRecord .Skip((currPage - 1) * numRecord) .Take(numRecord) .ToList(); } #endregion Private Methods } }