aufräumen
This commit is contained in:
@@ -68,8 +68,9 @@ public class StudentListItem
|
||||
public partial class StudentDetailViewModel : ObservableObject
|
||||
{
|
||||
private readonly IStudentRepository _students;
|
||||
private readonly IEnrollmentRepository _enrollments;
|
||||
private readonly IGroupMembershipRepository _memberships;
|
||||
private readonly IGroupRepository _groups;
|
||||
private readonly ISubjectRepository _subjects;
|
||||
private readonly IDocumentationRepository _docs;
|
||||
|
||||
[ObservableProperty] private Student? _student;
|
||||
@@ -79,7 +80,7 @@ public partial class StudentDetailViewModel : ObservableObject
|
||||
[ObservableProperty] private string _editLastName = "";
|
||||
[ObservableProperty] private ContactItem? _selectedContact;
|
||||
|
||||
public ObservableCollection<EnrollmentEntry> Enrollments { get; } = [];
|
||||
public ObservableCollection<GroupMembershipEntry> GroupMemberships { get; } = [];
|
||||
public ObservableCollection<DocEntry> Documentation { get; } = [];
|
||||
public ObservableCollection<ContactItem> Contacts { get; } = [];
|
||||
public bool HasNoContacts => Contacts.Count == 0;
|
||||
@@ -87,11 +88,11 @@ public partial class StudentDetailViewModel : ObservableObject
|
||||
public Action<ContactItem>? OnViewAddress { get; set; }
|
||||
|
||||
public StudentDetailViewModel(IStudentRepository students,
|
||||
IEnrollmentRepository enrollments, IGroupRepository groups,
|
||||
IGroupMembershipRepository memberships, IGroupRepository groups, ISubjectRepository subjects,
|
||||
IDocumentationRepository docs)
|
||||
{
|
||||
_students = students; _enrollments = enrollments;
|
||||
_groups = groups; _docs = docs;
|
||||
_students = students; _memberships = memberships;
|
||||
_groups = groups; _subjects = subjects; _docs = docs;
|
||||
}
|
||||
|
||||
public void LoadStudent(Guid id)
|
||||
@@ -102,12 +103,13 @@ public partial class StudentDetailViewModel : ObservableObject
|
||||
EditFirstName = Student.FirstName;
|
||||
EditLastName = Student.LastName;
|
||||
|
||||
Enrollments.Clear();
|
||||
foreach (var e in _enrollments.GetByStudent(Student.Id))
|
||||
GroupMemberships.Clear();
|
||||
foreach (var membership in _memberships.GetByStudent(Student.Id))
|
||||
{
|
||||
var g = _groups.GetById(e.GroupId);
|
||||
var g = _groups.GetById(membership.GroupId);
|
||||
if (g is null) continue;
|
||||
Enrollments.Add(new() { SchoolYear = e.SchoolYear, GroupName = g.Name, Subject = g.Subject ?? "" });
|
||||
var subject = g.SubjectId is Guid subjectId ? _subjects.GetById(subjectId)?.Name ?? "" : "";
|
||||
GroupMemberships.Add(new() { SchoolYear = g.SchoolYear, GroupName = g.Name, Subject = subject });
|
||||
}
|
||||
|
||||
LoadContacts();
|
||||
@@ -195,7 +197,7 @@ public partial class StudentDetailViewModel : ObservableObject
|
||||
private bool CanViewSelectedAddress() => SelectedContact?.HasAddress == true;
|
||||
}
|
||||
|
||||
public class EnrollmentEntry { public string SchoolYear { get; set; } = ""; public string GroupName { get; set; } = ""; public string Subject { get; set; } = ""; }
|
||||
public class GroupMembershipEntry { public string SchoolYear { get; set; } = ""; public string GroupName { get; set; } = ""; public string Subject { get; set; } = ""; }
|
||||
public class DocEntry { public string Date { get; set; } = ""; public string Title { get; set; } = ""; public string TypeLabel { get; set; } = ""; public bool IsConfidential { get; set; } }
|
||||
|
||||
public class ContactItem
|
||||
|
||||
Reference in New Issue
Block a user