예제 #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));
            }
        }
예제 #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);
        }
예제 #3
0
        private string GetPublishFunctionTree()
        {
            string returnValue = "";
            string cachekey    = "__bb_allfunction_treehtml";
            object o           = MyCache <string> .Get(cachekey);

            if (o != null)
            {
                returnValue = o.ToString();
            }
            else
            {
                List <FunctionEntity> list        = this.SelectAllFunctions();
                StringBuilder         sbTree_Html = new StringBuilder();
                List <FunctionEntity> k1          = list.FindAll((_k) => { return(_k.Function_Level == 1 && _k.Function_IsNew == 1 && _k.Function_isValid == 1); });
                List <FunctionEntity> k2          = list.FindAll((_k) => { return(_k.Function_Level == 2 && _k.Function_IsNew == 1 && _k.Function_isValid == 1); });

                foreach (FunctionEntity k in k1)
                {
                    sbTree_Html.Append("<li class=\"open\"><input class=\"ace-checkbox-2\" type=\"checkbox\" checktype=\"public\" onclick=\"checkchange(this);\"  level=\"");
                    sbTree_Html.Append(k.Function_Level.ToString());
                    sbTree_Html.Append("\" value=\"");
                    sbTree_Html.Append(k.Function_ID);
                    sbTree_Html.Append("\" /><span>");
                    sbTree_Html.Append(k.Function_Name);
                    sbTree_Html.Append("</span>");
                    List <FunctionEntity> thissubkinds = k2.FindAll((_k) => { return(_k.Function_ParentID == k.Function_ID); });
                    if (thissubkinds.Count > 0)
                    {
                        sbTree_Html.Append("<ul>");
                        foreach (FunctionEntity _subkind in thissubkinds)
                        {
                            sbTree_Html.Append("<li><input class=\"ace-checkbox-2\" type=\"checkbox\" checktype=\"public\" onclick=\"checkchange(this);\"  level=\"");
                            sbTree_Html.Append(_subkind.Function_Level.ToString());
                            sbTree_Html.Append("\" value=\"");
                            sbTree_Html.Append(_subkind.Function_ID);
                            sbTree_Html.Append("\" /><span>");
                            sbTree_Html.Append(_subkind.Function_Name);
                            sbTree_Html.Append("</span>");
                            sbTree_Html.Append("</li>");
                        }
                        sbTree_Html.Append("</ul>");
                    }
                    sbTree_Html.Append("</li>");
                }

                MyCache <string> .Insert(cachekey, sbTree_Html.ToString());

                returnValue = sbTree_Html.ToString();
            }

            return(returnValue);
        }
예제 #4
0
        /// <summary>
        /// 以展场id为主键,查询所有展商
        /// </summary>
        /// <param name="exhibitionID">展场id</param>
        /// <returns>展商List集合</returns>
        public List <ActivityToCustomerEntity> GetActivityEntityListUseMyCache(int exhibitionID)
        {
            string key = string.Format(WebKeys.ActivityCacheKey, exhibitionID.ToString());
            List <ActivityToCustomerEntity> list = MyCache <List <ActivityToCustomerEntity> > .Get(key);

            if (list == null)
            {
                list = this.GetActivityEntityList(exhibitionID);
                MyCache <List <ActivityToCustomerEntity> > .Insert(key, list, 600);
            }

            return(list);
        }
예제 #5
0
        /// <summary>
        /// 获得查询关键词使用缓存
        /// </summary>
        /// <param name="exhibitionID"></param>
        /// <returns></returns>
        public List <SearchKeyWordEntity> GetSearchKeyWordEntityListUseMyCache(int exhibitionID)
        {
            string key = string.Format(WebKeys.SearchKeyWordyCacheKey, exhibitionID.ToString());
            List <SearchKeyWordEntity> list = MyCache <List <SearchKeyWordEntity> > .Get(key);

            if (list == null)
            {
                list = this.GetSearchKeyWordEntityList(exhibitionID);
                MyCache <List <SearchKeyWordEntity> > .Insert(key, list, 600);
            }

            return(list);
        }
