Ancora eliminate letture multiple dati user inutili
This commit is contained in:
@@ -16,15 +16,27 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
|
||||
public EventCallback<int> E_UserCurrCompany { get; set; }
|
||||
|
||||
public EventCallback<string> E_UserRole { get; set; }
|
||||
public EventCallback<string> E_UserId { get; set; }
|
||||
|
||||
public EventCallback<string> E_UserRole { get; set; }
|
||||
public EventCallback<Dictionary<string, Dictionary<string, string>>> E_VocLemmas { get; set; }
|
||||
|
||||
public List<CompanyModel> listCompanies { get; set; } = new List<CompanyModel>();
|
||||
|
||||
public List<string> listRecord { get; set; } = new List<string>();
|
||||
|
||||
public Dictionary<string, Dictionary<string, string>>? listVocLemmas
|
||||
{
|
||||
get
|
||||
{
|
||||
return WDCVService.VocabularyLemmas;
|
||||
}
|
||||
set
|
||||
{
|
||||
WDCVService.VocabularyLemmas = value;
|
||||
reportVocLemmas();
|
||||
}
|
||||
}
|
||||
|
||||
public List<string>? userClaimsList
|
||||
{
|
||||
get
|
||||
@@ -54,19 +66,6 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
}
|
||||
}
|
||||
|
||||
public string userRole
|
||||
{
|
||||
get
|
||||
{
|
||||
return WDCUService.userRole;
|
||||
}
|
||||
set
|
||||
{
|
||||
WDCUService.userRole = value;
|
||||
reportChangeRole();
|
||||
}
|
||||
}
|
||||
|
||||
public string userId
|
||||
{
|
||||
get
|
||||
@@ -79,16 +78,17 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
reportUserId();
|
||||
}
|
||||
}
|
||||
public Dictionary<string, Dictionary<string, string>>? listVocLemmas
|
||||
|
||||
public string userRole
|
||||
{
|
||||
get
|
||||
{
|
||||
return WDCVService.VocabularyLemmas;
|
||||
return WDCUService.userRole;
|
||||
}
|
||||
set
|
||||
{
|
||||
WDCVService.VocabularyLemmas = value;
|
||||
reportVocLemmas();
|
||||
WDCUService.userRole = value;
|
||||
reportChangeRole();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,12 +145,6 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
protected string userLang
|
||||
{
|
||||
get => WDCUService.currLanguage ?? "EN";
|
||||
set => WDCUService.currLanguage = value;
|
||||
}
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -159,15 +153,19 @@ namespace WebDoorCreator.UI.Components.Gen
|
||||
[Inject]
|
||||
protected AuthenticationStateProvider ASProvider { get; set; } = null!;
|
||||
|
||||
#if false
|
||||
protected string currUser { get; set; } = "";
|
||||
#endif
|
||||
protected string userLang
|
||||
{
|
||||
get => WDCUService.currLanguage ?? "EN";
|
||||
set => WDCUService.currLanguage = value;
|
||||
}
|
||||
|
||||
|
||||
[Inject]
|
||||
protected WebDoorCreatorService WDCService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected WDCUserService WDCUService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected WDCVocabularyService WDCVService { get; set; } = null!;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using System.Collections.Specialized;
|
||||
using WebDoorCreator.Data.DbModels;
|
||||
using WebDoorCreator.UI.Data;
|
||||
|
||||
@@ -9,6 +8,18 @@ namespace WebDoorCreator.UI.Pages
|
||||
{
|
||||
public partial class OrderDetails
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string userId
|
||||
{
|
||||
get
|
||||
{
|
||||
return WDCUService.userId;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -33,30 +44,15 @@ namespace WebDoorCreator.UI.Pages
|
||||
protected OrderStatusViewModel? OrderStatus { get; set; } = null;
|
||||
|
||||
[Inject]
|
||||
protected WebDoorCreatorService WDService { get; set; } = null!;
|
||||
protected WDCUserService WDCUService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected WDCUserService WDCUService { get; set; } = null!;
|
||||
protected WebDoorCreatorService WDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOrd", out var _idOrd))
|
||||
{
|
||||
idOrd = int.Parse(_idOrd);
|
||||
}
|
||||
}
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<OrderStatusViewModel>?ListOrdersStatus = null;
|
||||
|
||||
protected async Task createDoor()
|
||||
{
|
||||
// conto le porte x questo ordine e uso x chiamata successiva...
|
||||
@@ -68,9 +64,9 @@ namespace WebDoorCreator.UI.Pages
|
||||
{
|
||||
OrderId = idOrd,
|
||||
MeasureUnit = currMeaUnit,
|
||||
UserIdIns = WDCUService.userId,
|
||||
UserIdMod = WDCUService.userId,
|
||||
UserIdLock = WDCUService.userId,
|
||||
UserIdIns = userId,
|
||||
UserIdMod = userId,
|
||||
UserIdLock = userId,
|
||||
DateIns = adesso,
|
||||
DateMod = adesso,
|
||||
DateLockExpiry = adesso.AddHours(1),
|
||||
@@ -104,6 +100,22 @@ namespace WebDoorCreator.UI.Pages
|
||||
NavManager.NavigateTo($"/DoorDefinition?idOrd={idOrd}&idDoor={doorId}");
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOrd", out var _idOrd))
|
||||
{
|
||||
idOrd = int.Parse(_idOrd);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private List<OrderStatusViewModel>? ListOrdersStatus = null;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -8,36 +8,28 @@ namespace WebDoorCreator.UI.Pages
|
||||
{
|
||||
public partial class OrdersHomePage : IDisposable
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected WebDoorCreatorService WDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected UserManager<IdentityUser> _userManager { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<AspNetUsers> E_currUser { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
public string userId
|
||||
{
|
||||
await Task.Delay(1);
|
||||
WDCUService.EA_UserCurrCompany += OnNewUserCurrComp;
|
||||
get
|
||||
{
|
||||
return WDCUService.userId;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
WDCUService.EA_UserCurrCompany -= OnNewUserCurrComp;
|
||||
}
|
||||
|
||||
public async void OnNewUserCurrComp()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
@@ -47,23 +39,35 @@ namespace WebDoorCreator.UI.Pages
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
protected string _orderCodExt = "";
|
||||
|
||||
protected string orderCodExt
|
||||
{
|
||||
get => _orderCodExt;
|
||||
set => _orderCodExt = value;
|
||||
}
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string _doorExtCode = "";
|
||||
|
||||
protected int _doorQuantity = 0;
|
||||
|
||||
protected string _orderCodExt = "";
|
||||
|
||||
protected string _orderDescr = "";
|
||||
|
||||
protected string orderDescr
|
||||
{
|
||||
get => _orderDescr;
|
||||
set => _orderDescr = value;
|
||||
}
|
||||
#endregion Protected Fields
|
||||
|
||||
protected string _doorExtCode = "";
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected UserManager<IdentityUser> _userManager { get; set; } = null!;
|
||||
|
||||
protected DoorModel? currDoor { get; set; } = null;
|
||||
|
||||
protected int currDoorType { get; set; } = 0;
|
||||
|
||||
protected int currOrderId { get; set; } = 0;
|
||||
|
||||
protected AspNetUsers? currUser { get; set; } = null;
|
||||
|
||||
protected bool doorChange { get; set; } = false;
|
||||
|
||||
protected string doorExtCode
|
||||
{
|
||||
@@ -71,31 +75,53 @@ namespace WebDoorCreator.UI.Pages
|
||||
set => _doorExtCode = value;
|
||||
}
|
||||
|
||||
protected int _doorQuantity = 0;
|
||||
|
||||
protected int doorQuantity
|
||||
{
|
||||
get => _doorQuantity;
|
||||
set => _doorQuantity = value;
|
||||
}
|
||||
|
||||
//private List<CompanyModel>? ListRecords = null;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
protected List<UsersViewModel>? UsersList { get; set; } = null;
|
||||
protected List<AspNetRoles>? RolesList { get; set; } = null;
|
||||
protected List<DoorModel>? DoorsList { get; set; } = null;
|
||||
|
||||
protected AspNetUsers? currUser { get; set; } = null;
|
||||
protected string goToDefPage { get; set; } = "";
|
||||
|
||||
protected bool isModRole { get; set; } = false;
|
||||
protected int currDoorType { get; set; } = 0;
|
||||
protected DoorModel? currDoor { get; set; } = null;
|
||||
protected int currOrderId { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
|
||||
protected string orderCodExt
|
||||
{
|
||||
get => _orderCodExt;
|
||||
set => _orderCodExt = value;
|
||||
}
|
||||
|
||||
protected string orderDescr
|
||||
{
|
||||
get => _orderDescr;
|
||||
set => _orderDescr = value;
|
||||
}
|
||||
|
||||
protected List<AspNetRoles>? RolesList { get; set; } = null;
|
||||
|
||||
protected int userCurrCompany { get; set; }
|
||||
|
||||
protected List<UsersViewModel>? UsersList { get; set; } = null;
|
||||
|
||||
[Inject]
|
||||
protected WDCUserService WDCUService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected WebDoorCreatorService WDService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
//private List<CompanyModel>? ListRecords = null;
|
||||
protected async Task addNewOrder(string userName)
|
||||
{
|
||||
var user = await _userManager.FindByNameAsync(userName);
|
||||
@@ -126,30 +152,11 @@ namespace WebDoorCreator.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task SetCurrDoorType(int doorType)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currDoorType = doorType;
|
||||
}
|
||||
|
||||
protected async Task SetCurrDoor(DoorModel door)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currDoor = door;
|
||||
doorExtCode = currDoor.DoorExtCode;
|
||||
doorQuantity = currDoor.Quantity;
|
||||
}
|
||||
|
||||
protected async Task emptyModal()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
DoorsList = null;
|
||||
currDoor = null;
|
||||
}
|
||||
|
||||
protected async Task addOrModDoor(string userName)
|
||||
{
|
||||
#if false
|
||||
var user = await _userManager.FindByNameAsync(userName);
|
||||
#endif
|
||||
|
||||
DoorModel? addRec = new DoorModel();
|
||||
|
||||
@@ -172,16 +179,6 @@ namespace WebDoorCreator.UI.Pages
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task catchDoorChange(bool isChanged)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
doorChange = isChanged;
|
||||
}
|
||||
|
||||
protected bool doorChange { get; set; } = false;
|
||||
|
||||
protected string goToDefPage { get; set; } = "";
|
||||
|
||||
protected async Task catchCurrOrder(int orderId)
|
||||
{
|
||||
DoorsList = null;
|
||||
@@ -190,14 +187,45 @@ namespace WebDoorCreator.UI.Pages
|
||||
await ReloadData();
|
||||
goToDefPage = $"/DoorDefinition?idOrd={orderId}";
|
||||
}
|
||||
[Inject]
|
||||
protected WDCUserService WDCUService { get; set; } = null!;
|
||||
protected int userCurrCompany { get; set; }
|
||||
|
||||
protected async Task catchDoorChange(bool isChanged)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
doorChange = isChanged;
|
||||
}
|
||||
|
||||
protected async Task emptyModal()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
DoorsList = null;
|
||||
currDoor = null;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
WDCUService.EA_UserCurrCompany += OnNewUserCurrComp;
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
DoorsList = await WDService.DoorGetByOrderId(currOrderId);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
protected async Task SetCurrDoor(DoorModel door)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currDoor = door;
|
||||
doorExtCode = currDoor.DoorExtCode;
|
||||
doorQuantity = currDoor.Quantity;
|
||||
}
|
||||
|
||||
protected async Task SetCurrDoorType(int doorType)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
currDoorType = doorType;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user