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
@@ -0,0 +1,29 @@
|
||||
using Elwig.Models.Dtos;
|
||||
using Elwig.Models.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Elwig.Helpers.Export {
|
||||
public class MemberMovement : IExporter<MemberHistory> {
|
||||
|
||||
public static string FileExtension => "ods";
|
||||
|
||||
private readonly OdsFile _ods;
|
||||
|
||||
public MemberMovement(string filename) {
|
||||
_ods = new OdsFile(filename);
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
GC.SuppressFinalize(this);
|
||||
_ods.Dispose();
|
||||
}
|
||||
|
||||
public async Task ExportAsync(IEnumerable<MemberHistory> data, IProgress<double>? progress = null) {
|
||||
using var ctx = new AppDbContext();
|
||||
var tbl = MemberMovementData.FromMemberHistory("", data, await ctx.GetMemberHistory());
|
||||
await _ods.AddTable(tbl);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user