using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.Data.DTO; using MP.SPEC.Components; using MP.SPEC.Data; namespace MP.SPEC.Pages { public partial class DOSS { #region Protected Fields protected DataPager pagerODL = null!; #endregion Protected Fields #region Protected Properties [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; [Inject] protected MpDataService MDService { get; set; } = null!; [Inject] protected MessageService MsgService { get; set; } = null!; #endregion Protected Properties #region Protected Methods protected async Task cancel() { currDetFluxLogRecord = null; await Task.Delay(1); } protected void ForceReload(int newNum) { numRecord = newNum; } protected void ForceReloadPage(int newNum) { currPage = newNum; StateHasChanged(); } protected override async Task OnInitializedAsync() { isLoading = true; isFiltering = true; // disabilito ricerca... MsgService.SearchVal = ""; MsgService.ShowSearch = false; // fix pagina await Task.Delay(1); var modFilter = currFilter; modFilter.CurrPage = 1; currFilter = modFilter; await Task.Delay(1); isFiltering = false; } protected async Task selRecordDoss(Dossiers selDoss) { currRecordDoss = selDoss; await Task.Delay(1); } protected async Task selRecordFlux(FluxLogDTO selRec) { currDetFluxLogRecord = selRec; await Task.Delay(1); } protected async Task update(FluxLogDTO selRec) { if (!await JSRuntime.InvokeAsync("confirm", "Confermi di voler salvare le modifiche? queste saranno parte del dossier inviato all'impianto")) return; await Task.Delay(1); if (currRecordDoss != null) { // METODO PER UPDATE FLUX await MDService.updateDossierValue(currRecordDoss, selRec); } currDetFluxLogRecord = null; await Task.Delay(1); } protected void updateTotal(int newTotCount) { totalCount = newTotCount; } #endregion Protected Methods #region Private Fields private FluxLogDTO? _currDetFluxLogRecord = null; #endregion Private Fields #region Private Properties private FluxLogDTO? currDetFluxLogRecord { get => _currDetFluxLogRecord; set { _currDetFluxLogRecord = value; } } private SelectDossierParams currFilter { get; set; } = new SelectDossierParams(); private int currPage { get => MsgService.currPage; set => MsgService.currPage = value; } private Dossiers? currRecordDoss { get; set; } = null; private bool isFiltering { get; set; } = false; private bool isLoading { get; set; } = true; private int numRecord { get => MsgService.numRecord; set => MsgService.numRecord = value; } private int totalCount { get; set; } = 0; #endregion Private Properties #region Private Methods private async Task updateFilter(SelectDossierParams newParams) { isFiltering = false; isLoading = true; await Task.Delay(1); currPage = 1; await Task.Delay(1); await InvokeAsync(() => StateHasChanged()); currFilter = newParams; isLoading = false; } #endregion Private Methods } }