Small fixes and additions in Helpers

This commit is contained in:
2023-08-02 22:19:25 +02:00
parent 921871cab1
commit a984c4f16c
3 changed files with 10 additions and 3 deletions

View File

@ -123,11 +123,17 @@ namespace Elwig.Helpers {
}
public async Task<int> NextDId(int year) {
return await Deliveries.Where(d => d.Year == year).Select(d => d.DId).MaxAsync() + 1;
int c = 0;
(await Deliveries.Where(d => d.Year == year).Select(d => d.DId).ToListAsync())
.ForEach(a => { if (a <= c + 10) c = a; });
return c + 1;
}
public async Task<int> NextDPNr(int year, int did) {
return await DeliveryParts.Where(p => p.Year == year && p.DId == did).Select(d => d.DPNr).MaxAsync() + 1;
int c = 0;
(await DeliveryParts.Where(p => p.Year == year && p.DId == did).Select(d => d.DPNr).ToListAsync())
.ForEach(a => { if (a <= c + 10) c = a; });
return c + 1;
}
public async Task<WineQualLevel> GetWineQualityLevel(double kmw) {