示例#1
0
        public PaymentVoucher VAllPaymentVoucherDetailsAreConfirmable(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService,
                                                                      IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService,
                                                                      IPayableService _payableService)
        {
            IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id);

            foreach (var detail in details)
            {
                detail.Errors           = new Dictionary <string, string>();
                detail.ConfirmationDate = paymentVoucher.ConfirmationDate;
                detail.Errors           = new Dictionary <string, string>();
                if (!_paymentVoucherDetailService.GetValidator().ValidConfirmObject(detail, _payableService))
                {
                    foreach (var error in detail.Errors)
                    {
                        paymentVoucher.Errors.Add(error.Key, error.Value);
                    }
                    if (paymentVoucher.Errors.Any())
                    {
                        return(paymentVoucher);
                    }
                }
            }
            return(paymentVoucher);
        }