diff --git a/KanSan.ViewModel/LeistungsverzeichnisPositionViewModel.cs b/KanSan.ViewModel/LeistungsverzeichnisPositionViewModel.cs
new file mode 100644
index 0000000..ee1d52a
--- /dev/null
+++ b/KanSan.ViewModel/LeistungsverzeichnisPositionViewModel.cs
@@ -0,0 +1,84 @@
+using KanSan.Base;
+using KanSan.Base.Interfaces;
+using KanSan.Base.Interfaces.UI;
+using KanSan.Base.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Text;
+
+namespace KanSan.ViewModel
+{
+ public class LeistungsverzeichnisPositionViewModel : PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionViewModel
+ {
+ IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
+
+ LeistungsverzeichnisPosition model;
+ string positionsnummer;
+ string beschreibung;
+ string einheit;
+ string tag;
+
+ public string Positionsnummer
+ {
+ get => positionsnummer;
+ set
+ {
+ if (positionsnummer == value) return;
+ positionsnummer = value;
+ OnPropertyChanged();
+ }
+ }
+ public string Beschreibung
+ {
+ get => beschreibung;
+ set
+ {
+ if (beschreibung == value) return;
+ beschreibung = value;
+ OnPropertyChanged();
+ }
+ }
+ public string Einheit
+ {
+ get => einheit;
+ set
+ {
+ if (einheit == value) return;
+ einheit = value;
+ OnPropertyChanged();
+ }
+ }
+ public string Tag
+ {
+ get => tag;
+ set
+ {
+ if (tag == value) return;
+ tag = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public LeistungsverzeichnisPositionViewModel(LeistungsverzeichnisPosition position)
+ {
+ this.model = position;
+ positionsnummer = model.Positionsnummer;
+ beschreibung = model.Beschreibung;
+ einheit = model.Einheit;
+ tag = model.Tag;
+ }
+
+ public void Speichern()
+ {
+ model.Positionsnummer = positionsnummer;
+ model.Beschreibung = beschreibung;
+ model.Einheit = einheit;
+ model.Tag = tag;
+
+ unitOfWork.LeistungsverzeichnisRepository.Update(model);
+ unitOfWork.Commit();
+ }
+
+ }
+}
diff --git a/KanSan/MainWindow.xaml.cs b/KanSan/MainWindow.xaml.cs
index e6b74bc..73b2e17 100644
--- a/KanSan/MainWindow.xaml.cs
+++ b/KanSan/MainWindow.xaml.cs
@@ -123,6 +123,8 @@ namespace KanSan
private void rbKunden_Checked(object sender, RoutedEventArgs e)
{
+ rbLeistungsverzeichnis.IsChecked = false;
+ rbLeistungsverzeichnisBaustellen.IsChecked = false;
UCKundeList = new UI.UCKundeList();
UCKundeList.KundeAdded += UCKundeList_KundeAdded;
UCKundeList.KundeSelect += UCKundeList_KundeSelect;
@@ -131,6 +133,8 @@ namespace KanSan
private void rbProjekte_Checked(object sender, RoutedEventArgs e)
{
+ rbLeistungsverzeichnis.IsChecked = false;
+ rbLeistungsverzeichnisBaustellen.IsChecked = false;
Kunde client = (DataContext as MainWindowViewModel).SelectedKunde;
if (client == null) return;
UCProjektList = new UI.UCProjektList(client);
@@ -142,6 +146,8 @@ namespace KanSan
private void rbBaustellen_Checked(object sender, RoutedEventArgs e)
{
+ rbLeistungsverzeichnis.IsChecked = false;
+ rbLeistungsverzeichnisBaustellen.IsChecked = false;
Projekt projekt = (DataContext as MainWindowViewModel).SelectedProjekt;
if (projekt == null) return;
UCBaustelleList = new UI.UCBaustelleList(projekt);
@@ -153,6 +159,8 @@ namespace KanSan
private void rbObjekte_Checked(object sender, RoutedEventArgs e)
{
+ rbLeistungsverzeichnis.IsChecked = false;
+ rbLeistungsverzeichnisBaustellen.IsChecked = false;
rbObjekte.IsChecked = true;
UI.UCObjekteList uCObjekteList = new UI.UCObjekteList((DataContext as MainWindowViewModel).SelectedBaustelle);
uCObjekteList.ObjektSelected += UCObjekteList_ObjektSelected;
@@ -161,12 +169,28 @@ namespace KanSan
private void rbLeistungsverzeichnis_Checked(object sender, RoutedEventArgs e)
{
+ rbBaustellen.IsChecked = false;
+ rbKunden.IsChecked = false;
+ rbObjekte.IsChecked = false;
+ rbProjekte.IsChecked = false;
UCLeistungsverzeichnisPosList = new UI.UCLeistungsverzeichnisPosList();
+ UCLeistungsverzeichnisPosList.LeistungsverzeichnisEdited += UCLeistungsverzeichnisPosList_LeistungsverzeichnisEdited;
ContentController.Content = UCLeistungsverzeichnisPosList;
}
+ private void UCLeistungsverzeichnisPosList_LeistungsverzeichnisEdited(object sender, UI.SelectedLeistungsverzeichnisEventArgs e)
+ {
+
+ UI.UCLeistungsverzeichnisPosition uCLeistungsverzeichnisPosition = new UI.UCLeistungsverzeichnisPosition(e.LeistungsverzeichnisPosition);
+ ContentController.Content = uCLeistungsverzeichnisPosition;
+ }
+
private void rbLeistungsverzeichnisBaustellen_Checked(object sender, RoutedEventArgs e)
{
+ rbBaustellen.IsChecked = false;
+ rbKunden.IsChecked = false;
+ rbObjekte.IsChecked = false;
+ rbProjekte.IsChecked = false;
UCLeistungsverzeichnisPositionenBaustelle = new UI.UCLeistungsverzeichnisPositionenBaustelle();
ContentController.Content = UCLeistungsverzeichnisPositionenBaustelle;
}
diff --git a/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosList.xaml b/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosList.xaml
index 0e57481..1b77301 100644
--- a/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosList.xaml
+++ b/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosList.xaml
@@ -15,7 +15,7 @@
-
+
@@ -23,6 +23,15 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosList.xaml.cs b/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosList.xaml.cs
index 2609f71..2e150b1 100644
--- a/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosList.xaml.cs
+++ b/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosList.xaml.cs
@@ -1,6 +1,8 @@
-using KanSan.ViewModel;
+using KanSan.Base.Models;
+using KanSan.ViewModel;
using System;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@@ -19,6 +21,7 @@ namespace KanSan.UI
///
public partial class UCLeistungsverzeichnisPosList : UserControl
{
+ public event EventHandler LeistungsverzeichnisEdited;
public UCLeistungsverzeichnisPosList()
{
InitializeComponent();
@@ -29,5 +32,28 @@ namespace KanSan.UI
{
(DataContext as LeistungsverzeichnisPositionenListViewModel).NeueLeistungsverzeichnisPosition();
}
+
+ private void EditLVPosition_Click(object sender, RoutedEventArgs e)
+ {
+ LeistungsverzeichnisPosition pos = (dgLeistungsverzeichnis.SelectedItem as LeistungsverzeichnisPosition);
+ if (pos == null) return;
+ OnClickLeistungsverzeichnisEdit(new SelectedLeistungsverzeichnisEventArgs()
+ {
+ LeistungsverzeichnisPosition = pos
+ });
+
+ }
+
+ protected virtual void OnClickLeistungsverzeichnisEdit(SelectedLeistungsverzeichnisEventArgs e)
+ {
+ EventHandler handler = LeistungsverzeichnisEdited;
+ if (handler != null)
+ handler(this, e);
+ }
+ }
+
+ public class SelectedLeistungsverzeichnisEventArgs : EventArgs
+ {
+ public LeistungsverzeichnisPosition LeistungsverzeichnisPosition { get; set; }
}
}
diff --git a/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosition.xaml b/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosition.xaml
index 3617fec..f7bf938 100644
--- a/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosition.xaml
+++ b/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosition.xaml
@@ -33,6 +33,6 @@
-
+
diff --git a/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosition.xaml.cs b/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosition.xaml.cs
index 1b94462..87c248a 100644
--- a/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosition.xaml.cs
+++ b/KanSan/UI/Leistungsverzeichnis/UCLeistungsverzeichnisPosition.xaml.cs
@@ -1,4 +1,6 @@
-using System;
+using KanSan.Base.Models;
+using KanSan.ViewModel;
+using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
@@ -18,9 +20,16 @@ namespace KanSan.UI
///
public partial class UCLeistungsverzeichnisPosition : UserControl
{
- public UCLeistungsverzeichnisPosition()
+ public UCLeistungsverzeichnisPosition(LeistungsverzeichnisPosition leistungsverzeichnisPosition)
{
InitializeComponent();
+ this.DataContext = new LeistungsverzeichnisPositionViewModel(leistungsverzeichnisPosition);
+
+ }
+
+ private void Save_Click(object sender, RoutedEventArgs e)
+ {
+ (DataContext as LeistungsverzeichnisPositionViewModel).Speichern();
}
}
}
diff --git a/KanSan/UI/SanMaßnahmen/UCTaetigkeitEdit.xaml b/KanSan/UI/SanMaßnahmen/UCTaetigkeitEdit.xaml
index f2fe601..d238639 100644
--- a/KanSan/UI/SanMaßnahmen/UCTaetigkeitEdit.xaml
+++ b/KanSan/UI/SanMaßnahmen/UCTaetigkeitEdit.xaml
@@ -18,7 +18,7 @@
-
+
@@ -49,8 +49,8 @@
-
-
+
+