BaseConfig/BaseBLL.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Data;
using System;
using System.Collections;
using System.Web;
using System.Text.RegularExpressions;

namespace BaseConfig.BaseBLL
{
    public class Pager
    {
        /// <summary>
        /// 获得数据列表
        /// 此方法已重写,默认为不使用缓存
        /// </summary>
        public static DataTable GetPager(int PageSize, int PageIndex, string strWhere, string order, string tablename, string cols)
        {
            return BaseDAL.Pager.GetPager(PageSize, PageIndex, strWhere, order, tablename, cols);
        }

        /// <summary>
        /// 获得数据列表
        /// <param name="modelCacheSpanTime">缓存时间,单位分钟</param>
        /// </summary>
        public static DataTable GetPager(int PageSize, int PageIndex, string strWhere, string order, string tablename, string cols, int modelCacheSpanTime)
        {
            string CacheKey = String.Format(BaseConfig.CacheKey.COMMONPAGER__TABLENAME__COLS__PAGESIZE__PAGEINDEX__WHERE__ORDER__SPANTIME,
                 tablename.ToUpper(), cols, PageSize, PageIndex, strWhere, order, modelCacheSpanTime);

            //CacheKey = StringUtil.EncryptMD5(CacheKey);
            object objModel = LTP.Common.DataCache.GetCache(CacheKey);
            if (objModel == null)
            {
                try
                {
                    objModel = BaseDAL.Pager.GetPager(PageSize, PageIndex, strWhere, order, tablename, cols);
                    if (objModel != null)
                    {
                        LTP.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddMinutes(modelCacheSpanTime), TimeSpan.Zero);
                    }
                }
                catch { }
            }
            return (DataTable)objModel;

        }

        /// <summary>
        /// 移除与某对象有关的分页缓存,这里传递表名就行了
        /// </summary>
        /// <param name="CacheKey"></param>
        /// <param name="Table"></param>
        public static void RemovePagerCache(string Table)
        {
            Table = Table.ToUpper();
            //遍历缓存
            IDictionaryEnumerator cacheEnum = HttpRuntime.Cache.GetEnumerator();
            try
            {
                if (Table.IndexOf("|") < 0)
                {
后面还有 86 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。