Files
2023-07-21 08:39:19 +02:00

84 lines
2.1 KiB
C#

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<DoorOpTypeModel> doorOpTypes = new List<DoorOpTypeModel>();
protected List<ListValuesModel> hwList = new List<ListValuesModel>();
#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
}
}