97 lines
2.6 KiB
C#
97 lines
2.6 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using WebDoorCreator.Data.DbModels;
|
|
using WebDoorCreator.UI.Data;
|
|
|
|
namespace WebDoorCreator.UI.Components.Hardware
|
|
{
|
|
public partial class HardwareNewPanel
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public int DoorId { get; set; } = 0;
|
|
|
|
[Parameter]
|
|
public EventCallback<DoorOpModel> E_recordUpdate { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<DoorOpModel> E_selTemplate { get; set; }
|
|
|
|
[Parameter]
|
|
public bool HwAdded { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public string HwCode { get; set; } = "";
|
|
|
|
[Parameter]
|
|
public string Lingua { get; set; } = "EN";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
protected List<DoorOpModel>? DoorOpList { get; set; } = null!;
|
|
|
|
protected int instNum { get; set; } = 1;
|
|
|
|
[Inject]
|
|
protected WebDoorCreatorService WDCService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
[Inject]
|
|
protected WDCRefreshService WDCRService { get; set; } = null!;
|
|
|
|
protected bool B_doorOpUpd
|
|
{
|
|
get => WDCRService.isDoorOpUpd;
|
|
set => WDCRService.isDoorOpUpd = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gestione update da oggetto sottostante
|
|
/// </summary>
|
|
/// <param name="currItem"></param>
|
|
/// <returns></returns>
|
|
protected async Task manageUpdate(DoorOpModel currItem)
|
|
{
|
|
await Task.Delay(1);
|
|
// aggiorna nelle DoorOpList...
|
|
if (DoorOpList != null)
|
|
{
|
|
var item2rem = DoorOpList.Where(x => x.DoorOpId == currItem.DoorOpId).FirstOrDefault();
|
|
if (item2rem != null)
|
|
{
|
|
DoorOpList.Remove(item2rem);
|
|
}
|
|
await Task.Delay(1);
|
|
B_doorOpUpd = true;
|
|
DoorOpList.Add(currItem);
|
|
|
|
}
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Methods
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
var ListRecord = await WDCService.DoorOpGetByDoorId(DoorId);
|
|
var tempListVal = await WDCService.ListValuesGetAll(HwCode, "Folder");
|
|
if (ListRecord != null)
|
|
{
|
|
DoorOpList = ListRecord.Where(x => (x.DoorId == DoorId) && (x.ObjectId == HwCode)).ToList();
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |