AuthUtente x LAND:
- aggiunta DbModels - aggiunta controillers - aggiunta servizio
This commit is contained in:
@@ -11,14 +11,6 @@ namespace MP.AppAuth.Controllers
|
||||
{
|
||||
public class AppAuthController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static AppAuthContext dbCtx;
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public AppAuthController(IConfiguration configuration)
|
||||
@@ -48,6 +40,7 @@ namespace MP.AppAuth.Controllers
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Record x Gruppi
|
||||
/// </summary>
|
||||
@@ -64,28 +57,6 @@ namespace MP.AppAuth.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<AnagraficaOperatori> AnagOpGetAll(string searchVal)
|
||||
{
|
||||
List<AnagraficaOperatori> dbResult = new List<AnagraficaOperatori>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
// ritorno
|
||||
return dbResult;
|
||||
}
|
||||
public List<AnagraficaOperatori> AnagOpByGruppoGetFilt(string codGruppo, string searchVal)
|
||||
{
|
||||
List<AnagraficaOperatori> dbResult = new List<AnagraficaOperatori>();
|
||||
@@ -122,12 +93,106 @@ namespace MP.AppAuth.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<AnagraficaOperatori> AnagOpGetAll(string searchVal)
|
||||
{
|
||||
List<AnagraficaOperatori> dbResult = new List<AnagraficaOperatori>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
// ritorno
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo permessi2funzione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Permessi2FunzioneModel> Permessi2FunzioneGetAll()
|
||||
{
|
||||
List<Permessi2FunzioneModel> dbResult = new List<Permessi2FunzioneModel>();
|
||||
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPermessi2Funzione
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco permessi2funzione filtrato x elenco funzioni
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Permessi2FunzioneModel> Permessi2FunzioneGetFilt(List<string> FunList)
|
||||
{
|
||||
List<Permessi2FunzioneModel> dbResult = new List<Permessi2FunzioneModel>();
|
||||
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPermessi2Funzione
|
||||
.Where(x => FunList.Contains(x.CodFunzione))
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo permessi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<PermessiModel> PermessiGetAll()
|
||||
{
|
||||
List<PermessiModel> dbResult = new List<PermessiModel>();
|
||||
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetPermessi
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco permessi dato elenco funzioni
|
||||
/// </summary>
|
||||
/// <param name="ListCodFun"></param>
|
||||
/// <returns></returns>
|
||||
public List<PermessiModel> PermessiGetByFunc(List<string> ListCodFun)
|
||||
{
|
||||
List<PermessiModel> dbResult = new List<PermessiModel>();
|
||||
using (AppAuthContext dbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
var listPer = PermessiGetAll();
|
||||
var listP2F = Permessi2FunzioneGetFilt(ListCodFun);
|
||||
|
||||
var query = from permesso in listPer
|
||||
join p2f in listP2F on permesso.CodPermesso equals p2f.CodPermesso
|
||||
select permesso;
|
||||
|
||||
dbResult = query.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void ResetController()
|
||||
{
|
||||
dbCtx = new AppAuthContext(_configuration);
|
||||
@@ -190,5 +255,13 @@ namespace MP.AppAuth.Controllers
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static AppAuthContext dbCtx;
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user