/// <summary>
        ///
        /// </summary>
        /// <param name="strMcOrderNo"></param>
        /// <returns></returns>
        protected override OrderCacheItem LoadCacheItemFromDB(string strMcOrderNo)
        {
            OrderCacheItem result = null;

            string where = string.Format("McOrderId = '{0}' ", strMcOrderNo);

            HK_TodayEntrustDal dal = new HK_TodayEntrustDal();
            var tets = dal.GetListArrayWithNoLock(where);

            if (!Utils.IsNullOrEmpty(tets))
            {
                try
                {
                    var tet       = tets[0];
                    var cacheItem = new OrderCacheItem(tet.CapitalAccount, tet.HoldAccount,
                                                       tet.EntrustNumber,
                                                       (
                                                           GTA.VTS.Common.CommonObject.Types.TransactionDirection)
                                                       Enum.Parse(
                                                           typeof(
                                                               GTA.VTS.Common.CommonObject.Types.TransactionDirection),
                                                           tet.BuySellTypeID.ToString
                                                               ()));
                    cacheItem.EntrustAmount = tet.EntrustAmount;
                    cacheItem.Code          = tet.Code;
                    var user = AccountManager.Instance.GetUserByAccount(tet.CapitalAccount);
                    if (user != null)
                    {
                        cacheItem.TraderId = user.UserID;
                    }
                    //else
                    //{
                    //    cacheItem.TraderId = GetTraderIdByFundAccount(tet.CapitalAccount); //TODO:需要根据资金账户获取用户ID
                    //}

                    AddOrderMappingInfo(tet.McOrderID, cacheItem);
                    result = cacheItem;
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError(ex.Message, ex);
                }
            }

            return(result);
        }
        /// <summary>
        /// 依据撮合中心返回的委托单号获取
        /// </summary>
        /// <param name="strMcOrderNo"></param>
        /// <returns></returns>
        public OrderCacheItem GetOrderMappingInfo(string strMcOrderNo)
        {
            OrderCacheItem result = null;

            if (string.IsNullOrEmpty(strMcOrderNo))
            {
                return(result);
            }

            _orderMappingBufferLock.EnterReadLock();
            try
            {
                if (_orderMappingBuffer.ContainsKey(strMcOrderNo))
                {
                    result = _orderMappingBuffer[strMcOrderNo];
                }
            }
            finally
            {
                _orderMappingBufferLock.ExitReadLock();
            }

            //lock (((ICollection) _orderMappingBuffer).SyncRoot)
            //{
            //    if (_orderMappingBuffer.ContainsKey(strMcOrderNo))
            //        result = _orderMappingBuffer[strMcOrderNo];
            //}

            try
            {
                //如果当前缓存中找不到,那么从数据库查找
                if (result == null)
                {
                    result = LoadCacheItemFromDB(strMcOrderNo);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.Message, ex);
            }

            return(result);
        }
        /// <summary>
        /// 添加委托映射关系
        /// </summary>
        /// <param name="strMcOrderNo"></param>
        /// <param name="item"></param>
        public void AddOrderMappingInfo(string strMcOrderNo, OrderCacheItem item)
        {
            //lock (((ICollection) _orderMappingBuffer).SyncRoot)
            //{
            //    if (!_orderMappingBuffer.ContainsKey(strMcOrderNo))
            //        _orderMappingBuffer.Add(strMcOrderNo, item);
            //}

            //_orderMappingBufferLock.TryEnterWriteLock(_lockTimeout);
            //try
            //{
            //    if (!_orderMappingBuffer.ContainsKey(strMcOrderNo))
            //        _orderMappingBuffer.Add(strMcOrderNo, item);
            //}
            //finally
            //{
            //    _orderMappingBufferLock.ExitWriteLock();
            //}

            _orderMappingBufferLock.EnterUpgradeableReadLock();
            try
            {
                if (!_orderMappingBuffer.ContainsKey(strMcOrderNo))
                {
                    _orderMappingBufferLock.EnterWriteLock();
                    try
                    {
                        _orderMappingBuffer.Add(strMcOrderNo, item);
                    }
                    finally
                    {
                        _orderMappingBufferLock.ExitWriteLock();
                    }
                }
            }
            finally
            {
                _orderMappingBufferLock.ExitUpgradeableReadLock();
            }
        }