コード例 #1
0
ファイル: PaymentRefundImpl.cs プロジェクト: buyonlinemahi/AR
        public int AddPaymentRefundRecord(DLModel.PaymentRefund modelPaymentRefund)
        {
            DLModel.Invoice InvoiceDetail = _IInvoiceImpl.GetInvoiceDetailsById(modelPaymentRefund.InvoiceId);
            InvoiceDetail.InvoiceBalanceAmt = (InvoiceDetail.InvoiceBalanceAmt + modelPaymentRefund.RefundAmount).Value;
            var updInvoiceBalAmt = _invoiceRepository.Update(InvoiceDetail, inv => inv.InvoiceBalanceAmt);

            return(_paymentRefundRepository.Add((DLModel.PaymentRefund) new DLModel.PaymentRefund().InjectFrom(modelPaymentRefund)).PaymentRefundID);
        }
コード例 #2
0
ファイル: PaymentRefundImpl.cs プロジェクト: buyonlinemahi/AR
        public int UpdatePaymentRefundRecord(DLModel.PaymentRefund modelPaymentRefund)
        {
            DLModel.Invoice InvoiceDetail    = _IInvoiceImpl.GetInvoiceDetailsById(modelPaymentRefund.InvoiceId);
            var             oldPaymentAmount = _paymentRefundRepository.GetAll(pay => pay.PaymentRefundID == modelPaymentRefund.PaymentRefundID).Select(inv => new DLModel.PaymentRefund().InjectFrom(inv)).Cast <DLModel.PaymentRefund>().SingleOrDefault().RefundAmount;
            var             newInvoiceAmount = (InvoiceDetail.InvoiceBalanceAmt - oldPaymentAmount) + modelPaymentRefund.RefundAmount;

            InvoiceDetail.InvoiceBalanceAmt = newInvoiceAmount.Value;
            var updInvoiceBalAmt = _invoiceRepository.Update(InvoiceDetail, inv => inv.InvoiceBalanceAmt);

            return(_paymentRefundRepository.Update((DLModel.PaymentRefund) new DLModel.PaymentRefund().InjectFrom(modelPaymentRefund)));
        }