COmpletato update company x gestione e selezione
This commit is contained in:
@@ -146,6 +146,6 @@
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
basketList = await BBMService.BasketsGetAsync("");
|
||||
negotiationList = await BBMService.NegotiationsGetAsync("");
|
||||
negotiationList = await BBMService.NegotiationsGetAllAsync();
|
||||
}
|
||||
}
|
||||
@@ -146,6 +146,11 @@ namespace SHERPA.BBM.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
public Task<List<DatabaseModels.CompanyModel>> CompanyGetAll()
|
||||
{
|
||||
return Task.FromResult(dbController.CompanyGetAll());
|
||||
}
|
||||
|
||||
public Task<List<DatabaseModels.FluxCountersModel>> CounterGetAll()
|
||||
{
|
||||
return Task.FromResult(dbController.CountersGetAll());
|
||||
@@ -325,10 +330,14 @@ namespace SHERPA.BBM.UI.Data
|
||||
return Task.FromResult(dbController.NegotGetByKey(NegotId));
|
||||
}
|
||||
|
||||
// da rivedere...
|
||||
public Task<List<DatabaseModels.NegotiationsModel>> NegotiationsGetAsync(string searchVal)
|
||||
public Task<List<DatabaseModels.NegotiationsModel>> NegotiationsGetAllAsync()
|
||||
{
|
||||
return Task.FromResult(dbController.NegotGetLastDesc(searchVal));
|
||||
return Task.FromResult(dbController.NegotGetAllDesc());
|
||||
}
|
||||
|
||||
public Task<List<DatabaseModels.NegotiationsModel>> NegotiationsGetAsync(int CompanyId, string searchVal)
|
||||
{
|
||||
return Task.FromResult(dbController.NegotGetLastDesc(CompanyId, searchVal));
|
||||
}
|
||||
|
||||
public void NegotiationUpdate(DatabaseModels.NegotiationsModel currItem)
|
||||
|
||||
@@ -19,6 +19,11 @@ namespace SHERPA.BBM.UI.Data
|
||||
/// </summary>
|
||||
public string Company { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Company selezionata
|
||||
/// </summary>
|
||||
public int CompanyId { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Doc selezionato
|
||||
/// </summary>
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
basketList = await BBMService.BasketsGetAsync(MessageService.SearchVal);
|
||||
negotiationList = await BBMService.NegotiationsGetAsync(MessageService.SearchVal);
|
||||
negotiationList = await BBMService.NegotiationsGetAllAsync();
|
||||
await updateTable();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,10 @@
|
||||
</div>
|
||||
<div class="col-6 col-lg-2">
|
||||
|
||||
<select @bind="@SelCompany" class="form-control form-control">
|
||||
<option value="">--- Tutti ---</option>
|
||||
<select @bind="@SelCompanyId" class="form-control form-control">
|
||||
@foreach (var item in CompanyList)
|
||||
{
|
||||
<option value="@item.Key">@item.Value</option>
|
||||
<option value="@item.CompanyId">@item.Descript</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private Dictionary<string, string> CompanyList = new Dictionary<string, string>();
|
||||
private List<DatabaseModels.CompanyModel> CompanyList;
|
||||
private DatabaseModels.NegotiationsModel currItem = null;
|
||||
private List<DatabaseModels.NegotiationsModel> ListRecords;
|
||||
private List<DatabaseModels.NegotiationsModel> SearchRecords;
|
||||
@@ -42,15 +42,21 @@ namespace SHERPA.BBM.UI.Pages
|
||||
/// <summary>
|
||||
/// Company selezionata
|
||||
/// </summary>
|
||||
private string SelCompany
|
||||
private int SelCompanyId
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectData.Company;
|
||||
return SelectData.CompanyId;
|
||||
}
|
||||
set
|
||||
{
|
||||
SelectData.Company = value;
|
||||
SelectData.CompanyId = value;
|
||||
// salvo codice company...
|
||||
var currComp = CompanyList.Where(x => x.CompanyId == value).FirstOrDefault();
|
||||
if (currComp != null)
|
||||
{
|
||||
SelectData.Company = currComp.CodCompany;
|
||||
}
|
||||
// condiziono visualizzazione...
|
||||
var pUpd = Task.Run(async () => await ReloadAllData());
|
||||
pUpd.Wait();
|
||||
@@ -85,7 +91,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = string.IsNullOrEmpty(SelCompany) ? true : false;
|
||||
bool answ = SelCompanyId <= 1 ? true : false;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
@@ -138,11 +144,6 @@ namespace SHERPA.BBM.UI.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// inizializzo cablate le company...
|
||||
CompanyList.Add("EGW", "EgalWare");
|
||||
CompanyList.Add("EGT", "EgalTech");
|
||||
CompanyList.Add("STW", "SteamWare");
|
||||
|
||||
MessageService.ShowSearch = true;
|
||||
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
@@ -151,9 +152,8 @@ namespace SHERPA.BBM.UI.Pages
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
SearchRecords = await BBMService.NegotiationsGetAsync(MessageService.SearchVal);
|
||||
SearchRecords = SearchRecords.Where(x => x.CodNegotiation.StartsWith(SelCompany)).ToList();
|
||||
|
||||
CompanyList = await BBMService.CompanyGetAll();
|
||||
SearchRecords = await BBMService.NegotiationsGetAsync(SelCompanyId, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
basketList = await BBMService.BasketsGetAsync("");
|
||||
negotiationList = await BBMService.NegotiationsGetAsync("");
|
||||
negotiationList = await BBMService.NegotiationsGetAllAsync();
|
||||
updateTable();
|
||||
}
|
||||
|
||||
|
||||
@@ -285,6 +285,23 @@ namespace SHERPA.BBM.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Company
|
||||
/// </summary>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.CompanyModel> CompanyGetAll()
|
||||
{
|
||||
List<DatabaseModels.CompanyModel> dbResult = new List<DatabaseModels.CompanyModel>();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetCompanies
|
||||
.OrderBy(x => x.CompanyId)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public string CounterGetNext(string CodCounter, int numZeros)
|
||||
{
|
||||
string answ = $"{CodCounter}.0000";
|
||||
@@ -812,6 +829,24 @@ namespace SHERPA.BBM.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco TUTTE Negoziazioni
|
||||
/// </summary>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.NegotiationsModel> NegotGetAllDesc()
|
||||
{
|
||||
List<DatabaseModels.NegotiationsModel> dbResult = new List<DatabaseModels.NegotiationsModel>();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetNegotiations
|
||||
.OrderByDescending(x => x.CodNegotiation)
|
||||
.OrderByDescending(x => x.DataIns)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Negoziazione dato codice
|
||||
/// </summary>
|
||||
@@ -832,13 +867,13 @@ namespace SHERPA.BBM.Controllers
|
||||
/// </summary>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.NegotiationsModel> NegotGetLastDesc(string searchVal)
|
||||
public List<DatabaseModels.NegotiationsModel> NegotGetLastDesc(int CompanyId, string searchVal)
|
||||
{
|
||||
List<DatabaseModels.NegotiationsModel> dbResult = new List<DatabaseModels.NegotiationsModel>();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetNegotiations
|
||||
.Where(x => (x.NegotiationId > 1) && (string.IsNullOrEmpty(searchVal) || x.CodNegotiation.Contains(searchVal) || x.Customer.RagSoc.Contains(searchVal) || x.BasePath.Contains(searchVal)))
|
||||
.Where(x => (x.NegotiationId > 1) && (x.CompanyId == CompanyId || CompanyId == 1) && (string.IsNullOrEmpty(searchVal) || x.CodNegotiation.Contains(searchVal) || x.Customer.RagSoc.Contains(searchVal) || x.BasePath.Contains(searchVal)))
|
||||
.OrderByDescending(x => x.CodNegotiation)
|
||||
.OrderByDescending(x => x.DataIns)
|
||||
.ToList();
|
||||
|
||||
Reference in New Issue
Block a user