Namespaceanpassungen
This commit is contained in:
@@ -6,8 +6,8 @@ using Microsoft.Maui.LifecycleEvents;
|
||||
using ZXing.Net.Maui.Controls;
|
||||
|
||||
|
||||
namespace Jugenddienst_Stunden {
|
||||
public static class MauiProgram {
|
||||
namespace Jugenddienst_Stunden;
|
||||
public static class MauiProgram {
|
||||
public static MauiApp CreateMauiApp() {
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
builder
|
||||
@@ -28,5 +28,4 @@ namespace Jugenddienst_Stunden {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Jugenddienst_Stunden.Types;
|
||||
using System.Text.Json;
|
||||
using ZXing.QrCode.Internal;
|
||||
|
||||
namespace Jugenddienst_Stunden.Models {
|
||||
|
||||
class Auth {
|
||||
|
||||
|
||||
namespace Jugenddienst_Stunden.Models;
|
||||
|
||||
class Auth {
|
||||
public static async Task<string> GetApiDataWithAuthAsync(string url, string token) {
|
||||
// Erstellen eines HttpClient-Objekts
|
||||
using (HttpClient client = new HttpClient() { Timeout = TimeSpan.FromSeconds(15) }) {
|
||||
@@ -22,10 +17,6 @@ namespace Jugenddienst_Stunden.Models {
|
||||
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
|
||||
|
||||
|
||||
//Beim Debugging im Lokalen Netz mit meinem Smartphone kommt es hier zu
|
||||
//system.net.webexception nachricht = socket closed
|
||||
//Grund: Falscher DNS-Server liefert falsche Server-IP
|
||||
|
||||
// Senden der Anfrage und Abrufen der Antwort
|
||||
using (HttpResponseMessage HttpResponseMessage = await client.GetAsync(url).ConfigureAwait(false)) {
|
||||
// Überprüfen, ob die Anfrage erfolgreich war
|
||||
@@ -87,5 +78,4 @@ namespace Jugenddienst_Stunden.Models {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Models {
|
||||
internal class Note {
|
||||
namespace Jugenddienst_Stunden.Models;
|
||||
internal class Note {
|
||||
public string Filename { get; set; }
|
||||
public string Text { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
@@ -52,5 +52,4 @@ File.WriteAllText(System.IO.Path.Combine(FileSystem.AppDataDirectory, Filename),
|
||||
Date = DateTime.Now;
|
||||
Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ using Jugenddienst_Stunden.ViewModels;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text;
|
||||
|
||||
namespace Jugenddienst_Stunden.Models {
|
||||
public class Operator : ObservableObject {
|
||||
namespace Jugenddienst_Stunden.Models;
|
||||
public class Operator : ObservableObject {
|
||||
public string id;
|
||||
public string name;
|
||||
public string surname;
|
||||
@@ -49,5 +49,4 @@ namespace Jugenddienst_Stunden.Models {
|
||||
}
|
||||
return OperatorVar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +1,36 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.Maui.Networking;
|
||||
using Microsoft.Maui.Controls;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Jugenddienst_Stunden.Types;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Jugenddienst_Stunden.Models;
|
||||
|
||||
namespace Jugenddienst_Stunden.Models {
|
||||
internal class Stunde : ObservableObject {
|
||||
internal class Stunde : ObservableObject {
|
||||
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
//Default-Werte zum Testen
|
||||
|
||||
//Katharina
|
||||
//public static string apiKey = Preferences.Default.Get("apiKey", "MTAyfEJZZnB1L3VwcnhoVms0dDlLZENPZWtUVy85b3xodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=");
|
||||
//public static string name = Preferences.Default.Get("name", "Katharina");
|
||||
//public static string surname = Preferences.Default.Get("surname", "Weger");
|
||||
|
||||
//Christine Feichter
|
||||
public static string apiKey = Preferences.Default.Get("apiKey", "");
|
||||
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://");
|
||||
public static string apiUrl = Preferences.Default.Get("apiUrl", "http://hours.dauni.mine.nu:81/appapi");
|
||||
|
||||
//Damian
|
||||
//public static string apiKey = Preferences.Default.Get("apiKey", "MTU0fGpkQUNYTGkvcjMvVk4rNkMyK0dDQkJmMkFwVXxodHRwOi8vaG91cnMuZGF1bmkubWluZS5udTo4MS9hcHBhcGk=");
|
||||
|
||||
//private static readonly string requestUrl = $"{BaseAddress}/appapi?hours";
|
||||
|
||||
//public static string apiKey = "Mnx6amdpUkFCdWMvc0lmZ3dWeXRVSWx3VGRDRDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Daniel Pichler
|
||||
//public static string apiKey = "M3xraUdoSktrdGowaUZoaStJbDJLWmIyTFhYeDh8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp"; //Le Mair
|
||||
|
||||
|
||||
public static async Task<Hours> LoadData() {
|
||||
Preferences.Default.Set("apiKey", "NXw5NDdCcEdLMVNDZTRENmphWG02MjlyeFFDenN8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp");
|
||||
Preferences.Default.Set("name", "Johannes");
|
||||
Preferences.Default.Set("surname", "Fink");
|
||||
Preferences.Default.Set("EmployeeId", 5);
|
||||
Preferences.Default.Set("apiUrl", "http://hours.dauni.mine.nu:81/appapi");
|
||||
|
||||
apiKey = Preferences.Default.Get("apiKey", "NXw5NDdCcEdLMVNDZTRENmphWG02MjlyeFFDenN8aHR0cDovL2hvdXJzLmRhdW5pLm1pbmUubnU6ODEvYXBwYXBp");
|
||||
EmployeeId = Preferences.Default.Get("employeeId", 5);
|
||||
name = Preferences.Default.Get("name", "Johannes");
|
||||
surname = Preferences.Default.Get("surname", "Fink");
|
||||
apiUrl = Preferences.Default.Get("apiUrl", "http://hours.dauni.mine.nu:81/appapi");
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(apiKey)) {
|
||||
throw new Exception("Kein APIKEY, bitte zuerst Login durchführen");
|
||||
}
|
||||
@@ -67,9 +60,13 @@ namespace Jugenddienst_Stunden.Models {
|
||||
return hours;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basisdaten: Mitarbeiterdaten, Projekte, Gemeinden, Freistellungen.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static async Task<Hours> LoadBasicData() {
|
||||
|
||||
|
||||
Hours hours = new Hours();
|
||||
|
||||
if (Connectivity.Current.NetworkAccess == NetworkAccess.None) {
|
||||
@@ -94,6 +91,13 @@ namespace Jugenddienst_Stunden.Models {
|
||||
return hours;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Zeiten eines Tages holen
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static async Task<List<DayTime>> LoadDay(DateTime date) {
|
||||
if (string.IsNullOrEmpty(apiKey)) {
|
||||
throw new Exception("Kein APIKEY, bitte zuerst Login durchführen");
|
||||
@@ -126,6 +130,11 @@ namespace Jugenddienst_Stunden.Models {
|
||||
return daytimes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Einzelnen Stundeneintrag holen
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<DayTime> LoadEntry(int id) {
|
||||
|
||||
var tokendata = new TokenData(apiKey);
|
||||
@@ -139,6 +148,7 @@ namespace Jugenddienst_Stunden.Models {
|
||||
return hours;
|
||||
}
|
||||
|
||||
|
||||
public static Stunde Load(string filename) {
|
||||
filename = System.IO.Path.Combine(FileSystem.AppDataDirectory, filename);
|
||||
|
||||
@@ -153,6 +163,11 @@ namespace Jugenddienst_Stunden.Models {
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eintrag speichern
|
||||
/// </summary>
|
||||
/// <param name="stunde"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<DayTime> SaveEntry(DayTime stunde) { //, string begin, string end, string freistellung, string bemerkung) {
|
||||
|
||||
var tokendata = new TokenData(apiKey);
|
||||
@@ -164,6 +179,11 @@ namespace Jugenddienst_Stunden.Models {
|
||||
return stunde;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eintrag löschen
|
||||
/// </summary>
|
||||
/// <param name="stunde"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<DayTime> DeleteEntry(DayTime stunde) { //, string begin, string end, string freistellung, string bemerkung) {
|
||||
|
||||
var tokendata = new TokenData(apiKey);
|
||||
@@ -171,5 +191,6 @@ namespace Jugenddienst_Stunden.Models {
|
||||
|
||||
return stunde;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace Jugenddienst_Stunden.Models {
|
||||
class TokenData {
|
||||
namespace Jugenddienst_Stunden.Models;
|
||||
class TokenData {
|
||||
public string token { get; set; }
|
||||
public string apiKey { get; set; }
|
||||
public string url { get; set; }
|
||||
@@ -19,5 +19,4 @@ namespace Jugenddienst_Stunden.Models {
|
||||
this.operator_id = dat.Split('|')[0]; ;
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types {
|
||||
public class Base {
|
||||
namespace Jugenddienst_Stunden.Types;
|
||||
public class Base {
|
||||
public Collection<Projekt> Projekte { get; set; }
|
||||
public Collection<Gemeinde> Gemeinden { get; set; }
|
||||
public Collection<Freistellung> Freistellungen { get; set; }
|
||||
@@ -15,5 +15,4 @@ namespace Jugenddienst_Stunden.Types {
|
||||
public Hours Hours { get; set; }
|
||||
public List<DayTime> daytime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Jugenddienst_Stunden.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types {
|
||||
/// <summary>
|
||||
/// Represents a day time entry for an employee.
|
||||
/// </summary>
|
||||
public class DayTime {
|
||||
namespace Jugenddienst_Stunden.Types;
|
||||
/// <summary>
|
||||
/// Represents a day time entry for an employee.
|
||||
/// </summary>
|
||||
public class DayTime {
|
||||
public int? id { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
public DateTime day { get; set; }
|
||||
@@ -38,5 +38,4 @@ namespace Jugenddienst_Stunden.Types {
|
||||
public Projekt ProjektAktiv { get; set; }
|
||||
|
||||
public Freistellung FreistellungAktiv { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types {
|
||||
public class Freistellung {
|
||||
namespace Jugenddienst_Stunden.Types;
|
||||
public class Freistellung {
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Repräsentiert eine Gemeinde mit einer eindeutigen Id und einem Namen.
|
||||
/// </summary>
|
||||
public class Gemeinde {
|
||||
namespace Jugenddienst_Stunden.Types;
|
||||
|
||||
/// <summary>
|
||||
/// Repräsentiert eine Gemeinde mit einer eindeutigen Id und einem Namen.
|
||||
/// </summary>
|
||||
public class Gemeinde {
|
||||
/// <summary>
|
||||
/// Eindeutige Id der Gemeinde.
|
||||
/// </summary>
|
||||
@@ -19,5 +19,4 @@ namespace Jugenddienst_Stunden.Types
|
||||
/// Name der Gemeinde.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Jugenddienst_Stunden.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types
|
||||
{
|
||||
public class Hours : ObservableObject
|
||||
{
|
||||
namespace Jugenddienst_Stunden.Types;
|
||||
|
||||
public class Hours : ObservableObject {
|
||||
public string zeit;
|
||||
public string nominal;
|
||||
//public Dictionary<DateOnly,NominalDay> nominal_day_api;
|
||||
@@ -44,5 +42,4 @@ namespace Jugenddienst_Stunden.Types
|
||||
public Collection<Freistellung> Freistellungen { get; set; }
|
||||
public int EmployeeId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Models {
|
||||
public class NominalDay {
|
||||
namespace Jugenddienst_Stunden.Types;
|
||||
public class NominalDay {
|
||||
public int day_number;
|
||||
public int month_number;
|
||||
public decimal hours;
|
||||
public DateOnly date;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Repräsentiert ein Projekt mit einer eindeutigen ID und einem Namen.
|
||||
/// </summary>
|
||||
public class Projekt {
|
||||
namespace Jugenddienst_Stunden.Types;
|
||||
|
||||
/// <summary>
|
||||
/// Repräsentiert ein Projekt mit einer eindeutigen ID und einem Namen.
|
||||
/// </summary>
|
||||
public class Projekt {
|
||||
/// <summary>
|
||||
/// Holt oder setzt die eindeutige ID des Projekts.
|
||||
/// </summary>
|
||||
@@ -19,5 +19,4 @@ namespace Jugenddienst_Stunden.Types
|
||||
/// Holt oder setzt den Namen des Projekts.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Types
|
||||
{
|
||||
namespace Jugenddienst_Stunden.Types;
|
||||
|
||||
public class TimeDay
|
||||
{
|
||||
public int Day { get; set; }
|
||||
public decimal Hours { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@ 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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,16 @@ using Microsoft.Maui.Dispatching;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
//using BarcodeScanning;
|
||||
|
||||
namespace Jugenddienst_Stunden.ViewModels {
|
||||
public class LoginViewModel {
|
||||
namespace Jugenddienst_Stunden.ViewModels;
|
||||
public class LoginViewModel {
|
||||
public string AppTitle => AppInfo.Name;
|
||||
public string Version => AppInfo.VersionString;
|
||||
|
||||
public string Message => "Scanne den QR-Code von deinem Benutzerprofil auf der Stundenseite.";
|
||||
|
||||
public string Server { get; set; } = "Server: " + Preferences.Default.Get("apiUrl", "https://").Replace("/appapi","");
|
||||
public string Server { get; set; } = "Server: " + Preferences.Default.Get("apiUrl","").Replace("/appapi","").Replace("https://","").Replace("http://","");
|
||||
|
||||
public string Title { get; set; } = Preferences.Default.Get("name", "") + " " + Preferences.Default.Get("surname", "");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Jugenddienst_Stunden.ViewModels {
|
||||
internal class NoteViewModel : ObservableObject, IQueryAttributable {
|
||||
namespace Jugenddienst_Stunden.ViewModels;
|
||||
internal class NoteViewModel : ObservableObject, IQueryAttributable {
|
||||
private Models.Note _note;
|
||||
public string Text {
|
||||
get => _note.Text;
|
||||
@@ -61,5 +61,4 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
OnPropertyChanged(nameof(Text));
|
||||
OnPropertyChanged(nameof(Date));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Jugenddienst_Stunden.ViewModels {
|
||||
internal class StundeViewModel : ObservableObject, IQueryAttributable {
|
||||
namespace Jugenddienst_Stunden.ViewModels;
|
||||
internal class StundeViewModel : ObservableObject, IQueryAttributable {
|
||||
|
||||
public int id { get; set; }
|
||||
|
||||
@@ -163,5 +163,4 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ using System.Globalization;
|
||||
using System;
|
||||
|
||||
|
||||
namespace Jugenddienst_Stunden.ViewModels {
|
||||
internal class StundenViewModel : ObservableObject, IQueryAttributable {
|
||||
namespace Jugenddienst_Stunden.ViewModels;
|
||||
internal class StundenViewModel : ObservableObject, IQueryAttributable {
|
||||
public string Name => AppInfo.Name;
|
||||
public string Surname => AppInfo.VersionString;
|
||||
public string MoreInfoUrl => "https://aka.ms/maui";
|
||||
@@ -205,5 +205,4 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user