public ShoutCollection FetchAll()
 {
     ShoutCollection coll = new ShoutCollection();
     Query qry = new Query(Shout.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
示例#2
0
        public static ShoutCollection GetDeltaShouts(int hostID, string username, int? chatID, int lastReceivedShoutID)
        {
            //TODO: GJ: PERFORMANCE: we should check a token in the cache before retreiving the full list.
            //                       This would remove the need to retreive a full page of shouts from the cache just to check the newest ID
            ShoutCollection deltaShouts = new ShoutCollection();
            ShoutCollection latestShouts = GetLatestShouts(hostID, username, chatID);

            if (latestShouts.Count > 0 && latestShouts[0].ShoutID > lastReceivedShoutID) {
                foreach (Shout shout in latestShouts) {
                    if (shout.ShoutID > lastReceivedShoutID)
                        deltaShouts.Add(shout);
                }
            }

            return deltaShouts;
        }
示例#3
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;
        }
示例#4
0
 public void DataBind(ShoutCollection shouts)
 {
     this._shouts = shouts;
 }
示例#5
0
 public ShoutList(ShoutCollection shouts)
 {
     this.DataBind(shouts);
 }
 public ShoutCollection FetchByQuery(Query qry)
 {
     ShoutCollection coll = new ShoutCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
 public ShoutCollection FetchByID(object ShoutID)
 {
     ShoutCollection coll = new ShoutCollection().Where("ShoutID", ShoutID).Load();
     return coll;
 }
示例#8
0
 public void DataBind(ShoutCollection shouts, int toUserID)
 {
     this.DataBind(shouts);
     this._toUserID = toUserID;
 }
示例#9
0
 public void DataBind(ShoutCollection shouts)
 {
     _shouts = shouts;
     this.ShoutList.DataBind(_shouts);
 }