using Comal.Classes; using InABox.Core; using InABox.Poster.CSV; using System.Collections.Generic; using System.Text; namespace PRS.Shared { public class InvoiceCSVPoster : ICSVPoster { public CSVPosterSettings Settings { get; set; } public bool BeforePost(IDataModel model) { return true; } public ICSVExport Process(IDataModel model) { var export = new CSVExport(); export.DefineMapping(new() { new("Number", x => x.Number), new("Date", x => x.Date), new("Description", x => x.Description), new("ExTax", x => x.ExTax), new("Tax", x => x.Tax), new("IncTax", x => x.IncTax) }); foreach (var invoice in model.GetTable().ToObjects()) { export.AddSuccess(invoice, invoice); } return export; } public void AfterPost(IDataModel model, IPostResult result) { } } }