Leerzeilen, Kommentare
This commit is contained in:
@@ -98,9 +98,6 @@ internal static class BaseFunc {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
internal static Note Load(string filename) {
|
||||
filename = System.IO.Path.Combine(FileSystem.AppDataDirectory, filename);
|
||||
|
||||
@@ -113,14 +110,11 @@ internal static class BaseFunc {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stundeneintrag speichern
|
||||
/// </summary>
|
||||
internal static async Task SaveItemAsync(string url, string token, DayTime item, bool isNewItem = false) {
|
||||
|
||||
|
||||
//Uhrzeiten sollten sinnvolle Werte haben - außer bei Freistellungen, da wäre eigentlich null
|
||||
if (item.TimeSpanVon == item.TimeSpanBis && item.FreistellungAktiv == null) {
|
||||
throw new Exception("Beginn und Ende sind gleich");
|
||||
|
||||
@@ -6,8 +6,9 @@ namespace Jugenddienst_Stunden.Models;
|
||||
internal static class HoursBase {
|
||||
|
||||
/// <summary>
|
||||
/// what can be: settings, hours, date=YYYY-MM-DD, id=<int>
|
||||
/// what can be: "settings", "hours", date="YYYY-MM-DD", id=<int/>
|
||||
/// </summary>
|
||||
/// <returns>Entire response</returns>
|
||||
internal static async Task<BaseResponse> LoadBase(string what) {
|
||||
string data = await BaseFunc.GetApiDataWithAuthAsync(GlobalVar.ApiUrl + "?"+what, GlobalVar.ApiKey);
|
||||
BaseResponse res = JsonConvert.DeserializeObject<BaseResponse>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||
@@ -17,6 +18,7 @@ internal static class HoursBase {
|
||||
/// <summary>
|
||||
/// Einstellungen
|
||||
/// </summary>
|
||||
/// <returns>Settings only</returns>
|
||||
internal static async Task<Settings> LoadSettings() {
|
||||
string data = await BaseFunc.GetApiDataWithAuthAsync(GlobalVar.ApiUrl + "?settings", GlobalVar.ApiKey);
|
||||
BaseResponse res = JsonConvert.DeserializeObject<BaseResponse>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||
@@ -26,12 +28,17 @@ internal static class HoursBase {
|
||||
/// <summary>
|
||||
/// Daten laden
|
||||
/// </summary>
|
||||
/// <returns>Hours only</returns>
|
||||
internal static async Task<Hours> LoadData() {
|
||||
string data = await BaseFunc.GetApiDataWithAuthAsync(GlobalVar.ApiUrl + "?hours", GlobalVar.ApiKey);
|
||||
BaseResponse res = JsonConvert.DeserializeObject<BaseResponse>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||
return res.hour;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Benutzerdaten laden
|
||||
/// </summary>
|
||||
/// <returns>User-Object</returns>
|
||||
public static async Task<User> LoadUser(string apiKey) {
|
||||
string data = await BaseFunc.GetApiDataWithAuthAsync(GlobalVar.ApiUrl, apiKey);
|
||||
BaseResponse res = JsonConvert.DeserializeObject<BaseResponse>(data) ?? throw new Exception("Fehler beim Deserialisieren der Daten");
|
||||
@@ -62,7 +69,6 @@ internal static class HoursBase {
|
||||
/// Eintrag speichern
|
||||
/// </summary>
|
||||
internal static async Task<DayTime> SaveEntry(DayTime stunde) { //, string begin, string end, string freistellung, string bemerkung) {
|
||||
|
||||
bool isNew = false;
|
||||
if (stunde.Id == null)
|
||||
isNew = true;
|
||||
|
||||
Reference in New Issue
Block a user