1.0.4
This commit is contained in:
@@ -2,15 +2,50 @@
|
|||||||
|
|
||||||
namespace Jugenddienst_Stunden;
|
namespace Jugenddienst_Stunden;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die Hauptanwendungsklasse.
|
||||||
|
/// </summary>
|
||||||
public partial class App : Application {
|
public partial class App : Application {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialisiert eine neue Instanz der <see cref="App"/>-Klasse.
|
||||||
|
/// </summary>
|
||||||
public App() {
|
public App() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
MainPage = new AppShell();
|
//UnhandledException: Wird gefangen, wenn eine Ausnahme in einem beliebigen nicht verwalteten Thread außerhalb des individuellen Kontexts auftritt.
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += (sender, e) => {
|
||||||
|
if (e.ExceptionObject is Exception ex) {
|
||||||
|
HandleException(ex);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//UnobservedTaskException: Wird ausgelöst, wenn eine Ausnahme in einem asynchronen Task auftritt und nicht behandelt wird.
|
||||||
|
TaskScheduler.UnobservedTaskException += (sender, e) => {
|
||||||
|
HandleException(e.Exception);
|
||||||
|
e.SetObserved();
|
||||||
|
};
|
||||||
|
|
||||||
|
//Dispatcher: Hilft bei der Handhabung von UI-bezogenen Ausnahmen innerhalb des UI-Threads.
|
||||||
|
if (Current?.Dispatcher != null) {
|
||||||
|
Current.Dispatcher.Dispatch(async () => {
|
||||||
|
try {
|
||||||
|
// Anwendungscode hier
|
||||||
|
await Task.CompletedTask; // Dummy await to avoid CS1998
|
||||||
|
} catch (Exception ex) {
|
||||||
|
HandleException(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainPage = new AppShell();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleException(Exception ex) {
|
||||||
|
// Fehlerbehandlungscode
|
||||||
|
Console.WriteLine($"Globale Ausnahme: {ex?.Message}");
|
||||||
|
// Optional: Logging oder Benutzerbenachrichtigung
|
||||||
|
}
|
||||||
|
|
||||||
//protected override Window CreateWindow(IActivationState activationState) =>
|
//protected override Window CreateWindow(IActivationState activationState) =>
|
||||||
//new Window(new AppShell()) {
|
//new Window(new AppShell()) {
|
||||||
|
|||||||
@@ -45,15 +45,15 @@
|
|||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-maccatalyst|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-maccatalyst|AnyCPU'">
|
||||||
<ApplicationId>com.companyname.jugenddienststunden</ApplicationId>
|
<ApplicationId>com.companyname.jugenddienststunden</ApplicationId>
|
||||||
<ApplicationDisplayVersion>1.0.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-maccatalyst|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-maccatalyst|AnyCPU'">
|
||||||
<Optimize>True</Optimize>
|
<Optimize>True</Optimize>
|
||||||
<ApplicationId>com.companyname.jugenddienststunden</ApplicationId>
|
<ApplicationId>com.companyname.jugenddienststunden</ApplicationId>
|
||||||
<ApplicationDisplayVersion>1.0.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android34.0|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android34.0|AnyCPU'">
|
||||||
@@ -68,8 +68,8 @@
|
|||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.26100.0|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.26100.0|AnyCPU'">
|
||||||
<ApplicationId>com.companyname.jugenddienststunden</ApplicationId>
|
<ApplicationId>com.companyname.jugenddienststunden</ApplicationId>
|
||||||
<ApplicationDisplayVersion>1.0.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION</DefineConstants>
|
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -81,8 +81,8 @@
|
|||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-windows10.0.26100.0|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-windows10.0.26100.0|AnyCPU'">
|
||||||
<ApplicationId>com.companyname.jugenddienststunden</ApplicationId>
|
<ApplicationId>com.companyname.jugenddienststunden</ApplicationId>
|
||||||
<ApplicationDisplayVersion>1.0.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@@ -90,24 +90,24 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
|
||||||
<ApplicationDisplayVersion>1.0.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
|
||||||
<ApplicationDisplayVersion>1.0.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-windows10.0.19041.0|AnyCPU'">
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION</DefineConstants>
|
<DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION</DefineConstants>
|
||||||
<ApplicationDisplayVersion>1.0.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-windows10.0.19041.0|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-windows10.0.19041.0|AnyCPU'">
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
<ApplicationDisplayVersion>1.0.3</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using static System.Runtime.InteropServices.JavaScript.JSType;
|
|||||||
namespace Jugenddienst_Stunden.Models;
|
namespace Jugenddienst_Stunden.Models;
|
||||||
|
|
||||||
class Auth {
|
class Auth {
|
||||||
public static async Task<string> GetApiDataWithAuthAsync(string url, string token) {
|
public static async Task<string?> GetApiDataWithAuthAsync(string url, string token) {
|
||||||
// Erstellen eines HttpClient-Objekts
|
// Erstellen eines HttpClient-Objekts
|
||||||
using (HttpClient client = new HttpClient() { Timeout = TimeSpan.FromSeconds(15) }) {
|
using (HttpClient client = new HttpClient() { Timeout = TimeSpan.FromSeconds(15) }) {
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ class Auth {
|
|||||||
string json = JsonSerializer.Serialize<DayTime>(item);
|
string json = JsonSerializer.Serialize<DayTime>(item);
|
||||||
StringContent content = new StringContent(json, Encoding.UTF8, "application/json");
|
StringContent content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
HttpResponseMessage response = null;
|
HttpResponseMessage? response = null;
|
||||||
if (isNewItem)
|
if (isNewItem)
|
||||||
response = await client.PostAsync(url, content);
|
response = await client.PostAsync(url, content);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6,21 +6,21 @@ using System.Text;
|
|||||||
|
|
||||||
namespace Jugenddienst_Stunden.Models;
|
namespace Jugenddienst_Stunden.Models;
|
||||||
public class Operator : ObservableObject {
|
public class Operator : ObservableObject {
|
||||||
public string id;
|
public string? id;
|
||||||
public string name;
|
public string? name;
|
||||||
public string surname;
|
public string? surname;
|
||||||
public string email;
|
public string? email;
|
||||||
public string password;
|
public string? password;
|
||||||
public string lang;
|
public string? lang;
|
||||||
public string admin;
|
public string? admin;
|
||||||
public string aktiv;
|
public string? aktiv;
|
||||||
public string department;
|
public string? department;
|
||||||
public string department_name;
|
public string? department_name;
|
||||||
public string num;
|
public string? num;
|
||||||
public string year;
|
public string? year;
|
||||||
|
|
||||||
|
|
||||||
public event EventHandler<string> AlertEvent;
|
public event EventHandler<string>? AlertEvent;
|
||||||
|
|
||||||
public static async Task<Operator> LoadData(string apiKey) {
|
public static async Task<Operator> LoadData(string apiKey) {
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ internal class Stunde : ObservableObject {
|
|||||||
|
|
||||||
|
|
||||||
public static async Task<Hours> LoadData() {
|
public static async Task<Hours> LoadData() {
|
||||||
Preferences.Default.Set("apiKey", "NXw5NDdCcEdLMVNDZTRENmphWG02MjlyeFFDenN8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp");
|
////Preferences.Default.Set("apiKey", "NXw5NDdCcEdLMVNDZTRENmphWG02MjlyeFFDenN8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp");
|
||||||
Preferences.Default.Set("name", "Johannes");
|
//Preferences.Default.Set("apiKey", "NXw5NDdCcEdLMVNDZTRENmphWG02MjlyeFFDenN8aHR0cHM6Ly9zdHVuZGVuLmpkLWxhbmEtdGlzZW5zLml0L2FwcGFwaQ==");//Online
|
||||||
Preferences.Default.Set("surname", "Fink");
|
//Preferences.Default.Set("name", "Johannes");
|
||||||
Preferences.Default.Set("EmployeeId", 5);
|
//Preferences.Default.Set("surname", "Fink");
|
||||||
Preferences.Default.Set("apiUrl", "http://hours.dauni.mine.nu:81/appapi");
|
//Preferences.Default.Set("EmployeeId", 5);
|
||||||
|
////Preferences.Default.Set("apiUrl", "http://hours.dauni.mine.nu:81/appapi");
|
||||||
|
//Preferences.Default.Set("apiUrl", "https://stunden.jd-lana-tisens.it/appapi");
|
||||||
|
|
||||||
apiKey = Preferences.Default.Get("apiKey", "NXw5NDdCcEdLMVNDZTRENmphWG02MjlyeFFDenN8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp");
|
apiKey = Preferences.Default.Get("apiKey", "NXw5NDdCcEdLMVNDZTRENmphWG02MjlyeFFDenN8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp");
|
||||||
EmployeeId = Preferences.Default.Get("employeeId", 5);
|
EmployeeId = Preferences.Default.Get("employeeId", 5);
|
||||||
@@ -38,14 +40,15 @@ internal class Stunde : ObservableObject {
|
|||||||
Hours hours = new Hours();
|
Hours hours = new Hours();
|
||||||
|
|
||||||
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
||||||
await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
throw new Exception("Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.");
|
||||||
"Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
//await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
||||||
"OK");
|
// "Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
||||||
|
// "OK");
|
||||||
} else {
|
} else {
|
||||||
var tokendata = new TokenData(apiKey);
|
var tokendata = new TokenData(apiKey);
|
||||||
|
|
||||||
//string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey);
|
//string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey);
|
||||||
string data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?hours", tokendata.apiKey);
|
string? data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?hours", tokendata.apiKey);
|
||||||
|
|
||||||
if (data == "null") {
|
if (data == "null") {
|
||||||
throw new Exception("Keine Daten erhalten");
|
throw new Exception("Keine Daten erhalten");
|
||||||
@@ -54,7 +57,10 @@ internal class Stunde : ObservableObject {
|
|||||||
throw new Exception("Problem mit Token");
|
throw new Exception("Problem mit Token");
|
||||||
}
|
}
|
||||||
|
|
||||||
hours = JsonConvert.DeserializeObject<Hours>(data);
|
if (data == null) {
|
||||||
|
throw new Exception("Keine Daten erhalten");
|
||||||
|
}
|
||||||
|
hours = JsonConvert.DeserializeObject<Hours>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||||
|
|
||||||
}
|
}
|
||||||
return hours;
|
return hours;
|
||||||
@@ -70,13 +76,14 @@ internal class Stunde : ObservableObject {
|
|||||||
Hours hours = new Hours();
|
Hours hours = new Hours();
|
||||||
|
|
||||||
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
||||||
await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
throw new Exception("Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.");
|
||||||
"Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
//await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
||||||
"OK");
|
// "Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
||||||
|
// "OK");
|
||||||
} else {
|
} else {
|
||||||
var tokendata = new TokenData(apiKey);
|
var tokendata = new TokenData(apiKey);
|
||||||
|
|
||||||
string data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?basic", tokendata.apiKey);
|
string? data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?basic", tokendata.apiKey);
|
||||||
|
|
||||||
if (data == "null") {
|
if (data == "null") {
|
||||||
throw new Exception("Keine Daten erhalten");
|
throw new Exception("Keine Daten erhalten");
|
||||||
@@ -84,8 +91,10 @@ internal class Stunde : ObservableObject {
|
|||||||
if (data == "\"Lalala\"") {
|
if (data == "\"Lalala\"") {
|
||||||
throw new Exception("Problem mit Token");
|
throw new Exception("Problem mit Token");
|
||||||
}
|
}
|
||||||
|
if (data == null) {
|
||||||
hours = JsonConvert.DeserializeObject<Hours>(data);
|
throw new Exception("Keine Daten erhalten");
|
||||||
|
}
|
||||||
|
hours = JsonConvert.DeserializeObject<Hours>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||||
|
|
||||||
}
|
}
|
||||||
return hours;
|
return hours;
|
||||||
@@ -105,14 +114,15 @@ internal class Stunde : ObservableObject {
|
|||||||
List<DayTime> daytimes = new List<DayTime>();
|
List<DayTime> daytimes = new List<DayTime>();
|
||||||
|
|
||||||
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
||||||
await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
throw new Exception("Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.");
|
||||||
"Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
//await App.Current.MainPage.DisplayAlert("Keine Internetverbindung",
|
||||||
"OK");
|
// "Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",
|
||||||
|
// "OK");
|
||||||
} else {
|
} else {
|
||||||
var tokendata = new TokenData(apiKey);
|
var tokendata = new TokenData(apiKey);
|
||||||
|
|
||||||
//string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey);
|
//string data = await Auth.GetApiDataWithAuthAsync(requestUrl, apiKey);
|
||||||
string data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?date=" + date.ToString("yyyy-MM-dd"), tokendata.apiKey);
|
string? data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?date=" + date.ToString("yyyy-MM-dd"), tokendata.apiKey);
|
||||||
|
|
||||||
if (data == "null") {
|
if (data == "null") {
|
||||||
throw new Exception("Keine Daten für " + date.ToString("ddd. dd. MMM") + " erhalten");
|
throw new Exception("Keine Daten für " + date.ToString("ddd. dd. MMM") + " erhalten");
|
||||||
@@ -120,9 +130,11 @@ internal class Stunde : ObservableObject {
|
|||||||
if (data == "\"Lalala\"") {
|
if (data == "\"Lalala\"") {
|
||||||
throw new Exception("Problem mit Token");
|
throw new Exception("Problem mit Token");
|
||||||
}
|
}
|
||||||
|
if (data == null) {
|
||||||
|
throw new Exception("Keine Daten erhalten");
|
||||||
|
}
|
||||||
//daytimes = System.Text.Json.JsonSerializer.Deserialize<List<DayTime>>(data);
|
//daytimes = System.Text.Json.JsonSerializer.Deserialize<List<DayTime>>(data);
|
||||||
daytimes = JsonConvert.DeserializeObject<List<DayTime>>(data);
|
daytimes = JsonConvert.DeserializeObject<List<DayTime>>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -138,10 +150,14 @@ internal class Stunde : ObservableObject {
|
|||||||
public static async Task<DayTime> LoadEntry(int id) {
|
public static async Task<DayTime> LoadEntry(int id) {
|
||||||
|
|
||||||
var tokendata = new TokenData(apiKey);
|
var tokendata = new TokenData(apiKey);
|
||||||
var data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?id=" + id, tokendata.apiKey);
|
string? data = await Auth.GetApiDataWithAuthAsync(tokendata.url + "?id=" + id, tokendata.apiKey);
|
||||||
|
|
||||||
|
if (data == null) {
|
||||||
|
throw new Exception("Keine Daten erhalten");
|
||||||
|
}
|
||||||
|
|
||||||
//DayTime hours = Hours.daytime.Find(x => x.id == id);
|
//DayTime hours = Hours.daytime.Find(x => x.id == id);
|
||||||
DayTime hours = JsonConvert.DeserializeObject<DayTime>(data);
|
DayTime hours = JsonConvert.DeserializeObject<DayTime>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||||
hours.TimeSpanVon = hours.begin.ToTimeSpan();
|
hours.TimeSpanVon = hours.begin.ToTimeSpan();
|
||||||
hours.TimeSpanBis = hours.end.ToTimeSpan();
|
hours.TimeSpanBis = hours.end.ToTimeSpan();
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,5 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace Jugenddienst_Stunden.Types;
|
namespace Jugenddienst_Stunden.Types;
|
||||||
public class Base {
|
public class Base {
|
||||||
public Collection<Projekt> Projekte { get; set; }
|
public Collection<Projekt>? Projekte { get; set; }
|
||||||
public Collection<Gemeinde> Gemeinden { get; set; }
|
public Collection<Gemeinde>? Gemeinden { get; set; }
|
||||||
public Collection<Freistellung> Freistellungen { get; set; }
|
public Collection<Freistellung>? Freistellungen { get; set; }
|
||||||
public int EmployeeId { get; set; }
|
public int EmployeeId { get; set; }
|
||||||
|
|
||||||
public Hours Hours { get; set; }
|
public Hours Hours { get; set; }
|
||||||
|
|||||||
@@ -7,35 +7,38 @@ namespace Jugenddienst_Stunden.Types;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DayTime {
|
public class DayTime {
|
||||||
public int? id { get; set; }
|
public int? id { get; set; }
|
||||||
public int EmployeeId { get; set; }
|
public int? EmployeeId { get; set; }
|
||||||
public DateTime day { get; set; }
|
public DateTime day { get; set; }
|
||||||
public int wday { get; set; }
|
public int? wday { get; set; }
|
||||||
public TimeOnly begin { get; set; }
|
public TimeOnly begin { get; set; }
|
||||||
public TimeOnly end { get; set; }
|
public TimeOnly end { get; set; }
|
||||||
public string description { get; set; }
|
public string? description { get; set; }
|
||||||
public string? free { get; set; }
|
public string? free { get; set; }
|
||||||
public bool? approved { get; set; }
|
public bool? approved { get; set; }
|
||||||
public int? type { get; set; }
|
public int? type { get; set; }
|
||||||
public int? projekt { get; set; }
|
public int? projekt { get; set; }
|
||||||
public int? gemeinde { get; set; }
|
public int? gemeinde { get; set; }
|
||||||
public TimeOnly night { get; set; }
|
public TimeOnly? night { get; set; }
|
||||||
public Dictionary<string, TimeOnly> total { get; set; }
|
public Dictionary<string, TimeOnly>? total { get; set; }
|
||||||
public TimeOnly end_print { get; set; }
|
public TimeOnly? end_print { get; set; }
|
||||||
public TimeSpan TimeSpanVon { get; set; }
|
public TimeSpan? TimeSpanVon { get; set; }
|
||||||
public TimeSpan TimeSpanBis { get; set; }
|
public TimeSpan? TimeSpanBis { get; set; }
|
||||||
public Collection<Projekt> Projekte { get; set; }
|
public Collection<Projekt>? Projekte { get; set; }
|
||||||
public Collection<Gemeinde> Gemeinden { get; set; }
|
public Collection<Gemeinde>? Gemeinden { get; set; }
|
||||||
public Collection<Freistellung> Freistellungen { get; set; }
|
public Collection<Freistellung>? Freistellungen { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the active Gemeinde based on the gemeinde ID.
|
/// Gets the active Gemeinde based on the gemeinde ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Gemeinde GemeindeAktiv { get; set; }
|
public Gemeinde? GemeindeAktiv { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the active Projekt based on the projekt ID.
|
/// Gets the active Projekt based on the projekt ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Projekt ProjektAktiv { get; set; }
|
public Projekt? ProjektAktiv { get; set; }
|
||||||
|
|
||||||
public Freistellung FreistellungAktiv { get; set; }
|
/// <summary>
|
||||||
|
/// Gets the active Freistellung based on the Freistellung ID
|
||||||
|
/// </summary>
|
||||||
|
public Freistellung? FreistellungAktiv { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Jugenddienst_Stunden.Types;
|
namespace Jugenddienst_Stunden.Types;
|
||||||
public class Freistellung {
|
public class Freistellung {
|
||||||
public string Id { get; set; }
|
public string? Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,5 +18,5 @@ public class Gemeinde {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name der Gemeinde.
|
/// Name der Gemeinde.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ using System.Collections.ObjectModel;
|
|||||||
namespace Jugenddienst_Stunden.Types;
|
namespace Jugenddienst_Stunden.Types;
|
||||||
|
|
||||||
public class Hours : ObservableObject {
|
public class Hours : ObservableObject {
|
||||||
public string zeit;
|
public string? zeit;
|
||||||
public string nominal;
|
public string? nominal;
|
||||||
//public Dictionary<DateOnly,NominalDay> nominal_day_api;
|
//public Dictionary<DateOnly,NominalDay> nominal_day_api;
|
||||||
public List<NominalDay> nominal_day_api;
|
public List<NominalDay>? nominal_day_api;
|
||||||
//public Dictionary<int,NominalWeek> nominal_week_api;
|
//public Dictionary<int,NominalWeek> nominal_week_api;
|
||||||
public List<NominalWeek> nominal_week_api;
|
public List<NominalWeek>? nominal_week_api;
|
||||||
//public List<string> time_line;
|
//public List<string> time_line;
|
||||||
public string zeit_total;
|
public string? zeit_total;
|
||||||
|
|
||||||
//https://stackoverflow.com/questions/29449641/deserialize-json-when-a-value-can-be-an-object-or-an-empty-array/29450279#29450279
|
//https://stackoverflow.com/questions/29449641/deserialize-json-when-a-value-can-be-an-object-or-an-empty-array/29450279#29450279
|
||||||
//[JsonConverter(typeof(JsonSingleOrEmptyArrayConverter<Hours>))]
|
//[JsonConverter(typeof(JsonSingleOrEmptyArrayConverter<Hours>))]
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ public partial class StundenPage : ContentPage {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
protected void OnDateSelected(object sender, DateChangedEventArgs e) {
|
//protected void OnDateSelected(object sender, DateChangedEventArgs e) {
|
||||||
DateTime selectedDate = e.NewDate;
|
// DateTime selectedDate = e.NewDate;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user