164 lines
4.0 KiB
C#
164 lines
4.0 KiB
C#
using LiMan.GLS.DatabaseModels;
|
|
using LiMan.UI.Data;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LiMan.UI.Components
|
|
{
|
|
public partial class EditLicenzeGLS
|
|
{
|
|
#region Private Fields
|
|
|
|
private List<DB.DBModels.LicenzaModel> ElencoLicenzeNext;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Protected Fields
|
|
|
|
protected LicenzeAttive _currItem = new LicenzeAttive();
|
|
|
|
protected int _SelIdxLic = 0;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Private Properties
|
|
|
|
[Inject]
|
|
private IJSRuntime JSRuntime { get; set; }
|
|
|
|
[Inject]
|
|
private NavigationManager NavManager { get; set; }
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected LiManDataService DataService { get; set; }
|
|
|
|
protected bool editAll
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
var currMode = GetQueryParm("currMode");
|
|
if (!string.IsNullOrEmpty(currMode))
|
|
{
|
|
answ = currMode.Equals("debug");
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
[Inject]
|
|
protected MessageService MessageService { get; set; }
|
|
|
|
protected int SelIdxLic
|
|
{
|
|
get => _SelIdxLic;
|
|
set
|
|
{
|
|
if (value != _SelIdxLic)
|
|
_SelIdxLic = value;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public LicenzeAttive currItem
|
|
{
|
|
get
|
|
{
|
|
return _currItem;
|
|
}
|
|
set
|
|
{
|
|
_currItem = value;
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataReset { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataUpdated { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task cancelUpdate()
|
|
{
|
|
await DataReset.InvokeAsync(0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Registra la licenza come log di un altra licenza master
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task recordLogLicense()
|
|
{
|
|
if (SelIdxLic > 0)
|
|
{
|
|
if (_currItem != null)
|
|
{
|
|
// effettuo trasferimento...
|
|
await DataService.LicenzaLogGlsNext(_currItem, SelIdxLic);
|
|
await DataUpdated.InvokeAsync(0);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Record null!");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Effettua il trasferimento della licenza al nuovo sistema...
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task transferLicense()
|
|
{
|
|
if (_currItem != null)
|
|
{
|
|
// effettuo trasferimento...
|
|
await DataService.LicenzaTransferGlsNext(_currItem);
|
|
await DataUpdated.InvokeAsync(0);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Record null!");
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Blazor: get query parm from the URL
|
|
/// </summary>
|
|
/// <param name="parmName"></param>
|
|
/// <returns></returns>
|
|
protected string GetQueryParm(string parmName)
|
|
{
|
|
var uriBuilder = new UriBuilder(NavManager.Uri);
|
|
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
|
|
return q[parmName] ?? "";
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
ElencoLicenzeNext = await DataService.LicenzeNextGetAll();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |