WIP Member List
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
WGneu/obj/
|
WGneu/obj/
|
||||||
WGneu/bin/
|
WGneu/bin/
|
||||||
|
.vs
|
@ -5,11 +5,11 @@
|
|||||||
StartupUri="MainWindow.xaml"
|
StartupUri="MainWindow.xaml"
|
||||||
xmlns:ui="http://schemas.modernwpf.com/2019">
|
xmlns:ui="http://schemas.modernwpf.com/2019">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<!--<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ui:ThemeResources />
|
<ui:ThemeResources />
|
||||||
<ui:XamlControlsResources />
|
<ui:XamlControlsResources />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>-->
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
@ -11,6 +11,8 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using WGneu.Models;
|
||||||
|
|
||||||
|
|
||||||
namespace WGneu
|
namespace WGneu
|
||||||
{
|
{
|
||||||
|
@ -16,12 +16,8 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Button x:Name="Button1" Content="Bankverbindung" HorizontalAlignment="Center" VerticalAlignment="Center" Click="Button1_Click"/>
|
<Button x:Name="Button1" Content="Bankverbindung" VerticalAlignment="Top" Click="Button1_Click" Margin="454,109,159,0"/>
|
||||||
<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 x:Name="Button2" Content="Mitglieder" Margin="472,182,178,0" VerticalAlignment="Top" Click="Button2_Click"/>
|
||||||
<Button.Style>
|
|
||||||
<Style/>
|
|
||||||
</Button.Style>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -15,6 +15,8 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using WGneu.Models;
|
||||||
|
|
||||||
|
|
||||||
namespace WGneu
|
namespace WGneu
|
||||||
{
|
{
|
||||||
|
30
WGneu/MemberAddWindow.xaml
Normal file
30
WGneu/MemberAddWindow.xaml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<Window x:Class="WGneu.MemberAddWindow"
|
||||||
|
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="Mitglied anlegen" Height="450" Width="800"
|
||||||
|
Loaded="Window_Loaded">
|
||||||
|
<Grid>
|
||||||
|
<Label Content="MNR:" HorizontalAlignment="Left" Margin="392,137,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="MgNr" HorizontalAlignment="Left" Margin="475,141,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Vorname:" HorizontalAlignment="Left" Margin="392,160,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="GivenName" HorizontalAlignment="Left" Margin="475,164,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Nachname:" HorizontalAlignment="Left" Margin="392,182,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="FamilyName" HorizontalAlignment="Left" Margin="475,187,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Zweigstelle:" HorizontalAlignment="Left" Margin="392,206,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="Zweigstelle" HorizontalAlignment="Left" Margin="475,210,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Country:" HorizontalAlignment="Left" Margin="392,229,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="Country" HorizontalAlignment="Left" Margin="475,233,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="PostalDest:" HorizontalAlignment="Left" Margin="392,252,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="PostalDest" HorizontalAlignment="Left" Margin="475,256,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Address:" HorizontalAlignment="Left" Margin="392,275,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="Address" HorizontalAlignment="Left" Margin="475,279,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="DefaultKgnr:" HorizontalAlignment="Left" Margin="392,298,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="DefaultKgnr" HorizontalAlignment="Left" Margin="475,302,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Button x:Name="Save_Button" Content="Save" HorizontalAlignment="Left" Margin="682,199,0,0" VerticalAlignment="Top" Click="Save_Button_Click"/>
|
||||||
|
<Label x:Name="SaveError" Content="" HorizontalAlignment="Left" Height="32" Margin="639,233,0,0" VerticalAlignment="Top" Width="115"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
81
WGneu/MemberAddWindow.xaml.cs
Normal file
81
WGneu/MemberAddWindow.xaml.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
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;
|
||||||
|
using WGneu.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace WGneu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MemberAddWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MemberAddWindow : Window
|
||||||
|
{
|
||||||
|
private WGContext _context;
|
||||||
|
private readonly Member member = new Member();
|
||||||
|
public event EventHandler Event;
|
||||||
|
|
||||||
|
public MemberAddWindow(WGContext context)
|
||||||
|
{
|
||||||
|
this._context = context;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MgNr.Text = member.MgNr.ToString();
|
||||||
|
GivenName.Text = member.GivenName;
|
||||||
|
FamilyName.Text = member.FamilyName;
|
||||||
|
Zweigstelle.Text = member.Zweigstelle;
|
||||||
|
Country.Text = member.Country.Alpha2;
|
||||||
|
// PostalDest.Text= member.PostalDest;
|
||||||
|
Address.Text = member.Address;
|
||||||
|
DefaultKgnr.Text = member.DefaultKg.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Save_Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
member.MgNr = Int32.Parse(MgNr.Text);
|
||||||
|
member.GivenName = GivenName.Text;
|
||||||
|
member.FamilyName = FamilyName.Text;
|
||||||
|
member.Zweigstelle = Zweigstelle.Text;
|
||||||
|
member.Country.Alpha2 = Country.Text;
|
||||||
|
// member.PostalDest = PostalDest.Text;
|
||||||
|
member.Address= Address.Text;
|
||||||
|
member.DefaultKg.KgNr = Int32.Parse(DefaultKgnr.Text);
|
||||||
|
|
||||||
|
_context.Add(member);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_context.SaveChanges();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
SaveError.Content = "There was an Error!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.Call_Event();
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Call_Event()
|
||||||
|
{
|
||||||
|
if (this.Event != null)
|
||||||
|
{
|
||||||
|
this.Event(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
WGneu/MemberEditWindow.xaml
Normal file
29
WGneu/MemberEditWindow.xaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<Window x:Class="WGneu.MemberEditWindow"
|
||||||
|
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="MemberEditWindow" Height="450" Width="800"
|
||||||
|
Loaded="Window_Loaded">
|
||||||
|
<Grid>
|
||||||
|
<Label Content="MNR:" HorizontalAlignment="Left" Margin="392,137,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="MgNr" HorizontalAlignment="Left" Margin="475,141,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Vorname:" HorizontalAlignment="Left" Margin="392,160,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="GivenName" HorizontalAlignment="Left" Margin="475,164,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Nachname:" HorizontalAlignment="Left" Margin="392,182,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="FamilyName" HorizontalAlignment="Left" Margin="475,187,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Zweigstelle:" HorizontalAlignment="Left" Margin="392,206,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="Zweigstelle" HorizontalAlignment="Left" Margin="475,210,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Country:" HorizontalAlignment="Left" Margin="392,229,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="Country" HorizontalAlignment="Left" Margin="475,233,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="PostalDest:" HorizontalAlignment="Left" Margin="392,252,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="PostalDest" HorizontalAlignment="Left" Margin="475,256,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="Address:" HorizontalAlignment="Left" Margin="392,275,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="Address" HorizontalAlignment="Left" Margin="475,279,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Label Content="DefaultKgnr:" HorizontalAlignment="Left" Margin="392,298,0,0" VerticalAlignment="Top"/>
|
||||||
|
<TextBox x:Name="DefaultKgnr" HorizontalAlignment="Left" Margin="475,302,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<Button x:Name="Save_Button" Content="Save" HorizontalAlignment="Left" Margin="662,194,0,0" VerticalAlignment="Top" Click="Save_Button_Click"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
74
WGneu/MemberEditWindow.xaml.cs
Normal file
74
WGneu/MemberEditWindow.xaml.cs
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
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;
|
||||||
|
using WGneu.Models;
|
||||||
|
|
||||||
|
|
||||||
|
namespace WGneu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MemberEditWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MemberEditWindow : Window
|
||||||
|
{
|
||||||
|
private WGContext _context;
|
||||||
|
private readonly Member member;
|
||||||
|
public event EventHandler Event;
|
||||||
|
|
||||||
|
public MemberEditWindow(Member member, WGContext context)
|
||||||
|
{
|
||||||
|
this._context= context;
|
||||||
|
this.member = member;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MgNr.Text = member.MgNr.ToString();
|
||||||
|
GivenName.Text = member.GivenName;
|
||||||
|
FamilyName.Text = member.FamilyName;
|
||||||
|
Zweigstelle.Text = member.Zweigstelle;
|
||||||
|
// Country.Text = member.Country;
|
||||||
|
// PostalDest.Text = member.PostalDest;
|
||||||
|
Address.Text = member.Address;
|
||||||
|
// DefaultKgnr.Text = member.DefaultKgnr.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Save_Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
member.MgNr = Int32.Parse(MgNr.Text);
|
||||||
|
member.GivenName = GivenName.Text;
|
||||||
|
member.FamilyName = FamilyName.Text;
|
||||||
|
member.Zweigstelle = Zweigstelle.Text;
|
||||||
|
// member.Country = Country.Text;
|
||||||
|
// member.PostalDest = PostalDest.Text;
|
||||||
|
member.Address = Address.Text;
|
||||||
|
// member.DefaultKgnr = Int32.Parse(DefaultKgnr.Text);
|
||||||
|
|
||||||
|
_context.Update(member);
|
||||||
|
_context.SaveChanges();
|
||||||
|
this.Call_Event();
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Call_Event()
|
||||||
|
{
|
||||||
|
if (this.Event != null)
|
||||||
|
{
|
||||||
|
this.Event(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,21 +7,24 @@
|
|||||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||||
ui:WindowHelper.UseModernWindowStyle="True"
|
ui:WindowHelper.UseModernWindowStyle="True"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Mitglieder" Height="450" Width="800"
|
Title="Mitglieder" Height="500" Width="800" MinHeight="500" MinWidth="800"
|
||||||
Loaded="Window_Loaded">
|
Loaded="Window_Loaded">
|
||||||
<Grid>
|
<Grid>
|
||||||
<DataGrid x:Name="MemberList" AutoGenerateColumns="False" CanUserAddRows="False"
|
<DataGrid x:Name="MemberList" AutoGenerateColumns="False" CanUserAddRows="False"
|
||||||
SelectionChanged="MemberList_SelectionChanged"
|
SelectionChanged="MemberList_SelectionChanged" VerticalAlignment="Top" Margin="10,10,540,0" FontSize="14" HeadersVisibility="Column" IsReadOnly="True">
|
||||||
HorizontalAlignment="Left" Width="308" Margin="10,10,10,10">
|
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="MgNr" Binding="{Binding MgNr}"/>
|
<DataGridTextColumn Header="Nr." Binding="{Binding MgNr}" Width="50"/>
|
||||||
<DataGridTextColumn Header="Nachname" Binding="{Binding FamilyName}"/>
|
<DataGridTextColumn Header="Nachname" Binding="{Binding FamilyName}" Width="100"/>
|
||||||
<DataGridTextColumn Header="Vorname" Binding="{Binding GivenName}"/>
|
<DataGridTextColumn Header="Vorname" Binding="{Binding GivenName}" Width="*"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<TextBox x:Name="MgNr" HorizontalAlignment="Left" Margin="351,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True"/>
|
<TextBox x:Name="MgNr" HorizontalAlignment="Left" Margin="351,26,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True" FontSize="14"/>
|
||||||
<TextBox x:Name="GivenName" HorizontalAlignment="Left" Margin="351,67,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True"/>
|
<TextBox x:Name="GivenName" HorizontalAlignment="Left" Margin="351,67,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True"/>
|
||||||
<TextBox x:Name="FamilyName" HorizontalAlignment="Left" Margin="351,129,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True"/>
|
<TextBox x:Name="FamilyName" HorizontalAlignment="Left" Margin="351,129,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="183" IsReadOnly="True"/>
|
||||||
|
<Button x:Name="Edit_Member" Content="Mitglied bearbeiten" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="130,407,0,20" Click="Edit_Member_Button_Click" IsEnabled="False" FontSize="14" Padding="3,3,3,3"/>
|
||||||
|
<Button x:Name="Add_Member" Content="Mitglied erstellen" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,407,0,20" Click="Add_Member_Button_Click" FontSize="14" Padding="3,3,3,3"/>
|
||||||
|
<TextBox x:Name="Plz" HorizontalAlignment="Left" Margin="351,191,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
|
||||||
|
<ComboBox x:Name="Ort" HorizontalAlignment="Left" Margin="498,189,0,0" VerticalAlignment="Top" Width="120" ItemTemplate="{Binding Name}"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -13,6 +13,8 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using WGneu.Models;
|
||||||
|
|
||||||
|
|
||||||
namespace WGneu
|
namespace WGneu
|
||||||
{
|
{
|
||||||
@ -30,8 +32,7 @@ namespace WGneu
|
|||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_context.Members.Load();
|
Refresh_Member_Data();
|
||||||
MemberList.ItemsSource = _context.Members.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnClosing(CancelEventArgs e)
|
protected override void OnClosing(CancelEventArgs e)
|
||||||
@ -46,6 +47,44 @@ namespace WGneu
|
|||||||
MgNr.Text = m.MgNr.ToString();
|
MgNr.Text = m.MgNr.ToString();
|
||||||
GivenName.Text = m.GivenName;
|
GivenName.Text = m.GivenName;
|
||||||
FamilyName.Text = m.FamilyName;
|
FamilyName.Text = m.FamilyName;
|
||||||
|
|
||||||
|
AT_Plz p = m.PostalDest.Plz(_context);
|
||||||
|
Plz.Text = p.Plz.ToString();
|
||||||
|
|
||||||
|
var o = p.Orte(_context);
|
||||||
|
Ort.ItemsSource = o;
|
||||||
|
Ort.
|
||||||
|
|
||||||
|
Edit_Member.IsEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Edit_Member_Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Member m = (Member)MemberList.SelectedItem;
|
||||||
|
|
||||||
|
if (m == null) return;
|
||||||
|
|
||||||
|
MemberEditWindow w = new MemberEditWindow(m, _context);
|
||||||
|
w.Event += new EventHandler(Refresh_Member_Data_Event);
|
||||||
|
w.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Add_Member_Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MemberAddWindow w = new MemberAddWindow(_context);
|
||||||
|
w.Event += new EventHandler(Refresh_Member_Data_Event);
|
||||||
|
w.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Refresh_Member_Data()
|
||||||
|
{
|
||||||
|
_context.Members.Load();
|
||||||
|
MemberList.ItemsSource = _context.Members.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Refresh_Member_Data_Event(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Refresh_Member_Data();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
WGneu/Models/AT_Gem.cs
Normal file
20
WGneu/Models/AT_Gem.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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.Models
|
||||||
|
{
|
||||||
|
[Table("AT_gem"), PrimaryKey("Gkz")]
|
||||||
|
public class AT_Gem
|
||||||
|
{
|
||||||
|
[Column("gkz")]
|
||||||
|
public int Gkz { get; set; }
|
||||||
|
|
||||||
|
[Column("name")]
|
||||||
|
public String Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
26
WGneu/Models/AT_Kg.cs
Normal file
26
WGneu/Models/AT_Kg.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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.Models
|
||||||
|
{
|
||||||
|
[Table("AT_kg"), PrimaryKey("KgNr")]
|
||||||
|
public class AT_Kg
|
||||||
|
{
|
||||||
|
[Column("kgnr")]
|
||||||
|
public int KgNr { get; set; }
|
||||||
|
|
||||||
|
[Column("gkz")]
|
||||||
|
public int Gkz { get; set; }
|
||||||
|
|
||||||
|
[Column("name")]
|
||||||
|
public String Name { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Gkz")]
|
||||||
|
public virtual AT_Gem Gem { get; set; }
|
||||||
|
}
|
||||||
|
}
|
32
WGneu/Models/AT_Ort.cs
Normal file
32
WGneu/Models/AT_Ort.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
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.Models
|
||||||
|
{
|
||||||
|
[Table("AT_ort"), PrimaryKey("Okz")]
|
||||||
|
public class AT_Ort
|
||||||
|
{
|
||||||
|
[Column("okz")]
|
||||||
|
public int Okz { get; set; }
|
||||||
|
|
||||||
|
[Column("gkz")]
|
||||||
|
public int Gkz { get; set; }
|
||||||
|
|
||||||
|
[Column("kgnr")]
|
||||||
|
public int KgNr { get; set; }
|
||||||
|
|
||||||
|
[Column("name")]
|
||||||
|
public String Name { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Gkz")]
|
||||||
|
public virtual AT_Gem Gem { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("KgNr")]
|
||||||
|
public virtual AT_Kg Kg { get; set; }
|
||||||
|
}
|
||||||
|
}
|
41
WGneu/Models/AT_Plz.cs
Normal file
41
WGneu/Models/AT_Plz.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WGneu.Models
|
||||||
|
{
|
||||||
|
[Table("AT_plz"), PrimaryKey("Plz", "Okz"), Index("Id", IsUnique = true)]
|
||||||
|
public class AT_Plz
|
||||||
|
{
|
||||||
|
[Column("plz")]
|
||||||
|
public int Plz { get; set; }
|
||||||
|
|
||||||
|
[Column("okz")]
|
||||||
|
public int Okz { get; set; }
|
||||||
|
|
||||||
|
[Column("country")]
|
||||||
|
public String CountryCode { get; }
|
||||||
|
|
||||||
|
[Column("id")]
|
||||||
|
public String Id { get; }
|
||||||
|
|
||||||
|
[Column("dest")]
|
||||||
|
public String Dest { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("Okz")]
|
||||||
|
public virtual AT_Ort Ort { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("CountryCode")]
|
||||||
|
public virtual Country Country { get; set; }
|
||||||
|
|
||||||
|
public ISet<AT_Ort> Orte(WGContext ctx)
|
||||||
|
{
|
||||||
|
return ctx.Postleitzahlen.Where(p => p.Plz == Plz).Select(p => p.Ort).ToHashSet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace WGneu
|
namespace WGneu.Models
|
||||||
{
|
{
|
||||||
[Table("country"), PrimaryKey("Alpha2")]
|
[Table("country"), PrimaryKey("Alpha2")]
|
||||||
public class Country
|
public class Country
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace WGneu
|
namespace WGneu.Models
|
||||||
{
|
{
|
||||||
// 1 °KMW =
|
// 1 °KMW =
|
||||||
// 1 °NM = kg/100L = 10g/L
|
// 1 °NM = kg/100L = 10g/L
|
||||||
|
@ -6,7 +6,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace WGneu
|
namespace WGneu.Models
|
||||||
{
|
{
|
||||||
[Table("member"), PrimaryKey("MgNr")]
|
[Table("member"), PrimaryKey("MgNr")]
|
||||||
public class Member
|
public class Member
|
||||||
@ -19,5 +19,29 @@ namespace WGneu
|
|||||||
|
|
||||||
[Column("family_name")]
|
[Column("family_name")]
|
||||||
public String FamilyName { get; set; }
|
public String FamilyName { get; set; }
|
||||||
|
|
||||||
|
[Column("zwstid")]
|
||||||
|
public String Zweigstelle { get; set; }
|
||||||
|
|
||||||
|
[Column("country")]
|
||||||
|
public String CountryCode { get; set; }
|
||||||
|
|
||||||
|
[Column("postal_dest")]
|
||||||
|
public String PostalDestId { get; set; }
|
||||||
|
|
||||||
|
[Column("address")]
|
||||||
|
public String Address { get; set; }
|
||||||
|
|
||||||
|
[Column("default_kgnr")]
|
||||||
|
public int DefaultKgNr { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("CountryCode")]
|
||||||
|
public virtual Country Country { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("CountryCode, PostalDestId")]
|
||||||
|
public virtual PostalDest PostalDest { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("DefaultKgNr")]
|
||||||
|
public virtual AT_Kg DefaultKg { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
WGneu/Models/PostalDest.cs
Normal file
29
WGneu/Models/PostalDest.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
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.Models
|
||||||
|
{
|
||||||
|
[Table("postal_dest"), PrimaryKey("CountryCode", "Id")]
|
||||||
|
public class PostalDest
|
||||||
|
{
|
||||||
|
[Column("country")]
|
||||||
|
public String CountryCode { get; set; }
|
||||||
|
|
||||||
|
[Column("id")]
|
||||||
|
public String Id { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("CountryCode")]
|
||||||
|
public virtual Country Country { get; set; }
|
||||||
|
|
||||||
|
public AT_Plz? Plz(WGContext ctx)
|
||||||
|
{
|
||||||
|
if (CountryCode != "AT") return null;
|
||||||
|
return ctx.Postleitzahlen.Where(p => p.Id == Id).FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using WGneu.Models;
|
||||||
|
|
||||||
namespace WGneu
|
namespace WGneu
|
||||||
{
|
{
|
||||||
@ -11,10 +12,15 @@ namespace WGneu
|
|||||||
{
|
{
|
||||||
public DbSet<Country> Countries { get; set; }
|
public DbSet<Country> Countries { get; set; }
|
||||||
public DbSet<Member> Members { get; set; }
|
public DbSet<Member> Members { get; set; }
|
||||||
|
public DbSet<AT_Gem> Gemeinden { get; set; }
|
||||||
|
public DbSet<AT_Kg> Katastralgemeinden { get; set; }
|
||||||
|
public DbSet<AT_Ort> Orte { get; set; }
|
||||||
|
public DbSet<AT_Plz> Postleitzahlen { get; set; }
|
||||||
|
public DbSet<PostalDest> PostalDestinations { 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\\tom\\Projects\\wgneu\\wgtest.sqlite3\"; foreign keys=true");
|
||||||
optionsBuilder.UseLazyLoadingProxies();
|
optionsBuilder.UseLazyLoadingProxies();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="7.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.3" />
|
||||||
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
|
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -10,6 +10,12 @@
|
|||||||
<Compile Update="BankDetailsWindow.xaml.cs">
|
<Compile Update="BankDetailsWindow.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="MemberAddWindow.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="MemberEditWindow.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="MemberListWindow.xaml.cs">
|
<Compile Update="MemberListWindow.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -21,6 +27,12 @@
|
|||||||
<Page Update="MainWindow.xaml">
|
<Page Update="MainWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="MemberAddWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="MemberEditWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="MemberListWindow.xaml">
|
<Page Update="MemberListWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
Reference in New Issue
Block a user