Files
bnhtrade/src/bnhtrade.Core/Model/Account/InvoiceHeader.cs

136 lines
3.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Model.Account
{
public interface IInvoiceHeader
{
string ContactName { get; set; }
bool ContactNameIsSet { get; }
decimal InvoiceAmount { get; set; }
bool InvoiceAmountIsSet { get; }
string InvoiceCurrencyCode { get; set; }
bool InvoiceCurrencyCodeIsSet { get; }
DateTime InvoiceDate { get; set; }
bool InvoiceDateIsSet { get; }
DateTime InvoiceDueDate { get; set; }
bool InvoiceDueDateIsSet { get; }
DateTimeKind InvoiceDateKind { get; set; }
bool InvoiceDateKindIsSet { get; }
string InvoiceNumber { get; set; }
bool InvoiceNumberIsSet { get; }
string InvoiceReference { get; set; }
bool InvoiceReferenceIsSet { get; }
bool IsCreditNote { get; set; }
bool IsCreditNoteIsSet { get; }
}
public abstract class InvoiceHeader : IInvoiceHeader
{
private string invoiceCurrencyCode;
private DateTime? invoiceDate;
private DateTime? invoiceDueDate;
private DateTimeKind? invoiceDateKind = DateTimeKind.Utc;
private decimal? invoiceAmount;
public InvoiceHeader()
{
IsCreditNote = false;
}
public string ContactName { get; set; }
public bool ContactNameIsSet
{
get { return ContactName != null; }
}
public DateTime InvoiceDate
{
get { return (DateTime)invoiceDate.GetValueOrDefault(); }
set { invoiceDate = value; }
}
public bool InvoiceDateIsSet
{
get { return invoiceDate != null; }
}
public DateTime InvoiceDueDate
{
get { return (DateTime)invoiceDueDate.GetValueOrDefault(); }
set { invoiceDueDate = value; }
}
public bool InvoiceDueDateIsSet
{
get { return invoiceDueDate != null; }
}
public DateTimeKind InvoiceDateKind
{
get { return (DateTimeKind)invoiceDateKind; }
set { invoiceDateKind = value; }
}
public bool InvoiceDateKindIsSet
{
get { return invoiceDateKind != null; }
}
public string InvoiceCurrencyCode
{
get { return invoiceCurrencyCode; }
set
{
if (!string.IsNullOrWhiteSpace(value))
{
invoiceCurrencyCode = value.ToUpper();
}
}
}
public bool InvoiceCurrencyCodeIsSet
{
get { return InvoiceCurrencyCode != null; }
}
public string InvoiceNumber { get; set; }
public bool InvoiceNumberIsSet
{
get { return InvoiceNumber != null; }
}
public string InvoiceReference { get; set; }
public bool InvoiceReferenceIsSet
{
get { return InvoiceReference != null; }
}
public decimal InvoiceAmount
{
get { return (decimal)invoiceAmount; }
set { invoiceAmount = value; }
}
public bool InvoiceAmountIsSet
{
get { return invoiceAmount != null; }
}
public bool IsCreditNote
{
get;
set;
}
public bool IsCreditNoteIsSet
{
get { return true; }
}
}
}