136 lines
3.5 KiB
C#
136 lines
3.5 KiB
C#
using DnsClient.Protocol;
|
|
using Microsoft.AspNetCore.Components;
|
|
using MP.Core.DTO;
|
|
using MP.Data.DbModels;
|
|
using MP.Data.Services;
|
|
using MP.SPEC.Data;
|
|
|
|
namespace MP.SPEC.Pages
|
|
{
|
|
public partial class GroupMacOprMan
|
|
{
|
|
#region Protected Fields
|
|
|
|
protected List<MacchineModel>? ListMacchine = null;
|
|
protected List<MacchineModel>? ListMacchineAll = null;
|
|
protected List<AnagOperatoriModel>? ListOperatori = null;
|
|
protected List<AnagOperatoriModel>? ListOperatoriAll = null;
|
|
protected List<RepartiDTO>? ListReparti = null;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected MpDataService MDService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
ReloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private string CodGruppo = "";
|
|
|
|
private bool isLoading = false;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private string CssMain
|
|
{
|
|
get => ShowDetail ? "col-3" : "col-12";
|
|
}
|
|
|
|
private bool ShowDetail
|
|
{
|
|
get => !string.IsNullOrEmpty(CodGruppo);
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void ForceReload(bool doForce)
|
|
{
|
|
if (doForce)
|
|
{
|
|
CodGruppo = "";
|
|
}
|
|
ReloadData();
|
|
}
|
|
|
|
private void ReloadData()
|
|
{
|
|
isLoading = true;
|
|
ListMacchine?.Clear();
|
|
ListMacchineAll = MDService.MacchineGetFilt("*");
|
|
ListOperatoriAll= MDService.OperatoriGetFilt("*").Where(x => x.isEnabled).ToList();
|
|
var rawList = MDService.ElencoRepartiDTO();
|
|
if(string.IsNullOrEmpty(SearchVal))
|
|
{
|
|
ListReparti = rawList;
|
|
}
|
|
else
|
|
{
|
|
ListReparti = rawList.Where(x => x.CodGruppo.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || x.DescrGruppo.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
|
}
|
|
if (!string.IsNullOrEmpty(CodGruppo))
|
|
{
|
|
ReloadDetail();
|
|
}
|
|
isLoading = false;
|
|
}
|
|
|
|
private void ReloadDetail()
|
|
{
|
|
if (!string.IsNullOrEmpty(CodGruppo))
|
|
{
|
|
ListMacchine = MDService.MacchineGetFilt(CodGruppo);
|
|
ListOperatori = MDService.OperatoriGetFilt(CodGruppo).Where(x => x.isEnabled).ToList();
|
|
}
|
|
}
|
|
|
|
private void SetCodGruppo(string CodGruppoSel)
|
|
{
|
|
isLoading = true;
|
|
CodGruppo = CodGruppoSel;
|
|
ReloadDetail();
|
|
isLoading = false;
|
|
}
|
|
|
|
private string btnSearchCss
|
|
{
|
|
get => string.IsNullOrWhiteSpace(SearchVal) ? "btn-secondary" : "btn-primary";
|
|
}
|
|
|
|
private void ResetSearch()
|
|
{
|
|
SearchVal = "";
|
|
}
|
|
|
|
protected string SearchVal
|
|
{
|
|
get => searchVal;
|
|
set
|
|
{
|
|
if (searchVal != value)
|
|
{
|
|
searchVal = value;
|
|
ReloadData();
|
|
}
|
|
}
|
|
}
|
|
private string searchVal = "";
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |