diff --git a/Elwig/Windows/DeliveryAdminWindow.xaml.cs b/Elwig/Windows/DeliveryAdminWindow.xaml.cs index 5b727d9..bfd0cd3 100644 --- a/Elwig/Windows/DeliveryAdminWindow.xaml.cs +++ b/Elwig/Windows/DeliveryAdminWindow.xaml.cs @@ -26,7 +26,7 @@ namespace Elwig.Windows { private bool IsUpdatingGradation = false; private Member? Member = null; private readonly DispatcherTimer Timer; - private List TextFilter = new(); + private List TextFilter = []; private readonly RoutedCommand CtrlF = new(); private string? LastScaleError = null; @@ -39,22 +39,22 @@ namespace Elwig.Windows { InitializeComponent(); CtrlF.InputGestures.Add(new KeyGesture(Key.F, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(CtrlF, FocusSearchInput)); - RequiredInputs = new Control[] { + RequiredInputs = [ MgNrInput, MemberInput, LsNrInput, DateInput, BranchInput, SortIdInput, WineVarietyInput, GradationOeInput.TextBox, GradationKmwInput.TextBox, WineQualityLevelInput, WineOriginInput, WineKgInput, WeightInput.TextBox - }; - ExemptInputs = new Control[] { + ]; + ExemptInputs = [ SearchInput, SeasonInput, TodayOnlyInput, AllSeasonsInput, DeliveryList, DeliveryPartList, MemberAddressField, - }; - WeighingButtons = new Button[] { + ]; + WeighingButtons = [ WeighingAButton, WeighingBButton, WeighingCButton, WeighingDButton, - }; + ]; IsReceipt = receipt; Timer = new DispatcherTimer(); @@ -68,7 +68,7 @@ namespace Elwig.Windows { DoShowWarningWindows = false; if (IsReceipt) { - Title = "Übernahme - Elwig"; + Title = $"Übernahme - {App.BranchName} - Elwig"; TodayOnlyInput.IsChecked = true; var n = App.Scales.Count; if (n < 1) WeighingAButton.Visibility = Visibility.Hidden; @@ -297,7 +297,7 @@ namespace Elwig.Windows { } private async Task<(List, IQueryable, IQueryable, List)> GetFilters() { - List filterNames = new(); + List filterNames = []; IQueryable deliveryQuery = Context.Deliveries; if (IsReceipt && App.BranchNum > 1) { deliveryQuery = deliveryQuery.Where(d => d.ZwstId == App.ZwstId); @@ -358,10 +358,10 @@ namespace Elwig.Windows { filterQual.Add(e.ToUpper()); filter.RemoveAt(i--); filterNames.Add(qual[e.ToUpper()].Name); - } else if (e.All(char.IsAsciiDigit) && mgnr.ContainsKey(e)) { + } else if (e.All(char.IsAsciiDigit) && mgnr.TryGetValue(e, out var member)) { filterMgNr.Add(int.Parse(e)); filter.RemoveAt(i--); - filterNames.Add(mgnr[e].AdministrativeName); + filterNames.Add(member.AdministrativeName); } else if (attr.ContainsKey(e.ToLower())) { var a = attr[e.ToLower()]; filterAttr.Add(a.AttrId); @@ -377,7 +377,7 @@ namespace Elwig.Windows { filterZwst.Add(b.ZwstId); filter.RemoveAt(i--); filterNames.Add($"Zweigstelle {b.Name}"); - } else if (e.StartsWith(">") || e.StartsWith("<")) { + } else if (e.StartsWith('>') || e.StartsWith('<')) { if (double.TryParse(e[1..], out var num)) { switch ((e[0], num)) { case ('>', <= 30): filterKmwGt = num; break; @@ -467,7 +467,7 @@ namespace Elwig.Windows { filterNames.Add($"bis zum {n2}"); } } - } else if (e.Length > 2 && e.StartsWith("\"") && e.EndsWith("\"")) { + } else if (e.Length > 2 && e.StartsWith('"') && e.EndsWith('"')) { filter[i] = e[1..^1]; } else if (e.Length <= 2) { filter.RemoveAt(i--); @@ -1590,7 +1590,7 @@ namespace Elwig.Windows { } private void GradationKmwInput_LostFocus(object sender, RoutedEventArgs evt) { - if (GradationKmwInput.Text.EndsWith(",")) GradationKmwInput.Text += "0"; + if (GradationKmwInput.Text.EndsWith(',')) GradationKmwInput.Text += "0"; InputLostFocus((TextBox)sender, Validator.CheckGradationKmw); if (GradationKmwInput.Text.Length != 0 && !GradationKmwInput.Text.Contains(',')) GradationKmwInput.Text += ",0"; @@ -1688,7 +1688,7 @@ namespace Elwig.Windows { if (sender is not TextBox tb) return; if (tb.Text.Length > 0) { if (!tb.Text.Contains(',')) tb.Text += ",0"; - if (tb.Text.EndsWith(",")) tb.Text += "0"; + if (tb.Text.EndsWith(',')) tb.Text += "0"; } InputLostFocus(tb, Validator.CheckDecimal(tb, false, 2, 1)); }