Beispiel #1
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);
        }
Beispiel #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="PagerSQLEnum">PagerSQL 调用类型 Enum</param>
 public PagerSQLHelper(PagerSQLEnum PagerSQLEnum) {
     this.PagerSQLEnum = PagerSQLEnum;
     init();
 }
        /// <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);
        }
        /// <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<TianYiSetting> 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.TianYiSettingCache_SelectPageList_{0}_{1}_{2}_{3}_{4}".FormatWith(pageIndex, pageSize, where, order, fieldList);
            string cacheRecordsKey = "TH.Mailer.TianYiSettingCache_RecordsSelectPageList_{0}_{1}_{2}_{3}_{4}".FormatWith(pageIndex, pageSize, where, order, fieldList);
            IList<TianYiSetting> list = (IList<TianYiSetting>)Cache2.Get(cacheNameKey);
            if (!list.IsNull()) { totalRecords = (int)Cache2.Get(cacheRecordsKey); return list; }

            using (PagerSQLHelper s = new PagerSQLHelper(pageEnum)) {
                list = s.GetSQL(pageIndex, pageSize, TianYiSetting._, TianYiSetting._TianYiID, fieldList.IfNullOrEmpty("[TianYiID],[TianYiExePath],"), where, "", order).ToList<TianYiSetting>(out totalRecords, dbkey);
            }
            Cache2.Insert(cacheNameKey, list, cacheSeconds);
            Cache2.Insert(cacheRecordsKey, totalRecords, cacheSeconds);
            return list;
        }
Beispiel #5
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="PagerSQLEnum">PagerSQL 调用类型 Enum string</param>
 public PagerSQLHelper(string PagerSQLEnum) {
     this.PagerSQLEnum = PagerSQLEnum.ToEnum<PagerSQLEnum>();
     init();
 }
Beispiel #6
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;
        }
Beispiel #7
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;
        }
Beispiel #8
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="PagerSQLEnum">PagerSQL 调用类型 Enum</param>
 public PagerSQLHelper(PagerSQLEnum PagerSQLEnum)
 {
     this.PagerSQLEnum = PagerSQLEnum;
     init();
 }
Beispiel #9
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="PagerSQLEnum">PagerSQL 调用类型 Enum string</param>
 public PagerSQLHelper(string PagerSQLEnum)
 {
     this.PagerSQLEnum = PagerSQLEnum.ToEnum <PagerSQLEnum>();
     init();
 }
Beispiel #10
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);
        }