示例#1
0
        private static void SetAbandon(int countdownSysNo)
        {
            //必须是Ready或者VerifyFaild状态
            SecKillEntity entity = SecKillDA.GetCountDownItemBySysno(countdownSysNo);

            if (entity.Status != (int)CountdownStatus.Ready && entity.Status != (int)CountdownStatus.VerifyFaild)
            {
                throw new BusinessException("the current status not allow such opertion");
            }

            int SysNo = SecKillDA.GetProductNotAutoSetVirtualKey(entity.ProductSysNo
                                                                 , (int)NotAutoSetVirtualType.CountDown, entity.SysNo);

            entity.Status = (int)CountdownStatus.Abandon;
            TransactionOptions transactionOptions = new TransactionOptions();

            transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
            {
                if (entity.IsReservedQty == 1)
                {
                    UpdateReservedQTY(entity);
                }
                SetVirtualQty_WhenCountDownAbandon(entity, SysNo);
                if (entity.IsPromotionSchedule == 1)
                {
                    SecKillDA.RollbackMaxPerOrder(entity.ProductSysNo);
                }
                SecKillDA.CountDownEndReleaseWithholdQty(entity.SysNo);
                SecKillDA.UpdateCountdownStatus(entity);
                SecKillDA.UpdateProduct_Ex(entity.ProductSysNo, string.Empty);
                ts.Complete();
            }
        }