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

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

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

            return(holdMemory);
        }
Exemple #2
0
        /// <summary>
        /// 获取指定Id持仓
        /// </summary>
        /// <param name="k"></param>
        /// <returns></returns>
        public XH_AccountHoldTableInfo GetBaseTable(int k)
        {
            XH_AccountHoldTableDal dal = new XH_AccountHoldTableDal();

            return(dal.GetModel(k));
        }