Files
bnhtrade/src/bnhtrade.Core/Logic/Account/ValidateSalesInvoice.cs

35 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Logic.Account
{
public class ValidateSalesInvoice : ValidateInvoice
{
public ValidateSalesInvoice()
{
int propertyCount = new Model.Account.SalesInvoice().GetType().GetProperties().Count();
if (propertyCount != 20)
{ throw new Exception("Model.Account.SalesInvoice property count has altered. Validate class requires an update."); }
propertyCount = new Model.Account.SalesInvoice.InvoiceLine().GetType().GetProperties().Count();
if (propertyCount != 18)
{ throw new Exception("Model.Account.SalesInvoice property count has altered. Validate class requires an update."); }
}
public bool IsValidInvoice(Model.Account.SalesInvoice invoice)
{
return IsValidInvoice(new List<Model.Account.SalesInvoice> { invoice });
}
public bool IsValidInvoice(List<Model.Account.SalesInvoice> invoiceList)
{
var interfaceList = invoiceList.Cast<Model.Account.IInvoice>().ToList();
return IsValidInvoice(interfaceList);
}
}
}