Fix filtraggio x anno delle negoziazioni
This commit is contained in:
@@ -1048,7 +1048,7 @@ namespace SHERPA.BBM.CORE.Controllers
|
||||
/// </summary>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DbModels.NegotiationsModel> NegotGetLastDesc(int CompanyId, int CustomerId, int BasketId, string searchVal)
|
||||
public List<DbModels.NegotiationsModel> NegotGetLastDesc(int anno, int companyId, int customerId, int basketId, string searchVal)
|
||||
{
|
||||
List<DbModels.NegotiationsModel> dbResult = new List<DbModels.NegotiationsModel>();
|
||||
using (SHERPABBMContext dbCtx = new SHERPABBMContext(_configuration))
|
||||
@@ -1056,7 +1056,7 @@ namespace SHERPA.BBM.CORE.Controllers
|
||||
dbResult = dbCtx
|
||||
.DbSetNegotiations
|
||||
// || x.Basket.Company.RagSoc.Contains(searchVal)
|
||||
.Where(x => (x.Basket.CompanyId == CompanyId || CompanyId == 1) && (x.CustomerId == CustomerId || CustomerId == 1) && (x.BasketId == BasketId || BasketId == 1) && (x.NegotiationId > 1) && (string.IsNullOrEmpty(searchVal) || x.CodNegotiation.Contains(searchVal) || x.BasePath.Contains(searchVal)))
|
||||
.Where(x => (x.Anno == anno || anno == 0) && (x.Basket.CompanyId == companyId || companyId == 1) && (x.CustomerId == customerId || customerId == 1) && (x.BasketId == basketId || basketId == 1) && (x.NegotiationId > 1) && (string.IsNullOrEmpty(searchVal) || x.CodNegotiation.Contains(searchVal) || x.BasePath.Contains(searchVal)))
|
||||
.Include(n => n.Basket)
|
||||
.Include(n => n.DocsNav)
|
||||
.ThenInclude(d => d.FattNav)
|
||||
@@ -1124,6 +1124,21 @@ namespace SHERPA.BBM.CORE.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
|
||||
public List<int> NegotYears()
|
||||
{
|
||||
List<int> dbResult = new List<int>();
|
||||
using (SHERPABBMContext dbCtx = new SHERPABBMContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetNegotiations
|
||||
.Select(x => x.Anno)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge un nuova Resource
|
||||
/// </summary>
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace SHERPA.BBM.UI.Components
|
||||
{
|
||||
customersList = await BBMService.CustomersGetAll("");
|
||||
basketList = await BBMService.BasketsGetAsync(1, "");
|
||||
negotiationList = await BBMService.NegotiationsGetAsync(1, SelCustomerId, SelBasketId, "");
|
||||
negotiationList = await BBMService.NegotiationsGetAsync(0, 1, SelCustomerId, SelBasketId, "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace SHERPA.BBM.UI.Data
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine($"DbController OK");
|
||||
sb.AppendLine($"CST: {dbController.CustomersCount()} | CNT: {dbController.CountersCount()} | BSK: {dbController.BasketsCount()} | NGT: {dbController.NegotiationsCount()} | DOC: {dbController.DocsCount()} | ITM: {dbController.ItemsCount()} | RES: {dbController.ResourcesCount()}");
|
||||
_logger.LogInformation(sb.ToString());
|
||||
_logger.LogInformation(sb.ToString());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -57,30 +57,6 @@ namespace SHERPA.BBM.UI.Data
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// effettua reset del controller (nuova istanza)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool resetController()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
dbController = new CORE.Controllers.BBMController(connStringBBM, connStringFatt);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
public void BasketsAdd(CORE.DbModels.BasketsModel newItem)
|
||||
{
|
||||
try
|
||||
@@ -92,38 +68,6 @@ namespace SHERPA.BBM.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco annualità valide x documenti caricati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<int>> DocsYears()
|
||||
{
|
||||
return Task.FromResult(dbController.DocsYears());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tags
|
||||
/// </summary>
|
||||
/// <param name="CompanyId"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public Task<List<CORE.DbModels.TagModel>> TagsGetAll(TagType selType)
|
||||
{
|
||||
return Task.FromResult(dbController.TagsGetAll(selType));
|
||||
}
|
||||
|
||||
public void TagDelete(CORE.DbModels.TagModel currRecord)
|
||||
{
|
||||
dbController.TagDelete(currRecord.TagId);
|
||||
}
|
||||
|
||||
public void TagUpdate(CORE.DbModels.TagModel currRecord)
|
||||
{
|
||||
dbController.TagUpdate(currRecord);
|
||||
}
|
||||
|
||||
|
||||
public void BasketsDelete(CORE.DbModels.BasketsModel currItem)
|
||||
{
|
||||
try
|
||||
@@ -135,35 +79,6 @@ namespace SHERPA.BBM.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tags dato item
|
||||
/// </summary>
|
||||
/// <param name="CompanyId"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public Task<List<CORE.DbModels.TagItemModel>> TagItemGetByItem(int itemId)
|
||||
{
|
||||
return Task.FromResult(dbController.TagItemGetByItem(itemId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upsert Tag2Item
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public void TagItemUpdate(CORE.DbModels.TagItemModel currRecord)
|
||||
{
|
||||
dbController.TagItemUpdate(currRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Tag2Item
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public void TagItemDelete(CORE.DbModels.TagItemModel currRecord)
|
||||
{
|
||||
dbController.TagItemDelete(currRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi Baskets
|
||||
/// </summary>
|
||||
@@ -270,6 +185,30 @@ namespace SHERPA.BBM.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// effettua reset del controller (nuova istanza)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool resetController()
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
dbController = new CORE.Controllers.BBMController(connStringBBM, connStringFatt);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
public Task<CORE.DbModels.DocsModel> DocGetByKeyAsync(int DocId)
|
||||
{
|
||||
return Task.FromResult(dbController.DocGetByKey(DocId));
|
||||
@@ -314,7 +253,6 @@ namespace SHERPA.BBM.UI.Data
|
||||
return Task.FromResult(dbController.DocGetLastDesc(anno, basketId, negotiationId, showAll));
|
||||
}
|
||||
|
||||
|
||||
public Task<bool> DocsMoveNegot(int DocId, int NegotiationId)
|
||||
{
|
||||
return Task.FromResult(dbController.DocsMoveNegot(DocId, NegotiationId));
|
||||
@@ -325,6 +263,15 @@ namespace SHERPA.BBM.UI.Data
|
||||
dbController.DocUpdate(currItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco annualità valide x documenti caricati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<int>> DocsYears()
|
||||
{
|
||||
return Task.FromResult(dbController.DocsYears());
|
||||
}
|
||||
|
||||
public void ItemAdd(CORE.DbModels.ItemsModel newItem)
|
||||
{
|
||||
try
|
||||
@@ -411,9 +358,9 @@ namespace SHERPA.BBM.UI.Data
|
||||
return Task.FromResult(dbController.NegotGetAllDesc());
|
||||
}
|
||||
|
||||
public Task<List<CORE.DbModels.NegotiationsModel>> NegotiationsGetAsync(int CompanyId, int CustomerId, int BasketId, string searchVal)
|
||||
public Task<List<CORE.DbModels.NegotiationsModel>> NegotiationsGetAsync(int anno, int companyId, int customerId, int basketId, string searchVal)
|
||||
{
|
||||
return Task.FromResult(dbController.NegotGetLastDesc(CompanyId, CustomerId, BasketId, searchVal));
|
||||
return Task.FromResult(dbController.NegotGetLastDesc(anno, companyId, customerId, basketId, searchVal));
|
||||
}
|
||||
|
||||
public void NegotiationUpdate(CORE.DbModels.NegotiationsModel currItem)
|
||||
@@ -427,6 +374,15 @@ namespace SHERPA.BBM.UI.Data
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco annualità valide x negoziazioni
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<int>> NegotYears()
|
||||
{
|
||||
return Task.FromResult(dbController.NegotYears());
|
||||
}
|
||||
|
||||
public void ResourceAdd(CORE.DbModels.ResourcesModel newItem)
|
||||
{
|
||||
try
|
||||
@@ -469,7 +425,7 @@ namespace SHERPA.BBM.UI.Data
|
||||
|
||||
public Task<List<CORE.DbModels.ResourcesModel>> ResourcesGetAsync(int anno, int baskId, int negoId, int docId, BbmResType resType)
|
||||
{
|
||||
//baskId, negoId,
|
||||
//baskId, negoId,
|
||||
return Task.FromResult(dbController.ResourceGetLastDesc(anno, baskId, negoId, docId, resType));
|
||||
}
|
||||
|
||||
@@ -530,6 +486,56 @@ namespace SHERPA.BBM.UI.Data
|
||||
return Task.FromResult(dbController.SumTotTrattato(anno));
|
||||
}
|
||||
|
||||
public void TagDelete(CORE.DbModels.TagModel currRecord)
|
||||
{
|
||||
dbController.TagDelete(currRecord.TagId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Tag2Item
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public void TagItemDelete(CORE.DbModels.TagItemModel currRecord)
|
||||
{
|
||||
dbController.TagItemDelete(currRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tags dato item
|
||||
/// </summary>
|
||||
/// <param name="CompanyId"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public Task<List<CORE.DbModels.TagItemModel>> TagItemGetByItem(int itemId)
|
||||
{
|
||||
return Task.FromResult(dbController.TagItemGetByItem(itemId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upsert Tag2Item
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public void TagItemUpdate(CORE.DbModels.TagItemModel currRecord)
|
||||
{
|
||||
dbController.TagItemUpdate(currRecord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tags
|
||||
/// </summary>
|
||||
/// <param name="CompanyId"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public Task<List<CORE.DbModels.TagModel>> TagsGetAll(TagType selType)
|
||||
{
|
||||
return Task.FromResult(dbController.TagsGetAll(selType));
|
||||
}
|
||||
|
||||
public void TagUpdate(CORE.DbModels.TagModel currRecord)
|
||||
{
|
||||
dbController.TagUpdate(currRecord);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -237,7 +237,7 @@
|
||||
{
|
||||
customersList = await BBMService.CustomersGetAll("");
|
||||
basketListSx = await BBMService.BasketsGetAsync(1, "");
|
||||
negotiationListSx = await BBMService.NegotiationsGetAsync(1, SelCustomerIdSx, SelBasketIdSx, "");
|
||||
negotiationListSx = await BBMService.NegotiationsGetAsync(yearSel, 1, SelCustomerIdSx, SelBasketIdSx, "");
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
{
|
||||
customersList = await BBMService.CustomersGetAll("");
|
||||
basketListDx = await BBMService.BasketsGetAsync(1, "");
|
||||
negotiationListDx = await BBMService.NegotiationsGetAsync(1, SelCustomerIdDx, SelBasketIdDx, "");
|
||||
negotiationListDx = await BBMService.NegotiationsGetAsync(yearSel, 1, SelCustomerIdDx, SelBasketIdDx, "");
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<span class="oi oi-basket" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelBasketId" class="form-control form-control">
|
||||
<select @bind="@selBasketId" class="form-control form-control">
|
||||
<option value="1">-- Tutti ---</option>
|
||||
@foreach (var item in BasketList)
|
||||
{
|
||||
@@ -36,7 +36,7 @@
|
||||
<span class="fas fa-users" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelCustomerId" class="form-control form-control">
|
||||
<select @bind="@selCustomerId" class="form-control form-control">
|
||||
@foreach (var item in CustomersList)
|
||||
{
|
||||
<option value="@item.CustomerId">@item.RagSoc</option>
|
||||
@@ -51,7 +51,7 @@
|
||||
<span class="oi oi-location" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@SelCompanyId" class="form-control form-control">
|
||||
<select @bind="@selCompanyId" class="form-control form-control">
|
||||
@foreach (var item in CompanyList)
|
||||
{
|
||||
<option value="@item.CompanyId">@item.Descript</option>
|
||||
@@ -59,6 +59,22 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="oi oi-calendar" aria-hidden="true"></span>
|
||||
</span>
|
||||
</div>
|
||||
<select @bind="@yearSel" class="form-control form-control-sm">
|
||||
<option value="0">--- Tutti ---</option>
|
||||
@foreach (var item in yearsList)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private List<int> yearsList;
|
||||
private List<CORE.DbModels.BasketsModel> BasketList;
|
||||
private List<CORE.DbModels.CompanyModel> CompanyList;
|
||||
private CORE.DbModels.NegotiationsModel currItem = null;
|
||||
@@ -45,10 +46,24 @@ namespace SHERPA.BBM.UI.Pages
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
private int yearSel
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectData.YearSel;
|
||||
}
|
||||
set
|
||||
{
|
||||
SelectData.YearSel = value;
|
||||
ReloadAllData().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basket selezionato
|
||||
/// </summary>
|
||||
private int SelBasketId
|
||||
|
||||
private int selBasketId
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -57,16 +72,14 @@ namespace SHERPA.BBM.UI.Pages
|
||||
set
|
||||
{
|
||||
SelectData.BasketId = value;
|
||||
// condiziono visualizzazione...
|
||||
var pUpd = Task.Run(async () => await ReloadAllData());
|
||||
pUpd.Wait();
|
||||
ReloadAllData().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Company selezionata
|
||||
/// </summary>
|
||||
private int SelCompanyId
|
||||
private int selCompanyId
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -90,7 +103,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
/// <summary>
|
||||
/// Customer selezionato
|
||||
/// </summary>
|
||||
private int SelCustomerId
|
||||
private int selCustomerId
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -139,7 +152,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = (SelBasketId <= 1 || SelCustomerId <= 1 || SelCompanyId <= 1) ? true : false;
|
||||
bool answ = (selBasketId <= 1 || selCustomerId <= 1 || selCompanyId <= 1) ? true : false;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
@@ -167,8 +180,8 @@ namespace SHERPA.BBM.UI.Pages
|
||||
{
|
||||
CodNegotiation = newCode,
|
||||
DataIns = DateTime.Now,
|
||||
BasketId = SelBasketId,
|
||||
CustomerId = SelCustomerId,
|
||||
BasketId = selBasketId,
|
||||
CustomerId = selCustomerId,
|
||||
Descript = "Nuova Negoziazione",
|
||||
BasePath = "",
|
||||
//Refer = ""
|
||||
@@ -191,7 +204,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
return;
|
||||
|
||||
// seleziono Basket...
|
||||
SelBasketId = currRecord.BasketId;
|
||||
selBasketId=currRecord.BasketId;
|
||||
|
||||
// recupero counter
|
||||
string newCode = BBMService.CounterGetNext($"{SelectData.Company}.N.{DateTime.Today.Year}", 6);
|
||||
@@ -201,7 +214,7 @@ namespace SHERPA.BBM.UI.Pages
|
||||
DataIns = DateTime.Now,
|
||||
Descript = "COPIA di " + currRecord.Descript,
|
||||
BasePath = currRecord.BasePath,
|
||||
BasketId = SelBasketId
|
||||
BasketId = selBasketId
|
||||
};
|
||||
currItem = newRecord;
|
||||
}
|
||||
@@ -233,10 +246,11 @@ namespace SHERPA.BBM.UI.Pages
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
yearsList = await BBMService.NegotYears();
|
||||
CompanyList = await BBMService.CompanyGetAll();
|
||||
CustomersList = await BBMService.CustomersGetAll("");
|
||||
BasketList = await BBMService.BasketsGetAsync(SelCompanyId, "");
|
||||
SearchRecords = await BBMService.NegotiationsGetAsync(SelCompanyId, SelCustomerId, SelBasketId, MessageService.SearchVal);
|
||||
BasketList = await BBMService.BasketsGetAsync(selCompanyId, "");
|
||||
SearchRecords = await BBMService.NegotiationsGetAsync(yearSel, selCompanyId, selCustomerId, selBasketId, MessageService.SearchVal);
|
||||
// se ho ordinamento riordino...
|
||||
if (!string.IsNullOrEmpty(sortField))
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<UserSecretsId>60fcdaab-6c1e-4bec-9d88-f7727ef1c12c</UserSecretsId>
|
||||
<ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
|
||||
<Version>1.0.2112.0618</Version>
|
||||
<Version>1.0.2112.0709</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user