82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
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 string HwCode { get; set; } = "";
|
|
|
|
[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 Dictionary<string, Dictionary<string, List<string>>> graphicParams { get; set; } = null!;
|
|
protected List<ListValuesModel> listValuesGP { get; set; } = null!;
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
ListRecord = await WDCService.DoorOpGetByDoorId(DoorId);
|
|
var tempListVal = await WDCService.ListValuesGetAll(HwCode, "Folder");
|
|
if (ListRecord != null)
|
|
{
|
|
DoorOp = ListRecord.Where(x => (x.DoorId == DoorId) && (x.ObjectId == HwCode)).ToList();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public Dictionary<string, Dictionary<string, List<string>>> getGraphicParams()
|
|
{
|
|
if (DoorOp != null)
|
|
{
|
|
var param = DoorOp.Where(x => x.ObjectId == HwCode).FirstOrDefault();
|
|
var deserialized = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, List<string>>>>(param?.JsoncConfigVal!);
|
|
|
|
if (deserialized != null)
|
|
{
|
|
graphicParams = deserialized;
|
|
}
|
|
|
|
//listValuesGP = listValues.Where(x => x.FieldName == "Graphic Parameters1").ToList();
|
|
}
|
|
|
|
return graphicParams;
|
|
}
|
|
|
|
protected string translate(string lemma)
|
|
{
|
|
string answ = "";
|
|
|
|
answ = WDVService.Traduci(Lingua, lemma);
|
|
|
|
return answ;
|
|
}
|
|
}
|
|
} |