Пример #1
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();
            }
        }
Пример #2
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();
            }
        }
Пример #3
0
        public void ImportPointLog()
        {
            if ( !AppConfig.IsImportable)
                throw new BizException("Is Importable is false");

            /*  do not  use the following code after Data Pour in */
            string sql = " select top 1 * from Customer_PointLog ";
            DataSet ds = SqlHelper.ExecuteDataSet(sql);
            if ( Util.HasMoreRow(ds) )
                throw new BizException("the table Point log is not empty");

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                //������ipp2003�������log amtΪ��ļ�¼
                new PointDac().DeleteLog();

                string sql1 = @"select pkid as sysno, customersysno, logtype as pointlogtype,amount as pointamount, logtime as createtime, memo, '' as LogCheck
                                from ipp2003..pointlog order by sysno";
                DataSet ds1 = SqlHelper.ExecuteDataSet(sql1);
                foreach(DataRow dr1 in ds1.Tables[0].Rows )
                {
                    CustomerPointLogInfo oPoint = new CustomerPointLogInfo();
                    map(oPoint, dr1);
                    oPoint.LogCheck = oPoint.CalcLogCheck();
                    new PointDac().InsertLog(oPoint);
                }
                scope.Complete();
            }
        }