AdministrationWindow: Fix default value change check

This commit is contained in:
2023-09-01 12:57:09 +02:00
parent effc9f9230
commit 56a0eb794e
3 changed files with 8 additions and 8 deletions

View File

@ -119,7 +119,7 @@ namespace Elwig.Helpers {
public async Task<int> NextMgNr() { public async Task<int> NextMgNr() {
int c = await Members.Select(m => m.MgNr).MinAsync(); int c = await Members.Select(m => m.MgNr).MinAsync();
(await Members.OrderBy(m => m.MgNr).Select(m => m.MgNr).ToListAsync()) (await Members.OrderBy(m => m.MgNr).Select(m => m.MgNr).ToListAsync())
.ForEach(a => { if (a <= c + 100) c = a; }); .ForEach(a => { if (a <= c + 1000) c = a; });
return c + 1; return c + 1;
} }
@ -134,21 +134,21 @@ namespace Elwig.Helpers {
var dateStr = date.ToString("yyyy-MM-dd"); var dateStr = date.ToString("yyyy-MM-dd");
int c = 0; int c = 0;
(await Deliveries.Where(d => d.DateString == dateStr).Select(d => d.LNr).ToListAsync()) (await Deliveries.Where(d => d.DateString == dateStr).Select(d => d.LNr).ToListAsync())
.ForEach(a => { if (a <= c + 10) c = a; }); .ForEach(a => { if (a <= c + 100) c = a; });
return c + 1; return c + 1;
} }
public async Task<int> NextDId(int year) { public async Task<int> NextDId(int year) {
int c = 0; int c = 0;
(await Deliveries.Where(d => d.Year == year).Select(d => d.DId).ToListAsync()) (await Deliveries.Where(d => d.Year == year).Select(d => d.DId).ToListAsync())
.ForEach(a => { if (a <= c + 10) c = a; }); .ForEach(a => { if (a <= c + 100) c = a; });
return c + 1; return c + 1;
} }
public async Task<int> NextDPNr(int year, int did) { public async Task<int> NextDPNr(int year, int did) {
int c = 0; int c = 0;
(await DeliveryParts.Where(p => p.Year == year && p.DId == did).Select(d => d.DPNr).ToListAsync()) (await DeliveryParts.Where(p => p.Year == year && p.DId == did).Select(d => d.DPNr).ToListAsync())
.ForEach(a => { if (a <= c + 10) c = a; }); .ForEach(a => { if (a <= c + 100) c = a; });
return c + 1; return c + 1;
} }

View File

@ -212,9 +212,9 @@ namespace Elwig.Helpers {
} else if (input is Xceed.Wpf.Toolkit.CheckComboBox ccb) { } else if (input is Xceed.Wpf.Toolkit.CheckComboBox ccb) {
return ccb.SelectedItems.Cast<object>().ToArray(); return ccb.SelectedItems.Cast<object>().ToArray();
} else if (input is CheckBox cb) { } else if (input is CheckBox cb) {
return cb.IsChecked; return (cb.IsChecked != null ? (cb.IsChecked == true ? bool.TrueString : bool.FalseString) : null);
} else if (input is RadioButton rb) { } else if (input is RadioButton rb) {
return rb.IsChecked; return (rb.IsChecked != null ? (rb.IsChecked == true ? bool.TrueString : bool.FalseString) : null);
} else { } else {
return null; return null;
} }

View File

@ -279,9 +279,9 @@ namespace Elwig.Windows {
} else if (input is CheckComboBox ccb) { } else if (input is CheckComboBox ccb) {
return !ccb.SelectedItems.Cast<object>().ToArray().SequenceEqual(((object[]?)DefaultValues[ccb]) ?? Array.Empty<object>()); return !ccb.SelectedItems.Cast<object>().ToArray().SequenceEqual(((object[]?)DefaultValues[ccb]) ?? Array.Empty<object>());
} else if (input is CheckBox cb) { } else if (input is CheckBox cb) {
return DefaultValues[cb] != (object?)cb.IsChecked; return (string?)DefaultValues[cb] != (cb.IsChecked != null ? (cb.IsChecked == true ? bool.TrueString : bool.FalseString) : null);
} else if (input is RadioButton rb) { } else if (input is RadioButton rb) {
return DefaultValues[rb] != (object?)rb.IsChecked; return (string?)DefaultValues[rb] != (rb.IsChecked != null ? (rb.IsChecked == true ? bool.TrueString : bool.FalseString) : null);
} else { } else {
return false; return false;
} }