Files
BealeEngineering/BealeEngineering/BealeEngineering.Core/Logic/Adapter/Contact.cs
Bobbie Hodgetts 229d9eccec Xero invoice export feature
Added Xero invoice export feature and other small improvements
2020-02-05 14:52:37 +00:00

34 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BealeEngineering.Core.Logic.Adapter
{
public class Contact
{
public Model.Contact.Contact XeroInvoiceFlatFile(Model.Import.XeroInvoiceFlatFile xeroInvoice)
{
var contact = new Model.Contact.Contact();
contact.ContactName = xeroInvoice.ContactName;
if (string.IsNullOrWhiteSpace(xeroInvoice.EmailAddress)) { contact.EmailAddress = null; }
else { contact.EmailAddress = xeroInvoice.EmailAddress; }
var address = new Model.Contact.Address();
address.AddressLine1 = xeroInvoice.POAddressLine1;
address.AddressLine2 = xeroInvoice.POAddressLine2;
address.AddressLine3 = xeroInvoice.POAddressLine3;
address.AddressLine4 = xeroInvoice.POAddressLine4;
address.City = xeroInvoice.POCity;
address.Country = xeroInvoice.POCountry;
address.PostalCode = xeroInvoice.POPostalCode;
address.Region = xeroInvoice.PORegion;
if (address.IsValid()) { contact.PostalAddress = address; }
return contact;
}
}
}