- CSS: drop the Bootstrap template leftovers (NavMenu.razor.css, most of MainLayout.razor.css, button/form rules in app.css) and the copied Fluent demo rules in BankTransactions.razor.css. - Bootstrap: keep only bootstrap.min.css (+ map); 42 unused files removed. - Credit-card statement import, never wired into the Blazor UI: service methods, GetCreditCardStatementPath, DI registrations for ICreditCardStatementService/IPdfParsingService, FreeSpire.PDF. - CSV export (GetTransactionListCsvAsync), only called from tests. - Split predefinitions: model, repository and the JSON editor entry. - Unused members: TrySetYear, GetUploadPath (+ DataFolders.Uploads), GetClasses; unused usings, fields and parameters. - Home.razor.css -> PendingBookings.razor.css: the pending-bookings table moved there in "PR U-10" and had lost its styling since. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Logging;
|
|
using Schaad.Accounting.Interfaces;
|
|
using Schaad.Accounting.Models;
|
|
|
|
namespace Schaad.Accounting.Repositories
|
|
{
|
|
public class SubclassRepository : BaseRepository, ISubclassRepository
|
|
{
|
|
private readonly Dictionary<int, string> classes = new Dictionary<int, string>();
|
|
private readonly string SUBCLASSES = "SubClasses.json";
|
|
|
|
public SubclassRepository(ISettingsService settingsService, RepositoryCache cache, ILogger<SubclassRepository> logger)
|
|
: base(settingsService, cache, logger)
|
|
{
|
|
EnsureFileExists(SUBCLASSES);
|
|
|
|
classes.Add(ClassIds.Activa, "Aktiven");
|
|
classes.Add(ClassIds.Passiva, "Passiven");
|
|
classes.Add(ClassIds.Income, "Einnahmen");
|
|
classes.Add(ClassIds.Expenses, "Ausgaben");
|
|
}
|
|
|
|
public Task<List<SubClass>> GetSubClassListAsync() => LoadListAsync<SubClass>(SUBCLASSES);
|
|
|
|
public async Task SaveSubClassAsync(SubClass subClass)
|
|
{
|
|
var subclasses = await GetSubClassListAsync();
|
|
var idx = subclasses.FindIndex(s => s.Id == subClass.Id);
|
|
if (idx >= 0)
|
|
{
|
|
subclasses[idx] = subClass;
|
|
}
|
|
else
|
|
{
|
|
subClass.Id = Guid.NewGuid().ToString();
|
|
subclasses.Add(subClass);
|
|
}
|
|
await SaveAsync(subclasses, SUBCLASSES);
|
|
}
|
|
|
|
public async Task<SubClass> GetSubClassAsync(string id)
|
|
{
|
|
var subclasses = await GetSubClassListAsync();
|
|
return subclasses.FirstOrDefault(t => t.Id == id);
|
|
}
|
|
|
|
public async Task DeleteSubClassAsync(string id)
|
|
{
|
|
var subclasses = await GetSubClassListAsync();
|
|
subclasses.RemoveAll(t => t.Id == id);
|
|
await SaveAsync(subclasses, SUBCLASSES);
|
|
}
|
|
|
|
public string GetClass(int classId)
|
|
{
|
|
return classes[classId];
|
|
}
|
|
}
|
|
}
|