Example #1
0
        public virtual PayItemInfo CancelAbandon(PayItemInfo entity)
        {
            PayableInfo payableInfo = null;
            var         payItemInfo = PreCheckForCancelAbandon(entity, out payableInfo);

            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                payItemInfo.Status = PayItemStatus.Origin;
                payItemInfo        = PayItemBizProcessor.UpdateStatus(payItemInfo);
                if (payableInfo.PayStatus == PayableStatus.Abandon)
                {
                    payableInfo.PayStatus     = PayableStatus.UnPay;
                    payableInfo.AlreadyPayAmt = 0;
                    PayableBizProcessor.UpdateStatus(payableInfo);
                }
                scope.Complete();
            }

            AfterProcessForCancelAbandon(payItemInfo);

            return(payItemInfo);
        }
Example #2
0
        public virtual PayItemInfo Abandon(PayItemInfo entity)
        {
            var payItemInfo = PreCheckForAbandon(entity);

            TransactionOptions option = new TransactionOptions();

            option.IsolationLevel = IsolationLevel.ReadUncommitted;
            option.Timeout        = TransactionManager.DefaultTimeout;
            var payList = PayableBizProcessor.GetListByCriteria(new PayableInfo
            {
                SysNo = payItemInfo.PaySysNo
            });
            bool isLastPayitem = PayItemBizProcessor.IsLastUnAbandon(payItemInfo);

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option))
            {
                payItemInfo.Status = PayItemStatus.Abandon;
                payItemInfo.Note   = payItemInfo.Note + entity.Note;
                PayItemBizProcessor.UpdateStatus(payItemInfo);
                //如果该应付款对应的所有付款单都是无效的, 就作废应付款
                if (isLastPayitem)
                {
                    foreach (var pay in payList)
                    {
                        pay.PayStatus = PayableStatus.Abandon;
                        PayableBizProcessor.UpdateStatus(pay);
                    }
                }
                scope.Complete();
            }
            return(payItemInfo);
        }
Example #3
0
        public override PayItemInfo CancelAbandon(PayItemInfo entity)
        {
            PayableInfo payableInfo = null;
            var         payItemInfo = base.PreCheckForCancelAbandon(entity, out payableInfo);

            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                payItemInfo.Status = PayItemStatus.Origin;
                payItemInfo.Note   = payItemInfo.Note + entity.Note;
                payItemInfo        = PayItemBizProcessor.UpdateStatus(payItemInfo);

                payableInfo.PayStatus = PayableStatus.UnPay;
                PayableBizProcessor.UpdateStatus(payableInfo);

                scope.Complete();
            }
            return(payItemInfo);
        }