74 lines
2.2 KiB
C#
74 lines
2.2 KiB
C#
|
|
using EgwCoreLib.Razor;
|
|
|
|
namespace Lux.UI.Components.Pages
|
|
{
|
|
public partial class OffStats
|
|
{
|
|
|
|
#region Protected Methods
|
|
|
|
protected override Task OnInitializedAsync()
|
|
{
|
|
return ReloadDataAsync();
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
// preparo sel periodo custom (traduzioni)...
|
|
CustomSelDict = Enum.GetValues(typeof(DtUtils.PeriodSet))
|
|
.Cast<DtUtils.PeriodSet>()
|
|
.ToDictionary(e => e, e => Traduci("periodo_" + e.ToString()));
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
private List<OfferModel> AllOfferRecords { get; set; } = new();
|
|
private List<OfferModel> WinOffRecords { get; set; } = new();
|
|
|
|
private DtUtils.Periodo PeriodoSel = new DtUtils.Periodo(DtUtils.PeriodSet.ThisYear);
|
|
|
|
/// <summary>
|
|
/// Periodo custom selezione valori
|
|
/// </summary>
|
|
private Dictionary<DtUtils.PeriodSet, string>? CustomSelDict = new();
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
[Inject]
|
|
private IJSRuntime JSRuntime { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IOfferService OffService { get; set; } = default!;
|
|
|
|
[Inject]
|
|
private NavigationManager NavigationManager { get; set; } = null!;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task ReloadDataAsync()
|
|
{
|
|
await OffService.CheckExpiredAsync();
|
|
AllOfferRecords = await OffService.GetFiltAsync(PeriodoSel.Inizio, PeriodoSel.Fine);
|
|
WinOffRecords = AllOfferRecords.Where(x => x.Envir == EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta periodo da filtro
|
|
/// </summary>
|
|
/// <param name="newPeriod"></param>
|
|
/// <returns></returns>
|
|
private Task SetPeriodo(DtUtils.Periodo newPeriod)
|
|
{
|
|
PeriodoSel = newPeriod;
|
|
return ReloadDataAsync();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |