113 lines
2.6 KiB
C#
113 lines
2.6 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
using GWMS.UI.Data;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using GWMS.Data.DTO;
|
|
|
|
namespace GWMS.UI.Pages
|
|
{
|
|
public partial class PlantStatus : ComponentBase, IDisposable
|
|
{
|
|
#region Private Fields
|
|
|
|
private PlantDTO currRecord = null;
|
|
|
|
private List<PlantDTO> ListRecords;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private bool isLoading { get; set; } = false;
|
|
|
|
private bool ShowCharts { get; set; } = false;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected GWMSDataService DataService { get; set; }
|
|
|
|
[Inject]
|
|
protected IJSRuntime JSRuntime { get; set; }
|
|
|
|
[Inject]
|
|
protected MessageService MessageService { get; set; }
|
|
|
|
[Inject]
|
|
protected NavigationManager NavManager { get; set; }
|
|
|
|
protected int totalCount
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
if (ListRecords != null)
|
|
{
|
|
answ = ListRecords.Count;
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task reloadData()
|
|
{
|
|
isLoading = true;
|
|
ListRecords = await DataService.PlantsGetAll();
|
|
isLoading = false;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
MessageService.ShowSearch = false;
|
|
MessageService.PageName = "Impianti";
|
|
MessageService.PageIcon = "fas fa-gas-pump pr-2";
|
|
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
|
await reloadData();
|
|
}
|
|
|
|
protected void Select(PlantDTO selRecord)
|
|
{
|
|
// applico filtro da selezione
|
|
currRecord = selRecord;
|
|
}
|
|
|
|
protected async Task UpdateData()
|
|
{
|
|
currRecord = null;
|
|
await reloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
|
}
|
|
|
|
public async void OnSeachUpdated()
|
|
{
|
|
await InvokeAsync(() =>
|
|
{
|
|
Task task = UpdateData();
|
|
StateHasChanged();
|
|
});
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |