public void DeleteEntityList(List <string> ids, ReckoningTransaction trans)
        {
            if (Utils.IsNullOrEmpty(ids))
            {
                return;
            }
            //陈武民修改 修改时间 2009年07月09日
            // TransactionManager tm = TransactionFactory.GetTransactionManager();
            //tm.BeginTransaction();

            try
            {
                // DataRepository.BdUnReckonedDealTableProvider.Delete(tm, id);
                // tm.Commit();
                BD_UnReckonedDealTableDal dal = new BD_UnReckonedDealTableDal();



                //lock (((ICollection) hasSendSet).SyncRoot)
                //    hasSendSet.Remove(id);

                hasSendSetLock.EnterWriteLock();
                try
                {
                    foreach (var id in ids)
                    {
                        dal.Delete(id, trans.Database, trans.Transaction);
                        hasSendSet.Remove(id);
                        LogHelper.WriteDebug("$-------$CrashManger.DeleteEntity成交回报删除成功!ID=" + id);
                    }
                }
                finally
                {
                    hasSendSetLock.ExitWriteLock();
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("$-------$CrashManager.SaveEntity成交回报删除失败!", ex);
                //tm.Rollback();
            }
        }
        private void SaveEntity(BD_UnReckonedDealTableInfo table)
        {
            //陈武民修改 修改时间 2009年07月09日
            table.CounterID = CountID;
            BD_UnReckonedDealTableDal dal = new BD_UnReckonedDealTableDal();

            //TransactionManager tm = TransactionFactory.GetTransactionManager();
            //tm.BeginTransaction();

            try
            {
                dal.Add(table);
                // DataRepository.BdUnReckonedDealTableProvider.Insert(tm, table);
                //tm.Commit();
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("$-------$CrashManager.SaveEntity成交回报保存失败!", ex);
                //tm.Rollback();
            }
        }
        private void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (isChecking)
            {
                return;
            }

            isChecking = true;
            //LogHelper.WriteDebug("CrashManager.CheckUnReckonedDeal");
            //陈武民修改 2009年7月9日
            string where = string.Format("CounterId = '{0}' ", CountID);
            BD_UnReckonedDealTableDal dal = new BD_UnReckonedDealTableDal();
            //var tables = DataRepository.BdUnReckonedDealTableProvider.Find(where);
            var tables = dal.GetListArray(where);
            int i      = 0;

            foreach (BD_UnReckonedDealTableInfo table in tables)
            {
                if (IsReckoning(table.id))
                {
                    continue;
                }

                if (string.IsNullOrEmpty(table.CounterID))
                {
                    continue;
                }

                //if (!hasSendSet.Contains(table.Id))
                //{
                //    i++;
                //    ProcessTable(table);

                //    lock (((ICollection) hasSendSet).SyncRoot)
                //        hasSendSet.Add(table.Id);
                //}

                hasSendSetLock.EnterUpgradeableReadLock();
                try
                {
                    if (!hasSendSet.Contains(table.id))
                    {
                        i++;
                        ProcessTable(table);

                        hasSendSetLock.EnterWriteLock();
                        try
                        {
                            hasSendSet.Add(table.id);
                        }
                        finally
                        {
                            hasSendSetLock.ExitWriteLock();
                        }
                    }
                }
                finally
                {
                    hasSendSetLock.ExitUpgradeableReadLock();
                }
            }

            if (i > 0)
            {
                string format = "CrashManager.Timer进行故障恢复,当前数据库中未清算记录有{0}条,重新发送的记录有{1}条.";
                string desc   = string.Format(format, tables.Count, i);
                LogHelper.WriteDebug(desc);
            }

            isChecking = false;
        }