MemberAdminWindow: Add pending member movement export
This commit is contained in:
1 parent
0e586cc438
commit
e370f949f6
15 files changed
+352
-103
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Helpers.Export;
|
||||
using Elwig.Models;
|
||||
using Elwig.Models.Entities;
|
||||
using Elwig.ViewModels;
|
||||
@@ -10,6 +11,10 @@ using System.Threading.Tasks;
|
||||
namespace Elwig.Services {
|
||||
public static class MemberBusinessSharesService {
|
||||
|
||||
public enum ExportSubject {
|
||||
Pending,
|
||||
};
|
||||
|
||||
public static async Task InitInputs(this MemberBusinessSharesViewModel vm) {
|
||||
using var ctx = new AppDbContext();
|
||||
vm.DateNoticeString = $"{DateTime.Today:dd.MM.yyyy}";
|
||||
@@ -97,5 +102,18 @@ namespace Elwig.Services {
|
||||
await tx.CommitAsync();
|
||||
});
|
||||
}
|
||||
|
||||
public static async Task GenerateMemberMovements(ExportSubject subject, ExportMode mode) {
|
||||
var today = DateTime.Today;
|
||||
var filename = InteractionService.SaveFile($"Ausstehende Mitgl.-Bewegungen {today:dd.MM.yyyy}", $"MitglBewegungen_{today:yyyy-MM-dd}", "ods");
|
||||
if (filename == null)
|
||||
return;
|
||||
await Utils.RunForeground(async () => {
|
||||
using var ctx = new AppDbContext();
|
||||
var hist = await ctx.MemberHistory.Where(h => !h.CompanyHasSigned).ToListAsync();
|
||||
using var exporter = new MemberMovement(filename);
|
||||
await exporter.ExportAsync(hist);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user