示例#1
0
        public static ShoutCollection GetPage(int hostID, int?toUserID, int?chatID, int pageIndex, int pageSize)
        {
            Query query = new Query(Shout.Schema).WHERE(Shout.Columns.HostID, hostID).ORDER_BY(Shout.Columns.CreatedOn, "DESC");

            if (toUserID.HasValue)
            {
                query = query.WHERE(Shout.Columns.ToUserID, toUserID.Value);
            }
            else
            {
                query = query.WHERE(Shout.Columns.ToUserID, Comparison.Is, null);
            }

            if (chatID.HasValue)
            {
                query = query.WHERE(Shout.Columns.ChatID, chatID.Value);
            }
            else
            {
                query = query.WHERE(Shout.Columns.ChatID, Comparison.Is, null);
            }

            query.PageIndex = pageIndex;
            query.PageSize  = pageSize;

            ShoutCollection shouts = new ShoutCollection();

            shouts.Load(query.ExecuteReader());
            return(shouts);
        }
示例#2
0
        public ShoutCollection FetchByQuery(Query qry)
        {
            ShoutCollection coll = new ShoutCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
示例#3
0
        public ShoutCollection FetchAll()
        {
            ShoutCollection coll = new ShoutCollection();
            Query           qry  = new Query(Shout.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
示例#4
0
        public ShoutCollection FetchByID(object ShoutID)
        {
            ShoutCollection coll = new ShoutCollection().Where("ShoutID", ShoutID).Load();

            return(coll);
        }