예제 #1
0
    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);
    }
예제 #2
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;
        }
    }
예제 #3
0
    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;
        }
    }
예제 #4
0
    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);
    }
예제 #5
0
 public DiscussionViewType(DiscussionViewTypes view, string description)
 {
     mView        = view;
     mDescription = description;
 }
예제 #6
0
 public DiscussionViewType(DiscussionViewTypes view, string description)
 {
     mView = view;
     mDescription = description;
 }