/// <summary>
        /// 根据条件从数据库中获取相应的基础表数据
        /// </summary>
        /// <param name="where">条件</param>
        /// <returns></returns>
        public QH_CapitalAccountTableInfo GetBaseFromDBByWhere(string where)
        {
            try
            {
                QH_CapitalAccountTableDal dal = new QH_CapitalAccountTableDal();
                string sqlWhere = "";

                if (where.Split('@').Length > 1)
                {
                    sqlWhere = string.Format("UserAccountDistributeLogo='{0}'  and  TradeCurrencyType='{1}' ", where.Split('@')[0], where.Split('@')[1]);
                }
                else
                {
                    sqlWhere = string.Format("UserAccountDistributeLogo='{0}' ", where.Split('@')[0]);
                }
                var data = dal.GetListArray(sqlWhere);
                if (data != null && data.Count > 0)
                {
                    return(data[0]);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("根据条件从数据库中获取相应的期货资金基础表数据异常:" + where + ex.Message, ex);
                return(null);
            }
        }
        /// <summary>
        /// 检查资金表,可用资金小于0的走资金强行平仓流程
        /// </summary>
        private void CheckCapitalTable(object state)
        {
            //LogHelper.WriteDebug("FutureDayChecker.CheckFundTable开始检查资金表");
            QH_CapitalAccountTableDal dal = new QH_CapitalAccountTableDal();

            //TList<QhCapitalAccountTable> list =
            //  DataRepository.QhCapitalAccountTableProvider.GetByUserAccountDistributeLogo(
            //      capitalAccount.UserAccountDistributeLogo);
            string where = string.Format("UserAccountDistributeLogo = '{0}' ", capitalAccount.UserAccountDistributeLogo);
            List <QH_CapitalAccountTableInfo> list = dal.GetListArray(where);

            if (Utils.IsNullOrEmpty(list))
            {
                return;
            }

            foreach (QH_CapitalAccountTableInfo accountTable in list)
            {
                //if (accountTable.AvailableCapital<0.00m)
                //    continue;

                List <QH_HoldAccountTableInfo> listCloseContract;
                OrderAccepter orderAccepter = OrderAccepterService.Service;

                if (accountTable.AvailableCapital < 0)
                {
                    if (accountTable.TradeCurrencyType < 0.00m)
                    {
                        continue;
                    }

                    List <QH_HoldAccountTableInfo> list2 = GetHoldAccountTableList(holdAccount.UserAccountDistributeLogo, accountTable.TradeCurrencyType);
                    if (Utils.IsNullOrEmpty(list2))
                    {
                        continue;
                    }

                    listCloseContract = FindWillCLosedContract(list2);

                    foreach (var holdTable in listCloseContract)
                    {
                        //如果不是交易日,不进行强行平仓 add by 董鹏 2010-05-05
                        if (!CommonParaProxy.GetInstance().IsTradeDate(holdTable.Contract))
                        {
                            continue;
                        }

                        //CloseStockIndexContract(orderAccepter, holdTable, 0, false);
                        #region  账户类型进行商品期货、股指期货平仓 add by 董鹏 2010-02-03
                        if (holdAccount.AccountTypeLogo == (int)Types.AccountType.CommodityFuturesHoldCode)
                        {
                            //此处原来只有HistoryHoldAmount,造成未清算成功的持仓平不掉,因此加上TodayHoldAmount;
                            //而TodayFreezeAmount清算是否成功都没有影响 -- update by 董鹏 2010-03-29
                            //平历史
                            CloseCommoditiesContract(orderAccepter, holdTable, 0, (float)holdTable.HistoryHoldAmount, Types.QHForcedCloseType.CapitalCheck, ReckoningCounter.Entity.Contants.Types.FutureOpenCloseType.ClosePosition);
                            //平今
                            CloseCommoditiesContract(orderAccepter, holdTable, 0, (float)holdTable.TodayHoldAmount, Types.QHForcedCloseType.CapitalCheck, ReckoningCounter.Entity.Contants.Types.FutureOpenCloseType.CloseTodayPosition);
                        }
                        if (holdAccount.AccountTypeLogo == (int)Types.AccountType.StockFuturesHoldCode)
                        {
                            CloseStockIndexContract(orderAccepter, holdTable, (float)holdTable.HoldAveragePrice, false);
                        }
                        #endregion
                    }
                }
            }

            //LogHelper.WriteDebug("FutureDayChecker.CheckFundTable结束检查资金表");
        }