Settings so halb und a bissi aufgeräumt ...

This commit is contained in:
2024-10-20 17:58:26 +02:00
parent fbd650c174
commit 996dbadaf1
27 changed files with 707 additions and 931 deletions

View File

@@ -1,13 +0,0 @@
using System.Collections.ObjectModel;
namespace Jugenddienst_Stunden.Types;
public struct Base {
public Collection<Projekt>? Projekte { get; set; }
public Collection<Gemeinde>? Gemeinden { get; set; }
public Collection<Freistellung>? Freistellungen { get; set; }
public int EmployeeId { get; set; }
public Hours Hours { get; set; }
public List<DayTime> daytime { get; set; }
}

View File

@@ -1,15 +1,15 @@
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
namespace Jugenddienst_Stunden.Types;
/// <summary>
/// Represents a day time entry for an employee.
/// </summary>
public class DayTime
{
public class DayTime {
/// <summary>
/// ID des Stundeneintrages
/// </summary>
public int? id { get; set; }
public int? Id { get; set; }
/// <summary>
/// Mitarbeiter-ID
@@ -19,92 +19,76 @@ public class DayTime
/// <summary>
/// Der betreffende Tag
/// </summary>
public DateTime day { get; set; }
public DateTime Day { get; set; }
/// <summary>
/// Der Wochentag
/// </summary>
public int wday { get; set; }
public int Wday { get; set; }
/// <summary>
/// Arbeitsbeginn
/// </summary>
public TimeOnly begin { get; set; }
public TimeOnly Begin { get; set; }
/// <summary>
/// Arbeitsende
/// </summary>
public TimeOnly end { get; set; }
public TimeOnly End { get; set; }
/// <summary>
/// Beschreibung der Arbeit
/// Beschreibung der Tätigkeit
/// </summary>
public string description { get; set; }
public string? Description { get; set; }
/// <summary>
/// Freistellung
/// </summary>
public string? free { get; set; }
public string? Free { get; set; }
/// <summary>
/// Freisetellung genehmigt?
/// Freistellung genehmigt?
/// </summary>
public bool? approved { get; set; }
public bool? Approved { get; set; }
/// <summary>
/// Sollte nix sein
/// </summary>
public int? type { get; set; }
/// <summary>
/// Das gewählte Projekt
/// </summary>
public int? projekt { get; set; }
public int? Projekt { get; set; }
/// <summary>
/// Die gewählte Gemeinde
/// </summary>
public int? gemeinde { get; set; }
public int? Gemeinde { get; set; }
/// <summary>
/// Nachtstunden
/// </summary>
public TimeOnly night { get; set; }
public TimeOnly Night { get; set; }
/// <summary>
/// Summe Arbeitszeit (inklusive Nachstunden mit Faktor)
/// </summary>
public Dictionary<string, TimeOnly> total { get; set; }
public TimeOnly end_print { get; set; }
public Dictionary<string, TimeOnly> Total { get; set; }
public TimeOnly End_print { get; set; }
public TimeSpan TimeSpanVon { get; set; }
public TimeSpan TimeSpanBis { get; set; }
/// <summary>
/// Projekte für die Auswahlliste
/// </summary>
public Collection<Projekt> Projekte { get; set; }
/// <summary>
/// Gemeinden für die Auswahlliste
/// </summary>
public Collection<Gemeinde> Gemeinden { get; set; }
public Collection<Freistellung> Freistellungen { get; set; }
/// <summary>
/// Gets the active Gemeinde based on the gemeinde ID.
/// </summary>
public Gemeinde GemeindeAktiv { get; set; }
public Gemeinde? GemeindeAktiv { get; set; }
/// <summary>
/// Gets the active Projekt based on the projekt ID.
/// </summary>
public Projekt ProjektAktiv { get; set; }
public Projekt? ProjektAktiv { get; set; }
/// <summary>
/// Gets the active Freistellung based on the Freistellung ID
/// </summary>
public Freistellung FreistellungAktiv { get; set; }
public Freistellung? FreistellungAktiv { get; set; }
public bool ProjektAktivSet { get; set; } = false;
public bool GemeindeAktivSet { get; set; } = false;
}

View File

@@ -3,6 +3,6 @@
/// Freistellungen: Urlaub, Zeitausgleich, Krankheit, ...
/// </summary>
public class Freistellung {
public string? Id { get; set; }
public string? Id { get; set; }
public string? Name { get; set; }
}

View File

@@ -7,7 +7,7 @@ public class Gemeinde {
/// <summary>
/// Eindeutige Id der Gemeinde.
/// </summary>
public int Id { get; set; }
public int? Id { get; set; }
/// <summary>
/// Name der Gemeinde.

View File

@@ -1,19 +1,18 @@

using CommunityToolkit.Mvvm.ComponentModel;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
namespace Jugenddienst_Stunden.Types;
public class Hours : ObservableObject {
public string? zeit;
public string? nominal;
internal class Hours : ObservableObject {
public string? Zeit;
public string? Nominal;
//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 List<NominalWeek>? nominal_week_api;
public List<NominalWeek>? Nominal_week_api;
//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
//[JsonConverter(typeof(JsonSingleOrEmptyArrayConverter<Hours>))]

View File

@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jugenddienst_Stunden.Types;
public class NominalDay {
namespace Jugenddienst_Stunden.Types;
internal class NominalDay {
public int day_number;
public int month_number;
public decimal hours;

View File

@@ -1,13 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jugenddienst_Stunden.Types;
namespace Jugenddienst_Stunden.Types;
public class NominalWeek
{
public int week_number;
public decimal hours;
}
internal class NominalWeek {
public int Week_number;
public decimal Hours;
}

View File

@@ -7,7 +7,7 @@ public class Projekt {
/// <summary>
/// Holt oder setzt die eindeutige ID des Projekts.
/// </summary>
public int Id { get; set; }
public int? Id { get; set; }
/// <summary>
/// Holt oder setzt den Namen des Projekts.

View File

@@ -1,15 +1,31 @@
using System.Collections.ObjectModel;
namespace Jugenddienst_Stunden.Types;
namespace Jugenddienst_Stunden.Types;
/// <summary>
/// Einstellungen
/// </summary>
public class Settings
{
public class Settings {
/// <summary>
/// Sind Projekte aktiv?
/// </summary>
public bool ProjektAktivSet { get; set; }
/// <summary>
/// Sind Gemeinden aktiv?
/// </summary>
public bool GemeindeAktivSet { get; set; }
public Collection<Projekt> Projekte { get; set; }
public Collection<Gemeinde> Gemeinden { get; set; }
public Collection<Freistellung> Freistellungen { get; set; }
/// <summary>
/// Liste der Projekte
/// </summary>
public List<Projekt>? Projekte { get; set; }
/// <summary>
/// Liste der Gemeinden
/// </summary>
public List<Gemeinde>? Gemeinden { get; set; }
/// <summary>
/// Liste der Freistellungen
/// </summary>
public List<Freistellung>? Freistellungen { get; set; }
}

View File

@@ -3,7 +3,7 @@
/// <summary>
/// Summe der geleisteten Stunden.
/// </summary>
public struct TimeDay {
internal struct TimeDay {
public int Day { get; set; }
public decimal Hours { get; set; }
}

View File

@@ -1,13 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jugenddienst_Stunden.Types;
namespace Jugenddienst_Stunden.Types;
internal class Timetable
{
public List<TimetableEntry> timetable;
public decimal wochensumme;
}
internal class Timetable {
public List<TimetableEntry> timetable;
public decimal wochensumme;
}

View File

@@ -1,14 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jugenddienst_Stunden.Types;
namespace Jugenddienst_Stunden.Types;
internal class TimetableEntry
{
public List<TimeOnly>? von;
public List<TimeOnly>? bis;
public decimal summe { get; set; }
}
internal class TimetableEntry {
public List<TimeOnly>? Von;
public List<TimeOnly>? Bis;
public decimal Summe { get; set; }
}

View File

@@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jugenddienst_Stunden.Types;
public class User {
public int id { get; set; }
public string name { get; set; }
public string surname { get; set; }
public string token { get; set; }
namespace Jugenddienst_Stunden.Types;
internal class User {
public int Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string Token { get; set; }
}