Add shared export infrastructure

This commit is contained in:
2026-08-18 21:21:56 +02:00
parent 41bf2c0756
commit 26461bd2f2
13 changed files with 336 additions and 63 deletions
@@ -3,9 +3,9 @@ using CommunityToolkit.Mvvm.Input;
using LehrerApp.Core.Interfaces;
using LehrerApp.Core.Models;
using LehrerApp.Core.Services;
using LehrerApp.Desktop.Services;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Text;
namespace LehrerApp.Desktop.ViewModels.Groups;
@@ -197,12 +197,13 @@ public partial class ReportGradeDialogViewModel : ObservableObject
public string ExportCsv()
{
var sb = new StringBuilder();
sb.AppendLine($"Zeugnisnoten;{_groupLabel};{SelectedPeriod.Label}");
sb.AppendLine("Schüler;Berechnet;Übersteuert;Begründung;Endnote;Gesperrt");
var csv = new CsvBuilder()
.AddRow("Zeugnisnoten", _groupLabel, SelectedPeriod.Label)
.AddRow("Schüler", "Berechnet", "Übersteuert", "Begründung", "Endnote", "Gesperrt");
foreach (var r in Rows)
sb.AppendLine($"{r.Name};{r.CalculatedValue};{r.OverrideValue};{r.OverrideReason};{r.FinalDisplay};{(r.IsLocked ? "ja" : "")}");
return sb.ToString();
csv.AddRow(r.Name, r.CalculatedValue, r.OverrideValue, r.OverrideReason,
r.FinalDisplay, r.IsLocked ? "ja" : "");
return csv.ToString();
}
}