Files
StockMan/StockMan.CORE/Components/LocationDX.razor.cs
T

94 lines
2.1 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using StockMan.CORE.Data;
using StockMan.Data.DbModels;
namespace StockMan.CORE.Components
{
public partial class LocationDX
{
#region Public Properties
public string currLoc { get; set; } = "";
[Parameter]
public bool isChanged { get; set; } = false;
public List<ItemStockModel>? listItemByLoc { get; set; } = null;
[Parameter]
public List<LocationModel>? ListLocationByType { get; set; } = null;
[Parameter]
public string locDX_ID { get; set; } = "";
[Parameter]
public string locSX_ID { get; set; } = "";
#endregion Public Properties
#region Protected Fields
protected int? _currItem;
#endregion Protected Fields
#region Protected Properties
protected int? currItem
{
get => _currItem;
set => _currItem = value;
}
protected string id
{
get => currLoc;
set
{
currLoc = value;
ReloadData();
}
}
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
protected StockDataService SDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
protected async Task ReloadData()
{
if (!isChanged)
{
currLoc = locDX_ID;
}
else
{
currLoc = locSX_ID;
}
listItemByLoc = await SDService.ItemsGetByLocation(currLoc);
}
#endregion Protected Methods
#region Private Methods
private async void selItemToDet(int selItem)
{
currItem = selItem;
await JSRuntime.InvokeAsync<object>("open", $"itemDetails?ItemID={selItem}", "_blank");
}
#endregion Private Methods
}
}