- src.zip
- Data
- Dependencies
- Microsoft.Practices.EnterpriseLibrary.Common.dll
- Microsoft.Practices.EnterpriseLibrary.Data.dll
- Recaptcha.dll
- UrlRewritingNet.UrlRewriter.dll
- Documents
- SiberTek.Xenta.sln
- SiberTek.Xenta.vssscc
- Src
- BLL
- Xenta.Content
- Xenta.Core
- Xenta.Forum
- Xenta.System
- Common
- Xenta.Common.Content
- Xenta.Common.Core
- Xenta.Common.Forum
- Xenta.Common.System
- DAL
- Xenta.Data.Content
- Xenta.Data.Core
- Xenta.Data.Forum
- Xenta.Data.MsSqlServer.Content
- Xenta.Data.MsSqlServer.Core
- Xenta.Data.MsSqlServer.Forum
- Xenta.Data.MsSqlServer.System
- Xenta.Data.System
- Presentation
- Web
- Xenta.Web.Admin
- Xenta.Web.FileStorage
- Xenta.Web.Forum
- Xenta.Web.Home
- Xenta.Web.System
- Xenta.Presentation.Content
- Xenta.Presentation.Core
- bin
- Debug
- Presenters
- Properties
- AssemblyInfo.cs
- DataSources
- KST.Web.Engine.Services.Data.Localization.Languages.Language.datasource
- KST.Web.Engine.Services.Data.Resources.Strings.StringResource.datasource
- KST.Web.Engine.Services.Data.Users.User.datasource
- Resources
- UserContext.cs
- Utils
- Xenta.Presentation.Core.csproj
- Xenta.Presentation.Core.csproj.vspscc
- Xenta.Presentation.Forum
- Xenta.Presentation.System
- Services
- Xenta.Services.Content.Client
- Xenta.Services.Content.Common
- Xenta.Services.Content
- Xenta.Services.Core.Client
- Xenta.Services.Core.Common
- Xenta.Services.Core
- Xenta.Services.Forum.Client
- Xenta.Services.Forum.Common
- Xenta.Services.Forum
- Xenta.Services.Host
- Xenta.Services.System
- Tools
- Xenta.Tools.Installer
|
using System;
using System.ComponentModel;
using System.Web.UI.WebControls;
using SiberTek.Xenta.Enums;
using SiberTek.Xenta.Presentation;
using SiberTek.Xenta.Presentation.Presenters;
using SiberTek.Xenta.Presentation.Utils;
using SiberTek.Xenta.Presentation.Views;
using SiberTek.Xenta.Presentation.Resources;
using SiberTek.Xenta.Web.Controls;
using SiberTek.Xenta.Web.Utils;
namespace SiberTek.Xenta.Web.Forum.Modules
{
public partial class ForumTopicGrid : ViewBase<ForumTopicPresenter>, IPageable, IGrid
{
#region Properties
[Browsable(false)]
public string SearchTerm
{
get
{
return Convert.ToString(ViewState["SearchTerm"]);
}
set
{
ViewState["SearchTerm"] = value;
}
}
[Browsable(false)]
public int? ForumID
{
get
{
return (int?)ViewState["ForumID"];
}
set
{
ViewState["ForumID"] = value;
}
}
[Browsable(false)]
public int? AuthorID
{
get
{
return (int?)ViewState["AuthorID"];
}
set
{
ViewState["AuthorID"] = value;
}
}
[Browsable(false)]
public ForumTopicType? Type
{
get
{
return (ForumTopicType?)ViewState["Type"];
}
set
{
ViewState["Type"] = value;
}
}
public ForumTopicOrderBy OrderBy
{
get
{
return ViewState["OrderBy"] == null ? ForumTopicOrderBy.CreatedOn : (ForumTopicOrderBy)ViewState["OrderBy"];
}
set
{
ViewState["OrderBy"] = value;
}
}
public ForumTopicType TopicType
{
get
{
return ViewState["TopicType"] == null ? ForumTopicType.Normal : (ForumTopicType)ViewState["TopicType"];
}
set
{
ViewState["TopicType"] = value;
}
}
[Browsable(false)]
public int PageIndex
{
get
{
return Convert.ToInt32(ViewState["PageIndex"]);
}
set
{
ViewState["PageIndex"] = value;
}
}
public int PageSize
{
get
{
return ViewState["PageSize"] == null ? Int32.MaxValue : Convert.ToInt32(ViewState["PageSize"]);
}
set
{
ViewState["PageSize"] = value;
}
}
[Browsable(false)]
public int PageCount
{
get
{
return Convert.ToInt32(ViewState["PageCount"]);
}
private set
{
ViewState["PageCount"] = value;
}
}
public int RowCount
{
get
{
return gvForumTopicGrid.Rows.Count;
}
}
#endregion
#region Methods
public override void BindData()
{
DataContainer["SearchTerm"] = SearchTerm;
DataContainer["ForumID"] = ForumID;
DataContainer["AuthorID"] = AuthorID;
DataContainer["Type"] = Type;
DataContainer["ShowHidden"] = false;
DataContainer["OrderBy"] = OrderBy;
DataContainer["StartIndex"] = PageIndex * PageSize;
DataContainer["Type"] = TopicType;
DataContainer["Count"] = PageSize;
Presenter.LoadCollection();
PageCount = (int)DataContainer["TotalCount"] % PageSize == 0 ? (int)DataContainer["TotalCount"] / PageSize : (int)DataContainer["TotalCount"] / PageSize + 1;
gvForumTopicGrid.DataSource = DataContainer["ForumTopicCollection"];
gvForumTopicGrid.DataBind();
base.BindData();
}
public void SetColumnVisibility(int index, bool value)
{
if(index >= 0 && index < gvForumTopicGrid.Columns.Count)
{
gvForumTopicGrid.Columns[index].Visible = value;
}
}
#endregion
#region Handlers
protected override void OnInit(EventArgs e)
{
if(!IsPostBack)
{
gvForumTopicGrid.Columns[0].HeaderText = StringManager.GetString("Forum.ForumTopicGrid.colDetails.HeaderText");
gvForumTopicGrid.Columns[1].HeaderText = StringManager.GetString("Forum.ForumTopicGrid.colAuthor.HeaderText");
gvForumTopicGrid.Columns[2].HeaderText = StringManager.GetString("Forum.ForumTopicGrid.colPostCount.HeaderText");
gvForumTopicGrid.Columns[3].HeaderText = StringManager.GetString("Forum.ForumTopicGrid.colCreatedOn.HeaderText");
gvForumTopicGrid.EmptyDataText = StringManager.GetString("Forum.ForumTopicGrid.EmptyDataText");
}
base.OnInit(e);
}
protected void GvForumTopicGrid_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow row = e.Row;
if(row.RowType == DataControlRowType.DataRow)
{
ViewDataContainer item = e.Row.DataItem as ViewDataContainer;
if(item != null)
{
Literal lblAuthor = row.FindControl("lblAuthor") as Literal;
HyperLink lnkDetails = row.FindControl("lnkDetails") as HyperLink;
Literal lblCreatedOn = row.FindControl("lblCreatedOn") as Literal;
Literal lblPostCount = row.FindControl("lblPostCount") as Literal;
lblAuthor.Text = MembershipHelper.GetUsername((int)item["AuthorID"]);
lnkDetails.Text = (string)item["Title"];
lnkDetails.NavigateUrl = UrlHelper.FormatUrl("forum", "topic/{0}.aspx", item["TopicID"]);
lnkDetails.Enabled = ForumHelper.IsUserHasForumTopicPermission((int)item["TopicID"], UserContext.Current.UserID, (int)ForumPermission.ForumRead);
lblPostCount.Text = item["PostCount"].ToString();
lblCreatedOn.Text = UserContext.Current.DateTimeToDateString((DateTime)item["CreatedOn"]);
}
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.