using Microsoft.AspNetCore.Components; using WebDoorCreator.Data.DbModels; using WebDoorCreator.Data.Services; using WebDoorCreator.UI.Data; namespace WebDoorCreator.UI.Components.FilesMan { public partial class HwMan { #region Protected Fields protected List doorOpTypes = new List(); protected List hwList = new List(); #endregion Protected Fields #region Protected Properties protected DoorOpTypeModel? currHw2Show { get; set; } = null; [Inject] protected WebDoorCreatorService WDCService { get; set; } = null!; [Inject] protected WDCUserService WDCUService { get; set; } = null!; [Inject] protected WDCVocabularyService WDCVService { get; set; } = null!; #endregion Protected Properties #region Protected Methods protected string GetCompoName(string hwCode) { string answ = ""; var listValHw2Search = hwList.Where(x => x.TableName == hwCode).FirstOrDefault(); if (listValHw2Search != null) { answ = translate(listValHw2Search.Label); } return answ; } protected override async Task OnParametersSetAsync() { await ReloadData(); } protected async Task ReloadData() { var temp = await WDCService.DoorOpTypeGetByHwCode("*", 0); var tempHwList = await WDCService.ListValuesGetAll("*", "Hardware"); if (temp != null) { doorOpTypes = temp; } if (tempHwList != null) { hwList = tempHwList; } } protected async Task setCurrHw2Show(DoorOpTypeModel hw) { await Task.Delay(1); currHw2Show = hw; } protected string translate(string lemma) { string answ = ""; answ = WDCVService.Traduci(WDCUService.currLanguage ?? "EN", lemma); return answ; } #endregion Protected Methods } }