Files
2023-07-19 19:40:54 +02:00

82 lines
1.7 KiB
C#

using Microsoft.AspNetCore.Components;
using SHERPA.BBM.CORE.DbModels;
using SHERPA.BBM.UI.Data;
namespace SHERPA.BBM.UI.Components
{
public partial class BillsEditor
{
#region Public Properties
[Parameter]
public CORE.DbModels.Fatt2DocModel 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 Protected Fields
protected CORE.DbModels.Fatt2DocModel _currItem = new Fatt2DocModel();
#endregion Protected Fields
#region Protected Properties
[Inject]
protected BBM_EFService BBMService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadAllData();
}
protected async Task ReloadAllData()
{
await Task.Delay(1);
}
#endregion Protected Methods
#region Private Methods
private async Task cancelUpdate()
{
await DataReset.InvokeAsync(0);
}
private async Task saveUpdate()
{
if (_currItem != null)
{
await BBMService.BillUpdate(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
{
Console.WriteLine("Bill null!");
}
}
#endregion Private Methods
}
}