예제 #6
0
        /// <summary>
        /// 设定绝对的过期时间
        /// </summary>
        /// <param name="CacheKey"></param>
        /// <param name="objObject"></param>
        /// <param name="seconds">超过多少秒后过期</param>
        private void SetAbsoluteExpirationCache(string CacheKey, object obj, int seconds)
        {
            MyCache <string> .Insert(CacheKey, "1", seconds / 5);

            //Cache objCache = HttpRuntime.Cache;
            //if (objCache.Get(cacheTimeoutName) == null)
            //{
            //    lock (cacheobj)
            //    {
            //         if (objCache.Get(cacheTimeoutName) == null)
            //         {
            //             objCache.Insert(CacheKey, obj, null, System.DateTime.Now.AddSeconds(Seconds), TimeSpan.Zero);
            //         }
            //    }
            //}
        }
예제 #7
0
        /// <summary>
        /// 得到春联  使用缓存
        /// </summary>
        /// <param name="isReload"></param>
        /// <returns></returns>
        public List <FuImageEntity> GetFuImageEntityListWithCache(bool isReload = false)
        {
            string key = WebKeys.FuimageCacheKey;
            List <FuImageEntity> list = null;

            if (!isReload)
            {
                list = MyCache <List <FuImageEntity> > .Get(key);
            }
            if (list == null)
            {
                list = this.GetFuImageList();
                MyCache <List <FuImageEntity> > .Insert(key, list, 60);
            }

            return(list);
        }
예제 #8
0
        /// <summary>
        /// 得到春联  使用缓存
        /// </summary>
        /// <param name="isReload"></param>
        /// <returns></returns>
        public List <CoupletGroupEntity> GetCoupletGroupEntityListWithCache(bool isReload = false)
        {
            string key = WebKeys.CoupletCacheKey;
            List <CoupletGroupEntity> list = null;

            if (!isReload)
            {
                list = MyCache <List <CoupletGroupEntity> > .Get(key);
            }
            if (list == null)
            {
                list = this.GetCoupletGroupEntityList();
                MyCache <List <CoupletGroupEntity> > .Insert(key, list, 60);
            }

            return(list);
        }
예제 #9
0
        /// <summary>
        /// 根据查询前三级分类
        /// </summary>
        /// <param name="kid"></param>
        /// <returns></returns>
        public List <FunctionEntity> SelectAllFunctions()
        {
            string cache_key = "BB__AllFunction";
            object o         = MyCache <List <FunctionEntity> > .Get(cache_key);

            if (o == null)
            {
                DataTable             dt        = functiondao.GetAllFunction().Tables[0];
                List <FunctionEntity> functions = new List <FunctionEntity>();
                foreach (DataRow dr in dt.Rows)
                {
                    FunctionEntity f = new FunctionEntity();
                    f.Function_URL_New  = dr[7].ToString();
                    f.Function_ID       = int.Parse(dr["Function_ID"].ToString());
                    f.Function_IsNew    = int.Parse(dr["Function_IsNew"].ToString());
                    f.Function_isValid  = int.Parse(dr["Function_isValid"].ToString());
                    f.Function_Level    = int.Parse(dr["Function_Level"].ToString());
                    f.Function_Name     = dr["Function_Name"].ToString();
                    f.Function_Order    = dr["Function_Order"].ToString();
                    f.Function_ParentID = int.Parse(dr["Function_ParentID"].ToString());
                    f.Function_URL      = dr["Function_URL"].ToString();


                    functions.Add(f);
                }
                if (functions.Count > 0)
                {
                    MyCache <List <FunctionEntity> > .Insert(cache_key, functions);
                }
                return(functions);
            }
            else
            {
                return(o as List <FunctionEntity>);
            }
        }