Esempio n. 1
0
        public OrmLitePageResult <Announcement> SelectList(string title, int pageIndex, int pageSize)
        {
            StringBuilder sb = new StringBuilder();
            var           ps = DictBuilder.New();

            sb.Append("1=1");
            var orderBy = "id desc";

            title = SqlInjection.Filter(title);
            if (!string.IsNullOrEmpty(title))
            {
                sb.AppendFormat(" and Title like '%{0}%'", title);
            }

            var factor = new OrmLitePageFactor
            {
                Conditions = sb.ToString(),
                PageIndex  = pageIndex,
                PageSize   = pageSize,
                OrderBy    = orderBy,
                Params     = ps
            };

            return(announcementDao.SelectPage(factor));
        }
Esempio n. 2
0
        public OrmLitePageResult <TimedTask> SearchList(string name, bool?enable, int pageIndex, int pageSize)
        {
            var condition = "1=1";

            name = SqlInjection.Filter(name);
            if (!string.IsNullOrEmpty(name))
            {
                condition += " and Name like '%" + name + "%'";
            }

            if (enable != null)
            {
                condition += " and Enable=" + (enable.Value ? "1" : "0");
            }

            using (var db = Open())
            {
                return(db.SelectPage <TimedTask>(new OrmLitePageFactor
                {
                    PageIndex = pageIndex,
                    PageSize = pageSize,
                    OrderBy = "id desc",
                    Conditions = condition,
                }));
            }
        }
Esempio n. 3
0
 public List <SystemRole> SelectAll(string name)
 {
     name = SqlInjection.Filter(name);
     if (string.IsNullOrEmpty(name))
     {
         return(systemRoleDao.SelectAll());
     }
     else
     {
         return(systemRoleDao.Select($"name like '%{name}%'", null));
     }
 }
Esempio n. 4
0
        public OrmLitePageResult <Ad> SelectList(string title, int?adTypeId, DateTime?start, DateTime?end,
                                                 int pageIndex, int pageSize)
        {
            StringBuilder sb = new StringBuilder();
            var           ps = DictBuilder.New();

            sb.Append("1=1");
            var orderBy = "id desc";

            title = SqlInjection.Filter(title);
            if (!string.IsNullOrEmpty(title))
            {
                sb.AppendFormat(" and Title like '%{0}%'", title);
            }

            if (adTypeId > 0)
            {
                orderBy = "OrderNum";
                sb.AppendFormat(" and TypeId={0}", adTypeId);
            }

            if (start.HasValue)
            {
                sb.AppendFormat(" and EndTime>@start");
                ps.EQ("start", start.Value);
            }

            if (end.HasValue)
            {
                sb.Append(" and EndTime<@end");
                ps.EQ("end", end.Value.AddDays(1));
            }


            var factor = new OrmLitePageFactor
            {
                Conditions = sb.ToString(),
                PageIndex  = pageIndex,
                PageSize   = pageSize,
                OrderBy    = orderBy,
                Params     = ps
            };

            return(_adDao.SelectPage(factor));
        }
Esempio n. 5
0
        public OrmLitePageResult <SystemRes> SelectList(string name, int pageIndex, int pageSize)
        {
            name = SqlInjection.Filter(name);
            var condition = "";

            if (!string.IsNullOrEmpty(name))
            {
                condition = " Name LIKE '%" + name + "%'";
            }

            return(SelectPage(new OrmLitePageFactor
            {
                Conditions = condition,
                OrderBy = "ID asc",
                PageIndex = pageIndex,
                PageSize = pageSize,
            }));
        }
Esempio n. 6
0
        public OrmLitePageResult <DelayTask> SearchList(string name, int pageIndex, int pageSize)
        {
            var condition = "1=1";

            name = SqlInjection.Filter(name);
            if (!string.IsNullOrEmpty(name))
            {
                condition += " and Name like '" + name + "'";
            }

            return(_delayTaskDao.SelectPage(new OrmLitePageFactor
            {
                PageIndex = pageIndex,
                PageSize = pageSize,
                OrderBy = "id desc",
                Conditions = condition,
            }));
        }
Esempio n. 7
0
        public OrmLitePageResult <SystemUser> SelectPage(string nickname, int pageIndex, int pageSize)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("1=1");
            nickname = SqlInjection.Filter(nickname);
            if (!string.IsNullOrEmpty(nickname))
            {
                sb.AppendFormat(" and nickname like '%{0}%'", nickname);
            }

            return(SelectPage(new OrmLitePageFactor
            {
                Conditions = sb.ToString(),
                PageIndex = pageIndex,
                PageSize = pageSize,
                OrderBy = "id desc",
            }));
        }