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"/> <ColumnDefinition Width="115"/>
</Grid.ColumnDefinitions> </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"/> 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" <DataGrid x:Name="MemberList" AutoGenerateColumns="False" HeadersVisibility="Column" IsReadOnly="True" GridLinesVisibility="None" SelectionMode="Single"
CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" CanUserAddRows="False"
SelectionChanged="MemberList_SelectionChanged" SelectionChanged="MemberList_SelectionChanged"
@ -98,7 +100,7 @@
<Button x:Name="ResetButton" Content="Zurücksetzen" Click="ResetButton_Click" IsEnabled="False" Visibility="Hidden" <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"/> 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" <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> </Grid>
<GroupBox Header="Persönliche Daten" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Margin="5,5,5,5"> <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) { private void Window_Loaded(object sender, RoutedEventArgs e) {
RefreshMemberList(); AktiveMitgliederInput.IsChecked = true;
BranchInput.ItemsSource = Context.Branches.OrderBy(b => b.Name).ToList(); BranchInput.ItemsSource = Context.Branches.OrderBy(b => b.Name).ToList();
DefaultKgInput.ItemsSource = Context.WbKgs.Select(k => k.Kg).OrderBy(k => k.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() { private void RefreshMemberList() {
Context.Members.Load(); 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) { if (TextFilter.Count > 0) {
members = members members = members
@ -86,7 +88,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this)) foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
Utils.ClearInputState(cb); Utils.ClearInputState(cb);
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this)) 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)) foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
Utils.ClearInputState(rb); Utils.ClearInputState(rb);
} }
@ -114,6 +116,10 @@ namespace WGneu.Windows {
RefreshInputs(); RefreshInputs();
} }
private void ActiveMemberCheckBox_Changed(object sender, RoutedEventArgs e) {
RefreshMemberList();
}
private void NewMemberButton_Click(object sender, RoutedEventArgs e) { private void NewMemberButton_Click(object sender, RoutedEventArgs e) {
IsCreating = true; IsCreating = true;
MemberList.IsEnabled = false; MemberList.IsEnabled = false;
@ -297,7 +303,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this)) foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = false; cb.IsEnabled = false;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this)) 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)) foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = false; rb.IsEnabled = false;
} }
@ -308,7 +314,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this)) foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.IsEnabled = true; cb.IsEnabled = true;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this)) 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)) foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsEnabled = true; rb.IsEnabled = true;
} }
@ -369,7 +375,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this)) foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
OriginalValues[cb] = cb.SelectedItem; OriginalValues[cb] = cb.SelectedItem;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this)) 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)) foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
OriginalValues[rb] = (rb.IsChecked ?? false) ? bool.TrueString : null; OriginalValues[rb] = (rb.IsChecked ?? false) ? bool.TrueString : null;
} }
@ -380,7 +386,7 @@ namespace WGneu.Windows {
foreach (var cb in Utils.FindVisualChilds<ComboBox>(this)) foreach (var cb in Utils.FindVisualChilds<ComboBox>(this))
cb.SelectedItem = null; cb.SelectedItem = null;
foreach (var cb in Utils.FindVisualChilds<CheckBox>(this)) 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)) foreach (var rb in Utils.FindVisualChilds<RadioButton>(this))
rb.IsChecked = false; rb.IsChecked = false;
OriginalValues.Clear(); OriginalValues.Clear();