Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }