コード例 #1
0
        public void SetScore(int customerSysNo, int pointDelt, int pointLogType, string poingLogMemo)
        {
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                int rowsAffected = new PointDac().SetScore(customerSysNo, pointDelt);
                if (rowsAffected != 1)
                {
                    throw new BizException("客户积分更新失败,可能因为积分不足。");
                }

                if (pointDelt != 0)
                {
                    CustomerPointLogInfo oPointLog = new CustomerPointLogInfo(customerSysNo, pointLogType, pointDelt, poingLogMemo);
                    oPointLog.LogCheck = oPointLog.CalcLogCheck();

                    if (1 != new PointDac().InsertLog(oPointLog))
                    {
                        throw new BizException("增加积分流水失败");
                    }
                }

                scope.Complete();
            }
        }
コード例 #2
0
        //2006-08-11
        public void AddScore(int CustomerSysNo, int increment)
        {
            if (HasAddScoreForHF(CustomerSysNo, 17))
            {
                return;
            }
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                int rowsAffected = new PointDac().SetScore(CustomerSysNo, increment);
                if (rowsAffected != 1)
                {
                    throw new BizException("客户积分更新失败,可能因为积分不足。");
                }

                if (increment != 0)
                {
                    int    pointLogType            = 17;
                    string poingLogMemo            = "浩号送积分";
                    CustomerPointLogInfo oPointLog = new CustomerPointLogInfo(CustomerSysNo, pointLogType, increment, poingLogMemo);
                    oPointLog.LogCheck = oPointLog.CalcLogCheck();

                    if (1 != new PointDac().InsertLog(oPointLog))
                    {
                        throw new BizException("增加积分流水失败");
                    }
                }

                scope.Complete();
            }
        }