98 lines
2.2 KiB
C#
98 lines
2.2 KiB
C#
using AutoMapper.Configuration;
|
|
using GWMS.Data.DatabaseModels;
|
|
using GWMS.Data.DTO;
|
|
using GWMS.UI.Data;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.JSInterop;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using static GWMS.Data.IobObjects;
|
|
|
|
namespace GWMS.UI.Components
|
|
{
|
|
public partial class ParamSetEditor
|
|
{
|
|
#region Protected Fields
|
|
|
|
protected ParamSetModel _currItem = new ParamSetModel();
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Private Properties
|
|
|
|
[Inject]
|
|
private IJSRuntime JSRuntime { get; set; }
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected GWMSDataService DataService { get; set; }
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public ParamSetModel currItem
|
|
{
|
|
get
|
|
{
|
|
return _currItem;
|
|
}
|
|
set
|
|
{
|
|
_currItem = value;
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataReset { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataUpdated { get; set; }
|
|
|
|
[Parameter]
|
|
public string IdxMacchina { get; set; } = "";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task cancelUpdate()
|
|
{
|
|
await DataReset.InvokeAsync(0);
|
|
}
|
|
|
|
private async Task saveUpdate()
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler modificare la programmazione del parametro?"))
|
|
return;
|
|
|
|
if (_currItem != null)
|
|
{
|
|
await DataService.ParamSetUpdate(_currItem);
|
|
await DataUpdated.InvokeAsync(0);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Record null!");
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected string? FormatValueAsString(TValue? value)
|
|
{
|
|
return $"{value:N3}";
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |