68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Newtonsoft.Json;
|
|
using WebDoorCreator.Data;
|
|
using WebDoorCreator.Data.DbModels;
|
|
using WebDoorCreator.UI.Data;
|
|
|
|
namespace WebDoorCreator.UI.Components.Hardware
|
|
{
|
|
public partial class HardwareNewPanel
|
|
{
|
|
[Parameter]
|
|
public int DoorTypeTypeId { get; set; } = 0;
|
|
|
|
[Parameter]
|
|
public int DoorId { get; set; } = 0;
|
|
|
|
[Parameter]
|
|
public bool HwAdded { get; set; } = false;
|
|
|
|
[Parameter]
|
|
public string Lingua { get; set; } = "EN";
|
|
|
|
[Inject]
|
|
protected WebDoorCreatorService WDCService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected WDCVocabularyService WDVService { get; set; } = null!;
|
|
|
|
protected List<DoorOpModel>? ListRecord { get; set; } = null!;
|
|
protected List<DoorOpModel>? DoorOp { get; set; } = null!;
|
|
//protected DoorOpModel? DoorOp { get; set; } = null!;
|
|
protected List<GraphicParamsModel> graphicParams { get; set; } = null!;
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
ListRecord = await WDCService.DoorOpGetByDoorId(DoorId);
|
|
if (ListRecord != null)
|
|
{
|
|
DoorOp = ListRecord.Where(x => (x.DoorId == DoorId) && (x.DoorOpTypId == DoorTypeTypeId)).ToList();
|
|
}
|
|
}
|
|
|
|
public List<GraphicParamsModel> getGraphicParams(DoorOpModel currDoorOp)
|
|
{
|
|
if (DoorOp != null)
|
|
{
|
|
var param = currDoorOp.JsoncConfigVal;
|
|
var deserialized = JsonConvert.DeserializeObject<List<GraphicParamsModel>>(param);
|
|
|
|
if (deserialized != null)
|
|
{
|
|
graphicParams = deserialized;
|
|
}
|
|
}
|
|
|
|
return graphicParams;
|
|
}
|
|
|
|
protected string translate(string lemma)
|
|
{
|
|
string answ = "";
|
|
|
|
answ = WDVService.Traduci(Lingua, lemma);
|
|
|
|
return answ;
|
|
}
|
|
}
|
|
} |