Exemplo n.º 1
0
        /// <summary>
        /// 使用缓存查询信息
        /// </summary>
        /// <param name="info">查询主体</param>
        /// <param name="totalcnt">返回条目数</param>
        /// <returns></returns>
        public DataTable QueryData(ActivitySearchEntity info, out int totalcnt)
        {
            if (info.UseDBPagination)
            {
                string key = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(info.ToJson(info), "MD5");
                DataTableRSCacheEntity rsobj = MyCache <DataTableRSCacheEntity> .Get(key);

                if (rsobj == null)
                {
                    DataTable dt = dao.QueryData(info, out totalcnt);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        rsobj = new DataTableRSCacheEntity()
                        {
                            Source = dt, TotalCnt = totalcnt
                        };
                        MyCache <DataTableRSCacheEntity> .Insert(key, rsobj, 60);
                    }
                    else
                    {
                        rsobj = new DataTableRSCacheEntity();
                    }
                }
                totalcnt = rsobj.TotalCnt;
                return(rsobj.Source);
            }
            else
            {
                return(dao.QueryData(info, out totalcnt));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取展会所有展商地址
        /// </summary>
        /// <param name="exhibitionID"></param>
        /// <returns></returns>
        public DataTable GetExhibitorLocation(int exhibitionID)
        {
            string key = string.Format(WebKeys.ExhibitorLocationConsoleCacheKey, exhibitionID.ToString());
            DataTableRSCacheEntity rsobj = MyCache <DataTableRSCacheEntity> .Get(key);

            if (rsobj == null)
            {
                DataTable dt = dao.GetExhibitorLocation(exhibitionID);
                if (dt != null && dt.Rows.Count > 0)
                {
                    rsobj = new DataTableRSCacheEntity()
                    {
                        Source = dt, TotalCnt = dt.Rows.Count
                    };
                    MyCache <DataTableRSCacheEntity> .Insert(key, rsobj, 60);
                }
                else
                {
                    rsobj = new DataTableRSCacheEntity();
                }
            }
            return(rsobj.Source);

            //return dao.GetExhibitorLocation(exhibitionID);
        }