124 lines
2.7 KiB
C#
124 lines
2.7 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using SHERPA.BBM.CORE.DbModels;
|
|
|
|
namespace SHERPA.BBM.UI.Components
|
|
{
|
|
public partial class NegotiationEditor
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataReset { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<int> DataUpdated { get; set; }
|
|
|
|
[Parameter]
|
|
public CORE.DbModels.NegotiationsModel Negotiation
|
|
{
|
|
get
|
|
{
|
|
return _negotiation;
|
|
}
|
|
|
|
set
|
|
{
|
|
_negotiation = value;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Fields
|
|
|
|
protected CORE.DbModels.NegotiationsModel _negotiation = new NegotiationsModel();
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected int SelBasketId
|
|
{
|
|
get
|
|
{
|
|
int answ = 1;
|
|
if (_negotiation != null)
|
|
{
|
|
answ = _negotiation.BasketId;
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
|
|
set
|
|
{
|
|
_negotiation.BasketId = value;
|
|
}
|
|
}
|
|
|
|
protected int SelCustomerId
|
|
{
|
|
get
|
|
{
|
|
int answ = 1;
|
|
if (_negotiation != null)
|
|
{
|
|
answ = _negotiation.CustomerId;
|
|
}
|
|
|
|
return answ;
|
|
}
|
|
|
|
set
|
|
{
|
|
_negotiation.CustomerId = value;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ReloadAllData();
|
|
}
|
|
|
|
protected async Task ReloadAllData()
|
|
{
|
|
CustomersList = await BBMService.CustomersGetAll("");
|
|
BasketsList = await BBMService.BasketsGetAsync(1, 0);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private List<vBasketsDataModel> BasketsList = new List<vBasketsDataModel>();
|
|
private List<CustomersModel> CustomersList = new List<CustomersModel>();
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Methods
|
|
|
|
private async Task cancelUpdate()
|
|
{
|
|
await DataReset.InvokeAsync(0);
|
|
}
|
|
|
|
private async Task saveUpdate()
|
|
{
|
|
if (_negotiation != null)
|
|
{
|
|
BBMService.NegotiationUpdate(_negotiation);
|
|
await DataUpdated.InvokeAsync(1);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Negotiation null!");
|
|
}
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |