Beispiel #1
0
        /// <summary>
        /// 获取持仓内存表,如果内存中不存在,那么再到数据库查找
        /// </summary>
        /// <param name="accountHoldLogoId">持仓id</param>
        /// <returns></returns>
        public static QHHoldMemoryTable GetHoldMemoryTable(int accountHoldLogoId)
        {
            QHHoldMemoryTable holdMemory = null;

            try
            {
                holdMemory = MemoryDataManager.QHHoldMemoryList.GetByAccountHoldLogoId(accountHoldLogoId);
                //如果持仓为空,那么先从数据库加载,看是不是内存表没有加载
                if (holdMemory == null)
                {
                    QH_HoldAccountTableDal dal = new QH_HoldAccountTableDal();
                    var hold = dal.GetModel(accountHoldLogoId);
                    //如果数据库有,那么直接加载到内存表中
                    if (hold != null)
                    {
                        MemoryDataManager.QHHoldMemoryList.AddQHHoldAccountTableToMemeory(hold);
                    }
                    else
                    {
                        //如果数据库也没有,那么代表无持仓
                        return(null);
                    }

                    holdMemory = MemoryDataManager.QHHoldMemoryList.GetByAccountHoldLogoId(accountHoldLogoId);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("QHCommonLogic.GetHoldMemoryTable-" + ex.Message, ex);
            }

            return(holdMemory);
        }
Beispiel #2
0
        /// <summary>
        /// 获取指定id持仓
        /// </summary>
        /// <param name="k"></param>
        /// <returns></returns>
        public QH_HoldAccountTableInfo GetBaseTable(int k)
        {
            QH_HoldAccountTableDal dal = new QH_HoldAccountTableDal();

            return(dal.GetModel(k));
        }