Files
Samuele Locatelli 80c2214265 Update comp periodo:
- possibile inizializzare periodo
2023-06-28 17:23:33 +02:00

94 lines
2.4 KiB
C#

using EgwCoreLib.Utils;
using Microsoft.AspNetCore.Components;
namespace EgwCoreLib.Razor
{
public partial class PeriodoSel
{
#region Public Properties
[Parameter]
public EventCallback<DtUtils.Periodo> E_PeriodoSel { get; set; }
#endregion Public Properties
#region Protected Properties
[Parameter]
public DtUtils.Periodo CurrPeriodo
{
get => currPeriodo;
set
{
if (currPeriodo != value)
{
currPeriodo = value;
E_PeriodoSel.InvokeAsync(CurrPeriodo);
}
}
}
protected DateTime Fine
{
get => CurrPeriodo.Fine;
set
{
if (CurrPeriodo.Fine != value)
{
CurrPeriodo.Fine = value;
perSelect = $"{DtUtils.PeriodSet.Select}";
E_PeriodoSel.InvokeAsync(CurrPeriodo);
}
}
}
protected DateTime Inizio
{
get => CurrPeriodo.Inizio;
set
{
if (CurrPeriodo.Inizio != value)
{
CurrPeriodo.Inizio = value;
perSelect = $"{DtUtils.PeriodSet.Select}";
E_PeriodoSel.InvokeAsync(CurrPeriodo);
}
}
}
protected List<string> periodList { get => Enum.GetNames(typeof(DtUtils.PeriodSet)).ToList(); }
protected string PerSelect
{
get => perSelect;
set
{
if (perSelect != value)
{
perSelect = value;
// effettuo preselezione...
Enum.TryParse(value, out DtUtils.PeriodSet newPer);
CurrPeriodo = new DtUtils.Periodo(newPer);
}
}
}
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await E_PeriodoSel.InvokeAsync(CurrPeriodo);
}
#endregion Protected Methods
#region Private Properties
private DtUtils.Periodo currPeriodo { get; set; } = new DtUtils.Periodo();
private string perSelect { get; set; } = "Select";
#endregion Private Properties
}
}