Get Freistellung to work

This commit is contained in:
2024-09-27 10:36:35 +02:00
parent abe659ae31
commit ec7f563bc0
11 changed files with 36 additions and 23 deletions

View File

@@ -22,13 +22,9 @@ namespace Jugenddienst_Stunden.ViewModels {
public DayTime Stunde { get => _stunde; }
public event EventHandler<string> AlertEvent;
public event EventHandler<string> InfoEvent;
public Collection<Projekt> Projekte { get; set; }
public Collection<Gemeinde> Gemeinden { get; set; }
public Collection<Freistellung> Freistellungen { get; set; }
public ObservableCollection<Gemeinde> OptionsGemeinde { get; private set; }
public ObservableCollection<Projekt> OptionsProjekt { get; private set; }
@@ -58,7 +54,7 @@ namespace Jugenddienst_Stunden.ViewModels {
}
}
//private string selectedFreistellung;
//private Freistellung _selectedFreistellung;
public Freistellung SelectedOptionFreistellung {
get => _stunde.FreistellungAktiv;
set {
@@ -80,12 +76,10 @@ namespace Jugenddienst_Stunden.ViewModels {
public StundeViewModel() {
_stunde = new DayTime();
SaveCommand = new AsyncRelayCommand(Save);
DeleteCommand = new AsyncRelayCommand(Delete);
_ = LoadData();
}
public StundeViewModel(DayTime stunde) {
@@ -152,7 +146,7 @@ namespace Jugenddienst_Stunden.ViewModels {
SelectedOptionProjekt = OptionsProjekt.FirstOrDefault(Projekt => Projekt.Id == _stunde.projekt) ?? new Projekt();
OnPropertyChanged(nameof(SelectedOptionProjekt));
SelectedOptionFreistellung = OptionsFreistellung.FirstOrDefault(Freistellung => Freistellung.Identifier == _stunde.free) ?? new Freistellung();
SelectedOptionFreistellung = OptionsFreistellung.FirstOrDefault(Freistellung => Freistellung.Id == _stunde.free) ?? new Freistellung();
OnPropertyChanged(nameof(SelectedOptionFreistellung));
OnPropertyChanged(nameof(Stunde));
@@ -162,6 +156,7 @@ namespace Jugenddienst_Stunden.ViewModels {
if (query.ContainsKey("date")) {
SubTitle = DateTime.ParseExact((string)query["date"], "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture).ToString("dddd, d. MMM. yyyy");
_stunde.day = DateTime.ParseExact((string)query["date"], "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
_ = LoadData();
OnPropertyChanged(nameof(SubTitle));
}