Add Pdf.Display, Rename ActiveMemberInput

This commit is contained in:
2023-03-05 00:35:55 +01:00
parent 4c8f6e8cdc
commit 342c7b92bd
4 changed files with 36 additions and 14 deletions

View File

@ -38,7 +38,7 @@ namespace WGneu.Windows {
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
AktiveMitgliederInput.IsChecked = true;
ActiveMemberInput.IsChecked = true;
BranchInput.ItemsSource = Context.Branches.OrderBy(b => b.Name).ToList();
DefaultKgInput.ItemsSource = Context.WbKgs.Select(k => k.Kg).OrderBy(k => k.Name).ToList();
}
@ -63,8 +63,11 @@ namespace WGneu.Windows {
private void RefreshMemberList() {
Context.Members.Load();
List<Member> members = AktiveMitgliederInput.IsChecked.Value ? Context.Members.Where(m => m.Active).ToList() : Context.Members.ToList();
IQueryable<Member> memberQuery = Context.Members;
if (ActiveMemberInput.IsChecked == true)
memberQuery = memberQuery.Where(m => m.Active);
List<Member> members = memberQuery.ToList();
members = members.OrderBy(m => m.FamilyName + " " + m.GivenName).ToList();
if (TextFilter.Count > 0) {
@ -88,7 +91,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
Utils.ClearInputState(cb);
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
if (cb.Name != "AktiveMitgliederInput") Utils.ClearInputState(cb);
if (cb.Name != "ActiveMemberInput") Utils.ClearInputState(cb);
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
Utils.ClearInputState(rb);
}
@ -116,7 +119,7 @@ namespace WGneu.Windows {
RefreshInputs();
}
private void ActiveMemberCheckBox_Changed(object sender, RoutedEventArgs e) {
private void ActiveMemberInput_Changed(object sender, RoutedEventArgs e) {
RefreshMemberList();
}
@ -127,6 +130,7 @@ namespace WGneu.Windows {
HideNewEditDeleteButtons();
ShowSaveResetCancelButtons();
UnlockInputs();
LockSearchInputs();
}
private void EditMemberButton_Click(object sender, RoutedEventArgs e) {
@ -139,6 +143,7 @@ namespace WGneu.Windows {
HideNewEditDeleteButtons();
ShowSaveResetCancelButtons();
UnlockInputs();
LockSearchInputs();
}
private void DeleteMemberButton_Click(object sender, RoutedEventArgs e) {
@ -221,6 +226,7 @@ namespace WGneu.Windows {
HideSaveResetCancelButtons();
ShowNewEditDeleteButtons();
LockInputs();
UnlockSearchInputs();
RefreshMemberList();
}
@ -241,6 +247,7 @@ namespace WGneu.Windows {
ShowNewEditDeleteButtons();
RefreshInputs();
LockInputs();
UnlockSearchInputs();
}
private void SearchInput_TextChanged(object sender, RoutedEventArgs e) {
@ -303,7 +310,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = false;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
cb.IsEnabled = cb.Name == "AktiveMitgliederInput" ? true : false;
if (cb.Name != "ActiveMemberInput") cb.IsEnabled = false;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = false;
}
@ -314,11 +321,21 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = true;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
cb.IsEnabled = cb.Name == "AktiveMitgliederInput" ? false : true;
if (cb.Name != "ActiveMemberInput") cb.IsEnabled = true;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = true;
}
private void LockSearchInputs() {
SearchInput.IsEnabled = false;
ActiveMemberInput.IsEnabled = false;
}
private void UnlockSearchInputs() {
SearchInput.IsEnabled = true;
ActiveMemberInput.IsEnabled = true;
}
private void FillInputs(Member m) {
OriginalValues.Clear();
@ -375,7 +392,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
OriginalValues[cb] = cb.SelectedItem;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
if (cb.Name != "AktiveMitgliederInput") OriginalValues[cb] = (cb.IsChecked ?? false) ? bool.TrueString : null;
if (cb.Name != "ActiveMemberInput") OriginalValues[cb] = (cb.IsChecked ?? false) ? bool.TrueString : null;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
OriginalValues[rb] = (rb.IsChecked ?? false) ? bool.TrueString : null;
}
@ -386,7 +403,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.SelectedItem = null;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
if (cb.Name != "AktiveMitgliederInput") cb.IsChecked = false;
if (cb.Name != "ActiveMemberInput") cb.IsChecked = false;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsChecked = false;
OriginalValues.Clear();