Files
webdoorcreator/WebDoorCreator.UI/Components/FilesMan/HwMan.razor.cs
T
2023-06-07 12:15:30 +02:00

105 lines
3.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using EgwCoreLib.Razor;
using EgwCoreLib.Utils;
using WebDoorCreator.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.UI;
using WebDoorCreator.UI.Components;
using WebDoorCreator.UI.Components.Buttons;
using WebDoorCreator.UI.Components.CompMan;
using WebDoorCreator.UI.Components.DoorMan;
using WebDoorCreator.UI.Components.DoorDef;
using WebDoorCreator.UI.Components.Gen;
using WebDoorCreator.UI.Components.Order;
using WebDoorCreator.UI.Components.Users;
using WebDoorCreator.UI.Components.Hardware;
using WebDoorCreator.UI.Components.SvgComp;
using WebDoorCreator.UI.Components.Filters;
using WebDoorCreator.UI.Components.Report;
using WebDoorCreator.UI.Components.FilesMan;
using WebDoorCreator.UI.Components.TemplateMan;
using WebDoorCreator.UI.Shared;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Pages;
using System.Runtime.InteropServices;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.FilesMan
{
public partial class HwMan
{
protected List<DoorOpTypeModel> doorOpTypes = new List<DoorOpTypeModel>();
protected List<ListValuesModel> hwList = new List<ListValuesModel>();
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
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 string translate(string lemma)
{
string answ = "";
answ = WDCVService.Traduci(WDCUService.currLanguage ?? "EN", lemma);
return answ;
}
protected DoorOpTypeModel? currHw2Show { get; set; } = null;
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 async Task setCurrHw2Show(DoorOpTypeModel hw)
{
await Task.Delay(1);
currHw2Show = hw;
}
}
}