30 lines
847 B
C#
30 lines
847 B
C#
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);
|
|
}
|
|
}
|
|
}
|