Merge changes

This commit is contained in:
2023-03-04 16:28:42 +01:00
parent d12266abbb
commit 0e73d408fb
2 changed files with 17 additions and 9 deletions

View File

@ -73,8 +73,10 @@
<ColumnDefinition Width="115"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="SearchInput" Grid.ColumnSpan="3" Margin="10,7,10,0" IsReadOnly="False"
<TextBox x:Name="SearchInput" Grid.ColumnSpan="3" Margin="10,7,145,0" IsReadOnly="False"
TextChanged="SearchInput_TextChanged"/>
<CheckBox x:Name="AktiveMitgliederInput" Content="Nur aktive anzeigen" Checked="ActiveMemberCheckBox_Changed" Unchecked="ActiveMemberCheckBox_Changed"
HorizontalAlignment="Left" Margin="90,12,0,0" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2"/>
<DataGrid x:Name="MemberList" AutoGenerateColumns="False" HeadersVisibility="Column" IsReadOnly="True" GridLinesVisibility="None" SelectionMode="Single"
CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False"
SelectionChanged="MemberList_SelectionChanged"
@ -98,7 +100,7 @@
<Button x:Name="ResetButton" Content="Zurücksetzen" Click="ResetButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,10,0,10" Width="100" Grid.Column="1"/>
<Button x:Name="CancelButton" Content="Abbrechen" Click="CancelButton_Click" IsEnabled="False" Visibility="Hidden"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,10,10,10" Width="100" Grid.Column="2"/>
HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,10,10,10" FontSize="14" Padding="3,3,3,3" Width="100" Height="27" Grid.Column="2"/>
</Grid>
<GroupBox Header="Persönliche Daten" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Margin="5,5,5,5">

View File

@ -38,7 +38,7 @@ namespace WGneu.Windows {
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
RefreshMemberList();
AktiveMitgliederInput.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,7 +63,9 @@ namespace WGneu.Windows {
private void RefreshMemberList() {
Context.Members.Load();
List<Member> members = Context.Members.OrderBy(m => m.FamilyName + " " + m.GivenName).ToList();
List<Member> members = AktiveMitgliederInput.IsChecked.Value ? Context.Members.Where(m => m.Active).ToList() : Context.Members.ToList();
members = members.OrderBy(m => m.FamilyName + " " + m.GivenName).ToList();
if (TextFilter.Count > 0) {
members = members
@ -86,7 +88,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
Utils.ClearInputState(cb);
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
Utils.ClearInputState(cb);
if (cb.Name != "AktiveMitgliederInput") Utils.ClearInputState(cb);
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
Utils.ClearInputState(rb);
}
@ -114,6 +116,10 @@ namespace WGneu.Windows {
RefreshInputs();
}
private void ActiveMemberCheckBox_Changed(object sender, RoutedEventArgs e) {
RefreshMemberList();
}
private void NewMemberButton_Click(object sender, RoutedEventArgs e) {
IsCreating = true;
MemberList.IsEnabled = false;
@ -297,7 +303,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 = false;
cb.IsEnabled = cb.Name == "AktiveMitgliederInput" ? true : false;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = false;
}
@ -308,7 +314,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = true;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
cb.IsEnabled = true;
cb.IsEnabled = cb.Name == "AktiveMitgliederInput" ? false : true;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = true;
}
@ -369,7 +375,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
OriginalValues[cb] = cb.SelectedItem;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
OriginalValues[cb] = (cb.IsChecked ?? false) ? bool.TrueString : null;
if (cb.Name != "AktiveMitgliederInput") OriginalValues[cb] = (cb.IsChecked ?? false) ? bool.TrueString : null;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
OriginalValues[rb] = (rb.IsChecked ?? false) ? bool.TrueString : null;
}
@ -380,7 +386,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.SelectedItem = null;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this))
cb.IsChecked = false;
if (cb.Name != "AktiveMitgliederInput") cb.IsChecked = false;
foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsChecked = false;
OriginalValues.Clear();