/// <summary>
        /// 查询数据,带分页
        /// </summary>
        /// <param name="pageIndex">当前第几页,从1开始</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalRecords">返回总记录数</param>
        /// <param name="where">附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="order">排序字段,不加“order by”</param>
        /// <param name="fieldList">设置需要返回的字段</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时随机取连接key</param>
        /// <param name="pageEnum">使用哪种分页方式(not_in、max_top、top_top、row_number、mysql、oracle、sqlite)</param>
        /// <returns>返回实体记录集</returns>
        public static IList <IpHistory> SelectPageList(int pageIndex, int pageSize, out long totalRecords, string dbkey = "", Where where = null, string order = "", string fieldList = "", PagerSQLEnum pageEnum = PagerSQLEnum.sqlite)
        {
            string            cacheNameKey    = "TH.Mailer.IpHistoryCache_SelectPageList_{0}_{1}_{2}_{3}_{4}".FormatWith(pageIndex, pageSize, where, order, fieldList);
            string            cacheRecordsKey = "TH.Mailer.IpHistoryCache_RecordsSelectPageList_{0}_{1}_{2}_{3}_{4}".FormatWith(pageIndex, pageSize, where, order, fieldList);
            IList <IpHistory> list            = (IList <IpHistory>)Cache2.Get(cacheNameKey);

            if (!list.IsNull())
            {
                totalRecords = (int)Cache2.Get(cacheRecordsKey); return(list);
            }

            using (PagerSQLHelper s = new PagerSQLHelper(pageEnum)) {
                list = s.GetSQL(pageIndex, pageSize, IpHistory._, IpHistory._IP, fieldList.IfNullOrEmpty("[IP],[CreateTime],"), where, "", order).ToList <IpHistory>(out totalRecords, dbkey);
            }
            Cache2.Insert(cacheNameKey, list, cacheSeconds);
            Cache2.Insert(cacheRecordsKey, totalRecords, cacheSeconds);
            return(list);
        }
Esempio n. 2
0
        /// <summary>
        /// 查询数据,带分页
        /// </summary>
        /// <param name="pageIndex">当前第几页,从1开始</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalRecords">返回总记录数</param>
        /// <param name="where">附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="order">排序字段,不加“order by”</param>
        /// <param name="fieldList">设置需要返回的字段</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时随机取连接key</param>
        /// <param name="pageEnum">使用哪种分页方式(not_in、max_top、top_top、row_number、mysql、oracle、sqlite)</param>
        /// <returns>返回实体记录集</returns>
        public static IList <SmtpList> SelectPageList(int pageIndex, int pageSize, out long totalRecords, string dbkey = "", Where where = null, string order = "", string fieldList = "", PagerSQLEnum pageEnum = PagerSQLEnum.sqlite)
        {
            string           cacheNameKey    = "TH.Mailer.SmtpListCache_SelectPageList_{0}_{1}_{2}_{3}_{4}".FormatWith(pageIndex, pageSize, where, order, fieldList);
            string           cacheRecordsKey = "TH.Mailer.SmtpListCache_RecordsSelectPageList_{0}_{1}_{2}_{3}_{4}".FormatWith(pageIndex, pageSize, where, order, fieldList);
            IList <SmtpList> list            = (IList <SmtpList>)Cache2.Get(cacheNameKey);

            if (!list.IsNull())
            {
                totalRecords = (int)Cache2.Get(cacheRecordsKey); return(list);
            }

            using (PagerSQLHelper s = new PagerSQLHelper(pageEnum)) {
                list = s.GetSQL(pageIndex, pageSize, SmtpList._, SmtpList._SmtpServer, fieldList.IfNullOrEmpty("[SmtpServer],[SmtpPort],[UserName],[SPassword],[SSL],[Status],[Sends],[SendFails],[CreateTime],"), where, "", order).ToList <SmtpList>(out totalRecords, dbkey);
            }
            Cache2.Insert(cacheNameKey, list, cacheSeconds);
            Cache2.Insert(cacheRecordsKey, totalRecords, cacheSeconds);
            return(list);
        }
Esempio n. 3
0
        /// <summary>
        /// 查询数据,带分页
        /// </summary>
        /// <param name="pageIndex">当前第几页,从1开始</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalRecords">返回总记录数</param>
        /// <param name="where">附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="order">排序字段,不加“order by”</param>
        /// <param name="fieldList">设置需要返回的字段</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时随机取连接key</param>
        /// <param name="pageEnum">使用哪种分页方式(not_in、max_top、top_top、row_number、mysql、oracle、sqlite)</param>
        /// <returns>返回实体记录集</returns>
        public static IList <EmailList> SelectPageList(int pageIndex, int pageSize, out long totalRecords, string dbkey = "", Where where = null, string order = "", string fieldList = "", PagerSQLEnum pageEnum = PagerSQLEnum.sqlite)
        {
            string            cacheNameKey    = "TH.Mailer.EmailListCache_SelectPageList_{0}_{1}_{2}_{3}_{4}".FormatWith(pageIndex, pageSize, where, order, fieldList);
            string            cacheRecordsKey = "TH.Mailer.EmailListCache_RecordsSelectPageList_{0}_{1}_{2}_{3}_{4}".FormatWith(pageIndex, pageSize, where, order, fieldList);
            IList <EmailList> list            = (IList <EmailList>)Cache2.Get(cacheNameKey);

            if (!list.IsNull())
            {
                totalRecords = (int)Cache2.Get(cacheRecordsKey); return(list);
            }

            using (PagerSQLHelper s = new PagerSQLHelper(pageEnum)) {
                list = s.GetSQL(pageIndex, pageSize, EmailList._, EmailList._EmailAddress, fieldList.IfNullOrEmpty("[EmailAddress],[NickName],[LastSendStatus],[LastSendError],[LastSendTime],[LastSendSmtp],[SendCount],[CreateTime],[ex0],[ex1],[ex2],[ex3],[ex4],[ex5],[ex6],[ex7],[ex8],"), where, "", order).ToList <EmailList>(out totalRecords, dbkey);
            }
            Cache2.Insert(cacheNameKey, list, cacheSeconds);
            Cache2.Insert(cacheRecordsKey, totalRecords, cacheSeconds);
            return(list);
        }