Beispiel #1
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);
        }