public PurchaseInvoice VAllPurchaseInvoiceDetailsAreConfirmable(PurchaseInvoice purchaseInvoice, IPurchaseInvoiceDetailService _purchaseInvoiceDetailService, IPurchaseReceivalDetailService _purchaseReceivalDetailService) { IList <PurchaseInvoiceDetail> details = _purchaseInvoiceDetailService.GetObjectsByPurchaseInvoiceId(purchaseInvoice.Id); foreach (var detail in details) { detail.ConfirmationDate = purchaseInvoice.ConfirmationDate; _purchaseInvoiceDetailService.GetValidator().VConfirmObject(detail, _purchaseInvoiceDetailService, _purchaseReceivalDetailService); foreach (var error in detail.Errors) { purchaseInvoice.Errors.Add(error.Key, error.Value); } if (!isValid(purchaseInvoice)) { return(purchaseInvoice); } } return(purchaseInvoice); }
public PurchaseInvoice VAllPurchaseInvoiceDetailsAreUnconfirmable(PurchaseInvoice purchaseInvoice, IPurchaseInvoiceDetailService _purchaseInvoiceDetailService, IPaymentVoucherDetailService _paymentVoucherDetailService, IPayableService _payableService) { IList <PurchaseInvoiceDetail> details = _purchaseInvoiceDetailService.GetObjectsByPurchaseInvoiceId(purchaseInvoice.Id); foreach (var detail in details) { if (!_purchaseInvoiceDetailService.GetValidator().ValidUnconfirmObject(detail)) { foreach (var error in detail.Errors) { purchaseInvoice.Errors.Add("Generic", error.Value); } if (!isValid(purchaseInvoice)) { return(purchaseInvoice); } } } return(purchaseInvoice); }