void GetData(object sender, EventArgs e) { if (DiscussionId <= 0) { return; } gridManage.CurrentPageIndex = 0; DiscussionViewTypes type = GetDiscussionViewType(); switch (type) { case DiscussionViewTypes.FlatWithNewestOnTop: case DiscussionViewTypes.FlatFullWithNewestOnTop: gridManage.VirtualItemCount = SessionManager.GetCount <DiscussionService.TransitDiscussionPost, DiscussionService.ServiceQueryOptions, int>( DiscussionId, SessionManager.DiscussionService.GetDiscussionPostsCount); break; case DiscussionViewTypes.ThreadedWithNewestOnTop: case DiscussionViewTypes.ThreadedFullWithNewestOnTop: default: gridManage.VirtualItemCount = SessionManager.GetCount <DiscussionService.TransitDiscussionPost, DiscussionService.ServiceQueryOptions, int>( DiscussionId, SessionManager.DiscussionService.GetDiscussionThreadsCountByDiscussionId); break; } gridManage_OnGetDataSource(sender, e); gridManage.DataBind(); linkPosts.Visible = (gridManage.VirtualItemCount == 0); }
void gridManage_OnGetDataSource(object sender, EventArgs e) { if (DiscussionId <= 0) { return; } DiscussionService.TransitDiscussion d = GetDiscussion(); DiscussionService.ServiceQueryOptions options = new DiscussionService.ServiceQueryOptions(); options.PageNumber = gridManage.CurrentPageIndex; options.PageSize = gridManage.PageSize; DiscussionViewTypes type = GetDiscussionViewType(); switch (type) { case DiscussionViewTypes.FlatWithNewestOnTop: case DiscussionViewTypes.FlatFullWithNewestOnTop: gridManage.DataSource = SessionManager.GetCollection <DiscussionService.TransitDiscussionPost, DiscussionService.ServiceQueryOptions, int>( DiscussionId, options, SessionManager.DiscussionService.GetLatestDiscussionPostsById); break; case DiscussionViewTypes.ThreadedWithNewestOnTop: case DiscussionViewTypes.ThreadedFullWithNewestOnTop: default: gridManage.DataSource = SessionManager.GetCollection <DiscussionService.TransitDiscussionPost, DiscussionService.ServiceQueryOptions, int>( DiscussionId, options, SessionManager.DiscussionService.GetDiscussionThreadsByDiscussionId); break; } }
void gridManage_OnGetDataSource(object sender, EventArgs e) { if (!HasRows) { return; } gridManage.RepeatRows = mDefaultViewRows.HasValue ? mDefaultViewRows.Value : GetDiscussion().DefaultViewRows; ServiceQueryOptions options = new ServiceQueryOptions(); options.PageNumber = gridManage.CurrentPageIndex; options.PageSize = gridManage.PageSize; DiscussionViewTypes type = GetDiscussionViewType(); switch (type) { case DiscussionViewTypes.FlatWithNewestOnTop: case DiscussionViewTypes.FlatFullWithNewestOnTop: gridManage.DataSource = SessionManager.GetCollection <TransitDiscussionPost, int>( DiscussionId, options, SessionManager.DiscussionService.GetLatestDiscussionPostsById); break; case DiscussionViewTypes.ThreadedWithNewestOnTop: case DiscussionViewTypes.ThreadedFullWithNewestOnTop: default: gridManage.DataSource = SessionManager.GetCollection <TransitDiscussionPost, int>( DiscussionId, options, SessionManager.DiscussionService.GetDiscussionThreadsByDiscussionId); break; } }
public DiscussionViewTypes GetDiscussionViewType() { DiscussionService.TransitDiscussion d = GetDiscussion(); DiscussionViewTypes type = DiscussionViewTypes.ThreadedWithNewestOnTop; if (!string.IsNullOrEmpty(d.DefaultView)) { type = (DiscussionViewTypes)Enum.Parse(typeof(DiscussionViewTypes), d.DefaultView); } return(type); }
public DiscussionViewType(DiscussionViewTypes view, string description) { mView = view; mDescription = description; }