Daten können hinzugefügt

This commit is contained in:
Husky
2020-02-20 21:32:36 +01:00
parent 10ea0783e7
commit 954ffb4bc8
34 changed files with 861 additions and 715 deletions

View File

@@ -0,0 +1,25 @@
<Window x:Class="KanSan.UI.WindowBaustelleEdit"
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:KanSan.UI"
mc:Ignorable="d"
Title="FRMBaustelle" Height="450" Width="800" Closed="Window_Closed">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label>Ort</Label>
<Label Grid.Row="1">Strasse</Label>
<TextBox Grid.Column="1" Name="Ort" Text="{Binding Ort}"/>
<TextBox Grid.Column="1" Name="Strasse" Grid.Row="1" Text="{Binding Strasse}" />
</Grid>
</Window>

View File

@@ -0,0 +1,62 @@
using KanSan.Base;
using KanSan.Base.Models;
using KanSan.ViewModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
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 KanSan.UI
{
/// <summary>
/// Interaktionslogik für FRMBaustelle.xaml
/// </summary>
public partial class WindowBaustelleEdit : Window
{
private UnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
private Baustelle bs = null;
public WindowBaustelleEdit(Baustelle baustelle)
{
InitializeComponent();
if (baustelle == null) throw new ArgumentNullException("baustelle");
bs = baustelle;
BaustelleViewModel model = new BaustelleViewModel(bs);
model.PropertyChanged += Model_PropertyChanged;
this.DataContext = model;
}
private void Model_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
BaustelleViewModel baustelleViewModel = (BaustelleViewModel)sender;
bs.Ort = baustelleViewModel.Ort;
bs.Projektnummer = baustelleViewModel.Projektnummer;
bs.Strasse = baustelleViewModel.Strasse;
unitOfWork.BaustellenRepository.Update(bs);
//Debugger.Break();
}
private void Window_Closed(object sender, EventArgs e)
{
unitOfWork.Commit();
}
}
}

View File

@@ -0,0 +1,34 @@
<UserControl x:Class="KanSan.UI.UCKundeEdit"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:KanSan.UI"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0">Vorname</Label>
<Label Grid.Column="0" Grid.Row="1">Nachname</Label>
<Label Grid.Column="0" Grid.Row="2">Strasse</Label>
<Label Grid.Column="0" Grid.Row="3">Plz</Label>
<Label Grid.Column="0" Grid.Row="4">Ort</Label>
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Vorname}" />
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Nachname}" />
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Strasse}" />
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding PLZ}" />
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding Ort}" />
</Grid>
</UserControl>

View File

@@ -0,0 +1,44 @@
using KanSan.Base;
using KanSan.Base.Models;
using KanSan.ViewModel;
using System;
using System.Collections.Generic;
using System.Text;
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.Navigation;
using System.Windows.Shapes;
namespace KanSan.UI
{
/// <summary>
/// Interaktionslogik für UCKundeEdit.xaml
/// </summary>
public partial class UCKundeEdit : UserControl
{
private Kunde kunde = null;
private UnitOfWork unitOfWork = null;
public UCKundeEdit(Kunde kunde)
{
InitializeComponent();
this.kunde = kunde;
unitOfWork = new UnitOfWork(new KanSanContext());
KundeViewModel kundeViewModel = new KundeViewModel(kunde);
kundeViewModel.PropertyChanged += KundeViewModel_PropertyChanged;
this.DataContext = kundeViewModel;
}
private void KundeViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
throw new NotImplementedException();
}
}
}