Freistellungen via API
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0-maccatalyst;net8.0-android</TargetFrameworks>
|
||||
<TargetFrameworks>net8.0-maccatalyst;net8.0-android34.0</TargetFrameworks>
|
||||
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
|
||||
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
|
||||
|
||||
@@ -44,11 +44,13 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-maccatalyst|AnyCPU'">
|
||||
<Optimize>True</Optimize>
|
||||
<ApplicationId>com.danielpichler.jugenddienststunden</ApplicationId>
|
||||
<ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-maccatalyst|AnyCPU'">
|
||||
<Optimize>True</Optimize>
|
||||
<ApplicationId>com.danielpichler.jugenddienststunden</ApplicationId>
|
||||
<ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android34.0|AnyCPU'">
|
||||
@@ -56,6 +58,8 @@
|
||||
<ApplicationId>com.danielpichler.jugenddienststunden</ApplicationId>
|
||||
<Debugger>Xamarin</Debugger>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
|
||||
<ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -65,24 +69,44 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.26100.0|AnyCPU'">
|
||||
<ApplicationId>com.danielpichler.jugenddienststunden</ApplicationId>
|
||||
<Optimize>True</Optimize>
|
||||
<ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android34.0|AnyCPU'">
|
||||
<ApplicationId>com.danielpichler.jugenddienststunden</ApplicationId>
|
||||
<Debugger>Xamarin</Debugger>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
|
||||
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
|
||||
<RunAOTCompilation>False</RunAOTCompilation>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-windows10.0.26100.0|AnyCPU'">
|
||||
<ApplicationId>com.danielpichler.jugenddienststunden</ApplicationId>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.26100.0</TargetFrameworks>
|
||||
<Optimize>True</Optimize>
|
||||
<ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
|
||||
<Optimize>True</Optimize>
|
||||
<Debugger>Xamarin</Debugger>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<AndroidEnableProfiledAot>False</AndroidEnableProfiledAot>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PublishAot>False</PublishAot>
|
||||
<IncludeSymbols>False</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<Debugger>Xamarin</Debugger>
|
||||
<Optimize>True</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.26100.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace Jugenddienst_Stunden.Models {
|
||||
//public static string surname = Preferences.Default.Get("surname", "Weger");
|
||||
|
||||
//Christine Feichter
|
||||
public static string apiKey = Preferences.Default.Get("apiKey", "MTQzfEFlMVRjQXdZMnI4RmpxZ0FSY3A0VEN2bVZYVXxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=");
|
||||
public static int EmployeeId = Preferences.Default.Get("employeeId", 0);
|
||||
public static string apiKey = Preferences.Default.Get("apiKey", "M3xraUdoSktrdGowaUZoaStJbDJLWmIyTFhYeDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp");
|
||||
public static int EmployeeId = Preferences.Default.Get("employeeId", 3);
|
||||
public static string name = Preferences.Default.Get("name", "Vorname");
|
||||
public static string surname = Preferences.Default.Get("surname", "Nachname");
|
||||
public static string apiUrl = Preferences.Default.Get("apiUrl", "https://");
|
||||
@@ -40,12 +40,6 @@ namespace Jugenddienst_Stunden.Models {
|
||||
|
||||
public static async Task<Hours> LoadData() {
|
||||
|
||||
//Temporär fix für virtuelle App
|
||||
|
||||
//apiKey = "NXw5eFF0RVQ5TFBMTXFVeFIzQURtd01idHFUb2d8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Johannes Fink
|
||||
//apiKey = "M3xraUdoSktrdGowaUZoaStJbDJLWmIyTFhYeDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Lea Mair
|
||||
//apiKey = "Mnx6amdpUkFCdWMvc0lmZ3dWeXRVSWx3VGRDRDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Daniel Pichler
|
||||
|
||||
|
||||
Hours hours = new Hours();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Jugenddienst_Stunden.Types {
|
||||
public TimeSpan TimeSpanBis { get; set; }
|
||||
public Collection<Projekt> Projekte { get; set; }
|
||||
public Collection<Gemeinde> Gemeinden { get; set; }
|
||||
public Collection<Freistellung> Freistellungen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the active Gemeinde based on the gemeinde ID.
|
||||
@@ -35,5 +36,7 @@ namespace Jugenddienst_Stunden.Types {
|
||||
/// Gets the active Projekt based on the projekt ID.
|
||||
/// </summary>
|
||||
public Projekt ProjektAktiv { get; set; }
|
||||
|
||||
public Freistellung FreistellungAktiv { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
12
Jugenddienst Stunden/Types/Freistellung.cs
Normal file
12
Jugenddienst Stunden/Types/Freistellung.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types {
|
||||
public class Freistellung {
|
||||
public string Identifier { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ namespace Jugenddienst_Stunden.Types
|
||||
public DateTime MaxDate;
|
||||
public Collection<Projekt> Projekte { get; set; }
|
||||
public Collection<Gemeinde> Gemeinden { get; set; }
|
||||
public Collection<Freistellung> Freistellungen { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -24,10 +24,15 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
|
||||
|
||||
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; }
|
||||
public ObservableCollection<string> OptionsFreistellung { get; }
|
||||
public ObservableCollection<Freistellung> OptionsFreistellung { get; private set; }
|
||||
|
||||
//private Gemeinde _selectedGemeinde;
|
||||
public Gemeinde SelectedOptionGemeinde {
|
||||
@@ -53,21 +58,19 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
}
|
||||
}
|
||||
|
||||
private string selectedFreistellung;
|
||||
public string SelectedOptionFreistellung {
|
||||
get => selectedFreistellung;
|
||||
//private string selectedFreistellung;
|
||||
public Freistellung SelectedOptionFreistellung {
|
||||
get => _stunde.FreistellungAktiv;
|
||||
set {
|
||||
if (selectedFreistellung != value) {
|
||||
selectedFreistellung = value;
|
||||
if (_stunde.FreistellungAktiv != value) {
|
||||
_stunde.FreistellungAktiv = value;
|
||||
OnPropertyChanged(nameof(SelectedOptionFreistellung));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Collection<Projekt> Projekte { get; set; }
|
||||
public Collection<Gemeinde> Gemeinden { get; set; }
|
||||
|
||||
|
||||
|
||||
public ICommand SaveCommand { get; private set; }
|
||||
public ICommand DeleteCommand { get; private set; }
|
||||
@@ -76,20 +79,11 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
|
||||
public StundeViewModel() {
|
||||
_stunde = new DayTime();
|
||||
//_stunde.EmployeeId = Preferences.Default.Get("employeeId", 0);
|
||||
|
||||
//LoadDataCommand = new AsyncRelayCommand(LoadData);
|
||||
|
||||
|
||||
SaveCommand = new AsyncRelayCommand(Save);
|
||||
DeleteCommand = new AsyncRelayCommand(Delete);
|
||||
|
||||
OptionsFreistellung = new ObservableCollection<string> {
|
||||
"Keine",
|
||||
"Urlaub",
|
||||
"Krankheit",
|
||||
"Elternzeit"
|
||||
};
|
||||
|
||||
_ = LoadData();
|
||||
}
|
||||
@@ -106,8 +100,10 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
Hours _hours = await Models.Stunde.LoadBasicData();
|
||||
OptionsProjekt = new ObservableCollection<Projekt>(_hours.Projekte);
|
||||
OptionsGemeinde = new ObservableCollection<Gemeinde>(_hours.Gemeinden);
|
||||
OptionsFreistellung = new ObservableCollection<Freistellung>(_hours.Freistellungen);
|
||||
OnPropertyChanged(nameof(OptionsGemeinde));
|
||||
OnPropertyChanged(nameof(OptionsProjekt));
|
||||
OnPropertyChanged(nameof(OptionsFreistellung));
|
||||
_stunde.EmployeeId = _hours.EmployeeId;
|
||||
} catch (Exception e) {
|
||||
AlertEvent?.Invoke(this, e.Message);
|
||||
@@ -143,18 +139,22 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
|
||||
OptionsProjekt = new ObservableCollection<Projekt>(_stunde.Projekte);
|
||||
OptionsGemeinde = new ObservableCollection<Gemeinde>(_stunde.Gemeinden);
|
||||
OptionsFreistellung = new ObservableCollection<Freistellung>(_stunde.Freistellungen);
|
||||
OnPropertyChanged(nameof(OptionsGemeinde));
|
||||
OnPropertyChanged(nameof(OptionsProjekt));
|
||||
OnPropertyChanged(nameof(OptionsFreistellung));
|
||||
|
||||
//OptionsProjekt.FirstOrDefault(x => x.Id == _stunde.projekt);
|
||||
|
||||
SelectedOptionGemeinde = OptionsGemeinde.FirstOrDefault(item => item.Id == _stunde.gemeinde) ?? new Gemeinde();
|
||||
OnPropertyChanged(nameof(SelectedOptionGemeinde));
|
||||
|
||||
|
||||
SelectedOptionProjekt = OptionsProjekt.FirstOrDefault(Projekt => Projekt.Id == _stunde.projekt) ?? new Projekt();
|
||||
OnPropertyChanged(nameof(SelectedOptionProjekt));
|
||||
|
||||
SelectedOptionFreistellung = OptionsFreistellung.FirstOrDefault(Freistellung => Freistellung.Identifier == _stunde.free) ?? new Freistellung();
|
||||
OnPropertyChanged(nameof(SelectedOptionFreistellung));
|
||||
|
||||
OnPropertyChanged(nameof(Stunde));
|
||||
OnPropertyChanged(nameof(SubTitle));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user