BaseDataWindow: Implement branches, attributes and cultivations

This commit is contained in:
2023-11-02 20:39:29 +01:00
parent d9dbfe68c1
commit f7a044ba79
8 changed files with 864 additions and 177 deletions

View File

@ -71,7 +71,7 @@ namespace Elwig.Windows {
CheckBoxInputs = ControlUtils.FindAllChildren<CheckBox>(this, ExemptInputs).ToArray();
CheckComboBoxInputs = ControlUtils.FindAllChildren<CheckComboBox>(this, ExemptInputs).ToArray();
RadioButtonInputs = ControlUtils.FindAllChildren<RadioButton>(this, ExemptInputs).ToArray();
PlzInputs = TextBoxInputs.Where(tb => "PLZ".Equals(tb.Tag)).ToArray();
PlzInputs = ControlUtils.FindAllChildren<TextBox>(this).Where(tb => "PLZ".Equals(tb.Tag)).ToArray();
PlzOrtInputs = PlzInputs.Select(tb => ControlUtils.FindNextSibling<ComboBox>(tb) ?? throw new MissingMemberException()).ToArray();
foreach (var tb in TextBoxInputs)
Valid[tb] = true;
@ -317,7 +317,7 @@ namespace Elwig.Windows {
);
protected void UpdatePlz(TextBox plzInput, ComboBox ortInput) {
var plzInputValid = GetInputValid(plzInput);
var plzInputValid = Validator.CheckPlz(plzInput, RequiredInputs.Contains(plzInput), Context).IsValid;
var item = ortInput.SelectedItem;
var list = plzInputValid && plzInput.Text.Length == 4 ? Context.Postleitzahlen.Find(int.Parse(plzInput.Text))?.Orte.ToList() : null;
ControlUtils.RenewItemsSource(ortInput, list, i => (i as AT_PlzDest)?.Id);
@ -551,5 +551,13 @@ namespace Elwig.Windows {
protected void LfbisNrInput_LostFocus(object sender, RoutedEventArgs evt) {
InputLostFocus((TextBox)sender, Validator.CheckLfbisNr);
}
protected void UpperCaseInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckUpperCase);
}
protected void UpperCaseInput_LostFocus(object sender, RoutedEventArgs evt) {
InputLostFocus((TextBox)sender, Validator.CheckUpperCase);
}
}
}