129 lines
4.0 KiB
C#
129 lines
4.0 KiB
C#
using System.Collections.Generic;
|
|
using Avalonia.Data;
|
|
|
|
namespace spplus;
|
|
|
|
public class Sport
|
|
{
|
|
public int ID { get; set; } = 0;
|
|
public string Name { get; set; } = "Neuer Kurs"; // Kursname
|
|
|
|
public int MaxStudents { get; set; } = 25; // Maximale Anzahl an Schülern pro Kurs
|
|
public int MinStudents { get; set; } = 5; // Minimale Anzahl an Schülern pro Kurs
|
|
public int[] Semester { get; set; } = [2, 2, 2, 2]; // Maximale Anzahl an Angeboten in den jeweiligen Index-Semestern (0 => 1. Semester)
|
|
public List<string> AlternativeNames { get; set; } = new();
|
|
//public List<int> AlternativeCourses { get; set; } = new();
|
|
|
|
protected Sport()
|
|
{
|
|
|
|
}
|
|
|
|
public Sport(string name)
|
|
{
|
|
Name = name;
|
|
}
|
|
|
|
public Sport(string name, int maxCoursesPerSemester, int maxStudents, int minStudents, int[] semester, List<string> alternativeNames)
|
|
{
|
|
Name = name;
|
|
MaxStudents = maxStudents;
|
|
MinStudents = minStudents;
|
|
Semester = semester;
|
|
AlternativeNames = alternativeNames;
|
|
}
|
|
|
|
// public void AddAlternativeSport(int id)
|
|
// {
|
|
// AlternativeCourses.Add(id);
|
|
// }
|
|
//
|
|
// public void ClearAlternativeSport()
|
|
// {
|
|
// AlternativeCourses.Clear();
|
|
// }
|
|
|
|
public override string ToString()
|
|
{
|
|
var alt = "";
|
|
foreach (var s in AlternativeNames)
|
|
{
|
|
alt += s + ", ";
|
|
}
|
|
return $"{Name} ({alt})";
|
|
}
|
|
}
|
|
|
|
public class Student
|
|
{
|
|
public string ID { get; set; } = ""; // ID des Schüler (z.B. NolteSeb)
|
|
public string Name { get; set; } = ""; // Name des Schülers
|
|
public List<string> SelectedCourseNames { get; set; } = new();
|
|
public string[] Result { get; set; } = new string[4];
|
|
|
|
public Student()
|
|
{
|
|
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{Name} ({ID})";
|
|
}
|
|
|
|
public Student(string id, string name, List<string> selectedCoursesNames)
|
|
{
|
|
ID = id;
|
|
Name = name;
|
|
SelectedCourseNames = selectedCoursesNames;
|
|
}
|
|
}
|
|
|
|
public class Settings
|
|
{
|
|
public static Settings Instance = new Settings();
|
|
|
|
public List<Student> Students { get; set; } = [];
|
|
public List<Sport> Sports { get; set; } = [];
|
|
public int NumCoursesPerSemester { get; set; } = 10;
|
|
|
|
public Settings()
|
|
{
|
|
|
|
}
|
|
|
|
public static void Import(string path)
|
|
{
|
|
// Hier importieren...
|
|
}
|
|
|
|
public static void ImportInitial()
|
|
{
|
|
Instance.Sports.Add(new Sport("Tischtennis"){ AlternativeNames = {"Sport_TT"}});
|
|
Instance.Sports.Add(new Sport("Badminton"){ AlternativeNames = {"Sport_BM"}});
|
|
Instance.Sports.Add(new Sport("Gymnastik/Tanz"){ AlternativeNames = {"Sport_Gym"}});
|
|
Instance.Sports.Add(new Sport("Schwimmen"){ AlternativeNames = {"Sport_SW"}, Semester = [1, 1, 1, 1], MaxStudents = 18});
|
|
Instance.Sports.Add(new Sport("Bouldern"){ AlternativeNames = {"Sport_BO"}, Semester = [1, 1, 1, 1]});
|
|
Instance.Sports.Add(new Sport("Basketball"){ AlternativeNames = {"Sport_BS"}});
|
|
Instance.Sports.Add(new Sport("Fitness"){ AlternativeNames = {"Sport_Fit"}});
|
|
Instance.Sports.Add(new Sport("Fußball"){ AlternativeNames = {"Sport_Fuß"}, Semester = [1, 0, 1, 0]});
|
|
Instance.Sports.Add(new Sport("Handball"){ AlternativeNames = {"Sport_HB"}});
|
|
Instance.Sports.Add(new Sport("Leichtathletik"){ AlternativeNames = {"Sport_LA"}, Semester = [1, 0, 1, 0], MaxStudents = 18});
|
|
Instance.Sports.Add(new Sport("Tennis"){ AlternativeNames = {"Sport_Te"}});
|
|
Instance.Sports.Add(new Sport("Turnen"){ AlternativeNames = {"Sport_Tur"}});
|
|
Instance.Sports.Add(new Sport("Volleyball"){ AlternativeNames = {"Sport_VB"}});
|
|
}
|
|
|
|
public static string? GetSportNameFromID(int id)
|
|
{
|
|
foreach (var s in Instance.Sports)
|
|
{
|
|
if (s.ID == id)
|
|
{
|
|
return s.Name;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
} |