[#14] Windows: Add DeliveryScheduleAdminWindow
All checks were successful
Test / Run tests (push) Successful in 2m58s
All checks were successful
Test / Run tests (push) Successful in 2m58s
This commit is contained in:
@ -239,6 +239,13 @@ namespace Elwig.Helpers {
|
||||
return c + 1;
|
||||
}
|
||||
|
||||
public async Task<int> NextDsNr(int year) {
|
||||
int c = 0;
|
||||
(await DeliverySchedules.Where(s => s.Year == year).Select(s => s.DsNr).ToListAsync())
|
||||
.ForEach(a => { if (a <= c + 100) c = a; });
|
||||
return c + 1;
|
||||
}
|
||||
|
||||
public async Task<WineQualLevel> GetWineQualityLevel(double kmw) {
|
||||
return await WineQualityLevels
|
||||
.Where(q => !q.IsPredicate && (q.MinKmw == null || q.MinKmw <= kmw))
|
||||
@ -269,6 +276,31 @@ namespace Elwig.Helpers {
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateDeliveryScheduleWineVarieties(DeliverySchedule schedule, IEnumerable<(WineVar, int)> oldVarieties, IEnumerable<(WineVar, int)> newVarieties) {
|
||||
foreach (var v in WineVarieties) {
|
||||
var e = new DeliveryScheduleWineVar {
|
||||
Year = schedule.Year,
|
||||
DsNr = schedule.DsNr,
|
||||
SortId = v.SortId,
|
||||
Priority = 1,
|
||||
};
|
||||
var o = oldVarieties.Where(x => x.Item1.SortId == e.SortId).Select(x => x.Item2).FirstOrDefault(-1);
|
||||
var n = newVarieties.Where(x => x.Item1.SortId == e.SortId).Select(x => x.Item2).FirstOrDefault(-1);
|
||||
if (n != -1) {
|
||||
e.Priority = n;
|
||||
if (o == -1) {
|
||||
Add(e);
|
||||
} else {
|
||||
Update(e);
|
||||
}
|
||||
} else {
|
||||
if (o != -1) {
|
||||
Remove(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task FetchMemberAreaCommitmentBuckets(int year, SqliteConnection? cnx = null) {
|
||||
var ownCnx = cnx == null;
|
||||
cnx ??= await ConnectAsync();
|
||||
|
Reference in New Issue
Block a user