Files
samuele b1afa82a91 Continuo spostamento servizi in Data:
- GpwDataSrvice
- MessageService
- ogni dipendenza (aggiunti using, in _import non basta...)
2024-09-07 11:40:28 +02:00

138 lines
3.5 KiB
C#

using GPW.CORE.Data.DbModels;
using GPW.CORE.Data.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
namespace GPW.CORE.WRKLOG.Components.Compo
{
public partial class ProjAgendaDetail
{
#region Public Properties
[Parameter]
public EventCallback<bool> CloseReq { get; set; }
[Parameter]
public int IdxDipSel { get; set; } = 0;
[Parameter]
public EventCallback<RegAttivitaModel> ItemCloned { get; set; }
[Parameter]
public EventCallback<RegAttivitaModel> ItemDeleted { get; set; }
[Parameter]
public EventCallback<RegAttivitaModel> ItemSelected { get; set; }
[Parameter]
public List<AnagFasiModel> ListFasi { get; set; } = null!;
[Parameter]
public List<RegAttivitaModel>? ListRA { get; set; }
[Parameter]
public int MaxChar { get; set; } = 100;
#endregion Public Properties
#region Protected Properties
[Inject]
protected MessageService AppMServ { get; set; } = null!;
protected RegAttivitaModel? currRecord { get; set; } = null;
[Inject]
protected GpwDataService GDataServ { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Indico item selezionato
/// </summary>
protected async void DoClose()
{
currRecord = null;
await CloseReq.InvokeAsync(true);
}
protected string getItemCss(RegAttivitaModel itemRecord)
{
string answ = "";
if (currRecord != null)
{
if (itemRecord.Equals(currRecord))
{
answ = "bg-info bg-opacity-25";
}
}
return answ;
}
protected override Task OnParametersSetAsync()
{
if (ListRA != null)
{
// sistemo la prima timbratura
if (ListRA.Count > 0)
{
var lastRec = ListRA.OrderByDescending(x => x.Inizio).FirstOrDefault();
if (lastRec != null)
{
LastTimb = CORE.Data.Utils.DateRounded(lastRec.Inizio.Add(lastRec.Durata), 5, false);
}
}
}
return base.OnParametersSetAsync();
}
/// <summary>
/// Indico item selezionato
/// </summary>
protected async void ReportDeleted()
{
await ItemDeleted.InvokeAsync(null);
}
/// <summary>
/// Indico item selezionato
/// </summary>
protected async void ReportSelected(RegAttivitaModel selRecord)
{
currRecord = selRecord;
await ItemSelected.InvokeAsync(selRecord);
}
#endregion Protected Methods
#region Private Fields
/// <summary>
/// record prima timbratura utile
/// </summary>
private DateTime LastTimb = DateTime.Now;
#endregion Private Fields
#region Private Properties
private RegAttivitaModel? clonedRA
{
get
{
return AppMServ.clonedRA;
}
set
{
AppMServ.clonedRA = value;
}
}
#endregion Private Properties
}
}