Ancora update metodi SPEC
This commit is contained in:
@@ -401,7 +401,44 @@ namespace MP.Data.Controllers
|
||||
.CountAsync();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// Conteggio articoli data condizione ricerca
|
||||
/// </summary>
|
||||
/// <param name="tipoArt"></param>
|
||||
/// <param name="azienda"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> ArticoliCountSearchAsync(string tipoArt = "*", string azienda = "*", string searchVal = "")
|
||||
{
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
IQueryable<AnagArticoliModel> query = dbCtx.DbSetArticoli.AsNoTracking();
|
||||
|
||||
// filtro tipo articolo
|
||||
if (tipoArt != "*")
|
||||
{
|
||||
//query = query.Where(x => x.Tipo.ToLower() == tipoArt.ToLower());
|
||||
query = query.Where(x => EF.Functions.Like(x.Tipo, tipoArt));
|
||||
}
|
||||
// filtro azienda
|
||||
if (azienda != "*")
|
||||
{
|
||||
//query = query.Where(x => x.Azienda.ToLower() == azienda.ToLower());
|
||||
query = query.Where(x => EF.Functions.Like(x.Azienda, azienda));
|
||||
}
|
||||
// filtro ricerca
|
||||
if (!string.IsNullOrWhiteSpace(searchVal))
|
||||
{
|
||||
string pattern = $"%{searchVal}%";
|
||||
query = query.Where(x =>
|
||||
EF.Functions.Like(x.CodArticolo, pattern) ||
|
||||
EF.Functions.Like(x.DescArticolo, pattern) ||
|
||||
EF.Functions.Like(x.Disegno, pattern));
|
||||
}
|
||||
|
||||
return await query
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.CountAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed) Async
|
||||
/// </summary>
|
||||
@@ -499,10 +536,6 @@ namespace MP.Data.Controllers
|
||||
// filtro ricerca
|
||||
if (!string.IsNullOrWhiteSpace(searchVal))
|
||||
{
|
||||
//query = query.Where(x =>
|
||||
// x.CodArticolo.Contains(searchVal) ||
|
||||
// x.DescArticolo.Contains(searchVal) ||
|
||||
// x.Disegno.Contains(searchVal));
|
||||
string pattern = $"%{searchVal}%";
|
||||
query = query.Where(x =>
|
||||
EF.Functions.Like(x.CodArticolo, pattern) ||
|
||||
@@ -651,16 +684,12 @@ namespace MP.Data.Controllers
|
||||
/// <returns></returns>
|
||||
public async Task<List<ConfigModel>> ConfigGetAllAsync()
|
||||
{
|
||||
List<ConfigModel> dbResult = new List<ConfigModel>();
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
{
|
||||
dbResult = await dbCtx
|
||||
.DbSetConfig
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Chiave)
|
||||
.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
return await dbCtx
|
||||
.DbSetConfig
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Chiave)
|
||||
.ToListAsync() ?? new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user