103 lines
2.5 KiB
C#
103 lines
2.5 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
using SHERPA.BBM.CORE.DbModels;
|
|
using SHERPA.BBM.UI.Data;
|
|
|
|
namespace SHERPA.BBM.UI.Components
|
|
{
|
|
public partial class OrdRes
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public OrderModel? CurrOrd { get; set; } = null;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public string CheckSelect(int OrdResId)
|
|
{
|
|
string answ = "";
|
|
if (currItem != null)
|
|
{
|
|
try
|
|
{
|
|
answ = (currItem.OrdResId == OrdResId) ? "table-info" : "";
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Properties
|
|
|
|
protected bool IsLoading { get; set; } = false;
|
|
|
|
protected List<OrderResModel>? ListRecords { get; set; } = null;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected async Task Delete(OrderResModel currRecord)
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record '{currRecord.Note} | {currRecord.ItemNav.Descript}' per {currRecord.FinalPrice:C2}?"))
|
|
return;
|
|
|
|
await BBMService.OrdResourcesDelete(currRecord.OrdResId);
|
|
await ReloadData();
|
|
}
|
|
|
|
protected void Edit(OrderResModel currRecord)
|
|
{
|
|
currItem = currRecord;
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private OrderResModel? currItem = null;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
[Inject]
|
|
private BBM_EFService BBMService { get; set; } = null!;
|
|
|
|
[Inject]
|
|
private IJSRuntime JSRuntime { get; set; } = null!;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private async Task ReloadData()
|
|
{
|
|
IsLoading = true;
|
|
await Task.Delay(1);
|
|
if (CurrOrd != null)
|
|
{
|
|
ListRecords = await BBMService.OrdResourcesByOrd(CurrOrd.OrdId);
|
|
}
|
|
else
|
|
{
|
|
ListRecords = new List<OrderResModel>();
|
|
}
|
|
IsLoading = false;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |