MemberListWindow Validator

This commit is contained in:
2023-02-26 00:41:16 +01:00
parent dcfe6169b0
commit 0059f57e5e
4 changed files with 136 additions and 24 deletions

View File

@ -294,26 +294,26 @@ namespace WGneu.Windows
private void LockInputs()
{
MgNrInput.IsReadOnly = true;
GivenNameInput.IsReadOnly = true;
FamilyNameInput.IsReadOnly = true;
AddressInput.IsReadOnly = true;
PlzInput.IsReadOnly = true;
OrtInput.IsEnabled = false;
BranchInput.IsEnabled = false;
DefaultKgInput.IsEnabled = false;
foreach (var tb in Utils.FindVisualChilds<TextBox>(this))
if (tb.Name != "SearchInput") tb.IsReadOnly = true;
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = false;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
cb.IsEnabled = false;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = false;
}
private void UnlockInputs()
{
MgNrInput.IsReadOnly = false;
GivenNameInput.IsReadOnly = false;
FamilyNameInput.IsReadOnly = false;
AddressInput.IsReadOnly = false;
PlzInput.IsReadOnly = false;
OrtInput.IsEnabled = true;
BranchInput.IsEnabled = true;
DefaultKgInput.IsEnabled = true;
foreach (var tb in Utils.FindVisualChilds<TextBox>(this))
if (tb.Name != "SearchInput") tb.IsReadOnly = false;
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = true;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
cb.IsEnabled = true;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = true;
}
private void FillInputs(Member m)
@ -341,14 +341,24 @@ namespace WGneu.Windows
private void ClearInputs()
{
MgNrInput.Text = "";
GivenNameInput.Text = "";
FamilyNameInput.Text = "";
BranchInput.SelectedItem = null;
PlzInput.Text = "";
OrtInput.SelectedItem = null;
AddressInput.Text = "";
DefaultKgInput.SelectedItem = null;
foreach (var tb in Utils.FindVisualChilds<TextBox>(this))
if (tb.Name != "SearchInput") tb.Text = "";
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.SelectedItem = null;
}
private void LfbisNrInput_TextChanged(object sender, RoutedEventArgs e)
{
var res = Validator.CheckLfbisNr(LfbisNrInput);
if (res.IsValid) Validator.SetInputValid(LfbisNrInput);
else Validator.SetInputInvalid(LfbisNrInput);
}
private void LfbisNrInput_LostFocus(object sender, RoutedEventArgs e)
{
var res = Validator.CheckLfbisNr(LfbisNrInput);
if (!res.IsValid)
MessageBox.Show(res.ErrorContent.ToString(), "Betriebsnummer ungültig", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
}