Add MemberListWindow
This commit is contained in:
@ -18,5 +18,10 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Button x:Name="Button1" Content="Bankverbindung" HorizontalAlignment="Center" VerticalAlignment="Center" Click="Button1_Click"/>
|
<Button x:Name="Button1" Content="Bankverbindung" HorizontalAlignment="Center" VerticalAlignment="Center" Click="Button1_Click"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Margin="175,149,0,0" VerticalAlignment="Top" Width="120" ItemsSource="{Binding Source={StaticResource countryViewSource}}" ItemTemplate="{StaticResource asdf}" SelectionChanged="ComboBox_SelectionChanged" IsEditable="True"/>
|
<ComboBox HorizontalAlignment="Left" Margin="175,149,0,0" VerticalAlignment="Top" Width="120" ItemsSource="{Binding Source={StaticResource countryViewSource}}" ItemTemplate="{StaticResource asdf}" SelectionChanged="ComboBox_SelectionChanged" IsEditable="True"/>
|
||||||
|
<Button Content="Mitglieder" HorizontalAlignment="Left" Margin="295,284,0,0" VerticalAlignment="Top" Click="Button2_Click">
|
||||||
|
<Button.Style>
|
||||||
|
<Style/>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -28,7 +28,7 @@ namespace WGneu
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
countryViewSource = (CollectionViewSource)FindResource("countryViewSource");
|
countryViewSource = (CollectionViewSource) FindResource("countryViewSource");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
@ -49,6 +49,12 @@ namespace WGneu
|
|||||||
w.Show();
|
w.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Button2_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MemberListWindow w = new MemberListWindow();
|
||||||
|
w.Show();
|
||||||
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
25
WGneu/MemberListWindow.xaml
Normal file
25
WGneu/MemberListWindow.xaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<Window x:Class="WGneu.MemberListWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:WGneu"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Mitglieder" Height="450" Width="800"
|
||||||
|
Loaded="Window_Loaded">
|
||||||
|
<Grid>
|
||||||
|
<DataGrid x:Name="MemberList" AutoGenerateColumns="False" CanUserAddRows="False"
|
||||||
|
SelectionChanged="MemberList_SelectionChanged"
|
||||||
|
HorizontalAlignment="Left" Width="308" Margin="10,10,10,10">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="MgNr" Binding="{Binding MgNr}"/>
|
||||||
|
<DataGridTextColumn Header="Nachname" Binding="{Binding FamilyName}"/>
|
||||||
|
<DataGridTextColumn Header="Vorname" Binding="{Binding GivenName}"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<TextBox x:Name="MgNr" HorizontalAlignment="Left" Margin="351,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True"/>
|
||||||
|
<TextBox x:Name="GivenName" HorizontalAlignment="Left" Margin="351,33,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True"/>
|
||||||
|
<TextBox x:Name="FamilyName" HorizontalAlignment="Left" Margin="351,56,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
51
WGneu/MemberListWindow.xaml.cs
Normal file
51
WGneu/MemberListWindow.xaml.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace WGneu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für Window1.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MemberListWindow : Window
|
||||||
|
{
|
||||||
|
private readonly WGContext _context = new WGContext();
|
||||||
|
|
||||||
|
public MemberListWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_context.Members.Load();
|
||||||
|
MemberList.ItemsSource = _context.Members.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnClosing(CancelEventArgs e)
|
||||||
|
{
|
||||||
|
_context.Dispose();
|
||||||
|
base.OnClosing(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MemberList_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Member m = (Member) MemberList.SelectedItem;
|
||||||
|
MgNr.Text = m.MgNr.ToString();
|
||||||
|
GivenName.Text = m.GivenName;
|
||||||
|
FamilyName.Text = m.FamilyName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,13 +13,17 @@ namespace WGneu
|
|||||||
{
|
{
|
||||||
[Column("alpha2")]
|
[Column("alpha2")]
|
||||||
public String Alpha2 { get; set; }
|
public String Alpha2 { get; set; }
|
||||||
|
|
||||||
[Column("alpha3")]
|
[Column("alpha3")]
|
||||||
public String Alpha3 { get; set; }
|
public String Alpha3 { get; set; }
|
||||||
|
|
||||||
[Column("num")]
|
[Column("num")]
|
||||||
public int Num { get; set; }
|
public int Num { get; set; }
|
||||||
|
|
||||||
[Column("name")]
|
[Column("name")]
|
||||||
public String Name { get; set; }
|
public String Name { get; set; }
|
||||||
|
|
||||||
[Column("is_visible")]
|
[Column("is_visible")]
|
||||||
public int IsVisible {get; set; }
|
public int IsVisible { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
23
WGneu/Models/Member.cs
Normal file
23
WGneu/Models/Member.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WGneu
|
||||||
|
{
|
||||||
|
[Table("member"), PrimaryKey("MgNr")]
|
||||||
|
public class Member
|
||||||
|
{
|
||||||
|
[Column("mgnr")]
|
||||||
|
public int MgNr { get; set; }
|
||||||
|
|
||||||
|
[Column("given_name")]
|
||||||
|
public String GivenName { get; set; }
|
||||||
|
|
||||||
|
[Column("family_name")]
|
||||||
|
public String FamilyName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,8 @@ namespace WGneu
|
|||||||
public class WGContext : DbContext
|
public class WGContext : DbContext
|
||||||
{
|
{
|
||||||
public DbSet<Country> Countries { get; set; }
|
public DbSet<Country> Countries { get; set; }
|
||||||
|
public DbSet<Member> Members { get; set; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlite("Data Source=\"C:\\Users\\Lorenz\\Desktop\\wgtest.sqlite3\"");
|
optionsBuilder.UseSqlite("Data Source=\"C:\\Users\\Lorenz\\Desktop\\wgtest.sqlite3\"");
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
<Compile Update="BankDetailsWindow.xaml.cs">
|
<Compile Update="BankDetailsWindow.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="MemberListWindow.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Update="BankDetailsWindow.xaml">
|
<Page Update="BankDetailsWindow.xaml">
|
||||||
@ -18,5 +21,8 @@
|
|||||||
<Page Update="MainWindow.xaml">
|
<Page Update="MainWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="MemberListWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Reference in New Issue
Block a user