Ausgewählte Leistung wird in tätigkeit dargestellt
This commit is contained in:
@@ -4,27 +4,44 @@ using KanSan.Base.Interfaces.UI;
|
|||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class LeistungsverzeichnisPositionenListViewModel : ILeistungsverzeichnisPositionListViewModel
|
public class LeistungsverzeichnisPositionenListViewModel :PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
List<LeistungsverzeichnisPosition> lvPositionen;
|
List<LeistungsverzeichnisPosition> lvPositionen;
|
||||||
public List<LeistungsverzeichnisPosition> LVPositionen => lvPositionen;
|
public List<LeistungsverzeichnisPosition> LVPositionen
|
||||||
|
{
|
||||||
|
get => lvPositionen;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (lvPositionen == value) return;
|
||||||
|
lvPositionen = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string tag;
|
||||||
public LeistungsverzeichnisPositionenListViewModel(string tag)
|
public LeistungsverzeichnisPositionenListViewModel(string tag)
|
||||||
{
|
{
|
||||||
if(tag == string.Empty)
|
this.tag = tag;
|
||||||
|
LoadLVPositionen();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadLVPositionen()
|
||||||
|
{
|
||||||
|
if (tag == string.Empty)
|
||||||
{
|
{
|
||||||
lvPositionen = unitOfWork.LeistungsverzeichnisRepository.Get().ToList();
|
LVPositionen = unitOfWork.LeistungsverzeichnisRepository.Get().ToList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lvPositionen = unitOfWork.LeistungsverzeichnisRepository.Get(x => x.Tag.Equals(tag)).ToList();
|
LVPositionen = unitOfWork.LeistungsverzeichnisRepository.Get(x => x.Tag.Equals(tag)).ToList();
|
||||||
if (lvPositionen == null) lvPositionen = new List<LeistungsverzeichnisPosition>();
|
if (LVPositionen == null) LVPositionen = new List<LeistungsverzeichnisPosition>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +58,7 @@ namespace KanSan.ViewModel
|
|||||||
};
|
};
|
||||||
unitOfWork.LeistungsverzeichnisRepository.Insert(leistungsverzeichnisPosition);
|
unitOfWork.LeistungsverzeichnisRepository.Insert(leistungsverzeichnisPosition);
|
||||||
unitOfWork.Commit();
|
unitOfWork.Commit();
|
||||||
|
LoadLVPositionen();
|
||||||
return leistungsverzeichnisPosition;
|
return leistungsverzeichnisPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,11 @@ namespace KanSan.ViewModel
|
|||||||
lvPositionen = new List<LeistungsverzeichnisPosition>();
|
lvPositionen = new List<LeistungsverzeichnisPosition>();
|
||||||
foreach(BaustelleLeistungsverzeichnisReferenz referenz in baustelleLeistungsverzeichnis)
|
foreach(BaustelleLeistungsverzeichnisReferenz referenz in baustelleLeistungsverzeichnis)
|
||||||
{
|
{
|
||||||
|
if(model.LeistungsverzeichnisPosition.GuidNr.Equals(referenz.LVPosition.GuidNr))
|
||||||
|
{
|
||||||
|
leistungsverzeichnis = referenz.LVPosition;
|
||||||
|
}
|
||||||
|
Trace.WriteLine(referenz.LVPosition.Equals(model.LeistungsverzeichnisPosition));
|
||||||
lvPositionen.Add(referenz.LVPosition);
|
lvPositionen.Add(referenz.LVPosition);
|
||||||
}
|
}
|
||||||
var x = LVPositionen.Equals(leistungsverzeichnis);
|
var x = LVPositionen.Equals(leistungsverzeichnis);
|
||||||
|
|||||||
@@ -182,9 +182,17 @@ namespace KanSan
|
|||||||
{
|
{
|
||||||
|
|
||||||
UI.UCLeistungsverzeichnisPosition uCLeistungsverzeichnisPosition = new UI.UCLeistungsverzeichnisPosition(e.LeistungsverzeichnisPosition);
|
UI.UCLeistungsverzeichnisPosition uCLeistungsverzeichnisPosition = new UI.UCLeistungsverzeichnisPosition(e.LeistungsverzeichnisPosition);
|
||||||
|
uCLeistungsverzeichnisPosition.SpeichernClicked += UCLeistungsverzeichnisPosition_SpeichernClicked;
|
||||||
ContentController.Content = uCLeistungsverzeichnisPosition;
|
ContentController.Content = uCLeistungsverzeichnisPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UCLeistungsverzeichnisPosition_SpeichernClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UCLeistungsverzeichnisPosList = new UI.UCLeistungsverzeichnisPosList();
|
||||||
|
UCLeistungsverzeichnisPosList.LeistungsverzeichnisEdited += UCLeistungsverzeichnisPosList_LeistungsverzeichnisEdited;
|
||||||
|
ContentController.Content = UCLeistungsverzeichnisPosList;
|
||||||
|
}
|
||||||
|
|
||||||
private void rbLeistungsverzeichnisBaustellen_Checked(object sender, RoutedEventArgs e)
|
private void rbLeistungsverzeichnisBaustellen_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
rbBaustellen.IsChecked = false;
|
rbBaustellen.IsChecked = false;
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCLeistungsverzeichnisPosition : UserControl
|
public partial class UCLeistungsverzeichnisPosition : UserControl
|
||||||
{
|
{
|
||||||
|
public event EventHandler SpeichernClicked;
|
||||||
|
|
||||||
|
protected virtual void OnSpeichernClicked(EventArgs e)
|
||||||
|
{
|
||||||
|
EventHandler handler = SpeichernClicked;
|
||||||
|
if (handler != null)
|
||||||
|
handler(this, e);
|
||||||
|
}
|
||||||
public UCLeistungsverzeichnisPosition(LeistungsverzeichnisPosition leistungsverzeichnisPosition)
|
public UCLeistungsverzeichnisPosition(LeistungsverzeichnisPosition leistungsverzeichnisPosition)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -30,6 +38,7 @@ namespace KanSan.UI
|
|||||||
private void Save_Click(object sender, RoutedEventArgs e)
|
private void Save_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
(DataContext as LeistungsverzeichnisPositionViewModel).Speichern();
|
(DataContext as LeistungsverzeichnisPositionViewModel).Speichern();
|
||||||
|
OnSpeichernClicked(EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,12 +50,12 @@
|
|||||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Mitarbeiter}" />
|
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Mitarbeiter}" />
|
||||||
|
|
||||||
<Calendar Style="{StaticResource DefaultCalendar}" Grid.Row="2" Grid.Column="1" Name="Calender" SelectedDate="{Binding ZeitStempel}" Margin="-220,0,0,0"/>
|
<Calendar Style="{StaticResource DefaultCalendar}" Grid.Row="2" Grid.Column="1" Name="Calender" SelectedDate="{Binding ZeitStempel}" Margin="-220,0,0,0"/>
|
||||||
<ComboBox Grid.Row="3" Grid.Column="1" ItemsSource="{Binding LVPositionen}" SelectedItem="{Binding Leistungsverzeichnis}" IsSynchronizedWithCurrentItem="True">
|
<ComboBox Grid.Row="3" Grid.Column="1" ItemsSource="{Binding LVPositionen}" DisplayMemberPath="Beschreibung" SelectedValuePath="Beschreibung" SelectedItem="{Binding Leistungsverzeichnis, Mode=TwoWay}">
|
||||||
<ComboBox.ItemTemplate>
|
<!--<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Beschreibung}" />
|
<TextBlock Text="{Binding Beschreibung}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>-->
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Anzahl}" />
|
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Anzahl}" />
|
||||||
|
|||||||
Reference in New Issue
Block a user