using Comal.Classes; using InABox.Core; using InABox.Poster.CSV; using System; using System.Collections.Generic; using System.Text; namespace PRS.Shared { class InvoiceExportMap { public int Number { get; set; } public double Paid { get; set; } public double Balance { get; set; } public string Description { get; set; } public Guid ID { get; set; } } public class InvoiceCSVPoster : ICSVPoster { public ICSVExport Process(IEnumerable entities) { var export = new CSVExport(); export.DefineMapping(new() { new("Number", x => x.Number), new("Description", x => x.Description), new("Paid", x => x.Paid), new("Balance", x => x.Balance), new("ID", x => x.ID) }); foreach(var entity in entities) { export.Add(new InvoiceExportMap { Number = entity.Number, Paid = entity.AmountPaid, Balance = entity.Balance, ID = entity.ID, Description = entity.Description }); } return export; } } }