b83731097b
+ fix modifica posizioni
138 lines
3.8 KiB
C#
138 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System.Net.Http;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
using Microsoft.AspNetCore.Components.Routing;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
|
using Microsoft.JSInterop;
|
|
using EgwCoreLib.Razor;
|
|
using EgwCoreLib.Razor.Data;
|
|
using StockMan.CORE;
|
|
using StockMan.CORE.Data;
|
|
using StockMan.CORE.Shared;
|
|
using StockMan.Data.DbModels;
|
|
using StockMan.Data;
|
|
|
|
namespace StockMan.CORE.Components
|
|
{
|
|
public partial class ListPosizioni
|
|
{
|
|
#region Public Properties
|
|
[Parameter]
|
|
public PosizioniSelectFilter actFilter { get; set; } = new PosizioniSelectFilter();
|
|
[Parameter]
|
|
public EventCallback<int> updateRecordCount { get; set; }
|
|
public LocationModel? currLoc { get; set; } = null;
|
|
public bool isLoading { get; set; } = false;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Fields
|
|
|
|
protected string _descr = "";
|
|
protected string _ID = "";
|
|
protected string _loctype = "";
|
|
protected List<LocationModel>? listLocAll = null;
|
|
protected List<LocationModel>? searchRecord = null;
|
|
protected List<LocTypeModel>? listLocTypes = null;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected string descr
|
|
{
|
|
get => _descr;
|
|
set { _descr = value; }
|
|
}
|
|
|
|
protected string ID
|
|
{
|
|
get => _ID;
|
|
set { _ID = value; }
|
|
}
|
|
|
|
protected string loctype
|
|
{
|
|
get => _loctype;
|
|
set { _loctype = value; }
|
|
}
|
|
|
|
[Inject]
|
|
protected NavigationManager NavManager { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected StockDataService SDService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
private int _totalCount { get; set; } = 0;
|
|
private int currPage
|
|
{
|
|
get => actFilter.CurrPage;
|
|
set => actFilter.CurrPage = value;
|
|
}
|
|
|
|
private int numRecord
|
|
{
|
|
get => actFilter.NumRec;
|
|
set => actFilter.NumRec = value;
|
|
}
|
|
|
|
private int totalCount
|
|
{
|
|
get => _totalCount;
|
|
set
|
|
{
|
|
if (_totalCount != value)
|
|
{
|
|
_totalCount = value;
|
|
updateRecordCount.InvokeAsync(value);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected async Task ModLoc()
|
|
{
|
|
LocationModel currRecToMod = new LocationModel()
|
|
{
|
|
Id = ID,
|
|
Descr = descr,
|
|
LocTypeId = loctype
|
|
};
|
|
var done = await SDService.LocationMod(currRecToMod);
|
|
if (done)
|
|
{
|
|
NavManager.NavigateTo(NavManager.Uri, true);
|
|
}
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
isLoading = true;
|
|
listLocTypes = await SDService.LocTypeGetAll();
|
|
searchRecord = await SDService.LocationGetAll();
|
|
totalCount = searchRecord.Count;
|
|
listLocAll = searchRecord.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
|
isLoading = false;
|
|
}
|
|
|
|
protected async Task setCurrLoc(LocationModel currRecToMod)
|
|
{
|
|
await Task.Delay(1);
|
|
|
|
ID = currRecToMod.Id;
|
|
descr = currRecToMod.Descr;
|
|
loctype = currRecToMod.LocTypeId;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |