public string Render() { ForumController fc = new ForumController(); string fs = fc.GetForumsForUser(ForumUser.UserRoles, PortalId, ModuleId, "CanEdit"); if (!(string.IsNullOrEmpty(fs))) { _canEdit = true; } System.Text.StringBuilder sb = new System.Text.StringBuilder(); string forumPrefix = string.Empty; string groupPrefix = string.Empty; _mainSettings = DataCache.MainSettings(ModuleId); if (_mainSettings.URLRewriteEnabled) { if (ForumId > 0) { Forum f = fc.GetForum(PortalId, ModuleId, ForumId); if (f != null) { forumPrefix = f.PrefixURL; groupPrefix = f.ForumGroup.PrefixURL; } } else if (ForumGroupId > 0) { ForumGroupController grp = new ForumGroupController(); ForumGroupInfo g = grp.Groups_Get(ModuleId, ForumGroupId); if (g != null) { groupPrefix = g.PrefixURL; } } } string tmp = string.Empty; Data.Topics db = new Data.Topics(); int recordCount = 0; int i = 0; sb.Append(HeaderTemplate); using (IDataReader dr = db.TopicsList(PortalId, PageIndex, PageSize, ForumIds, CategoryId, TagId)) { while (dr.Read()) { if (recordCount == 0) { recordCount = int.Parse(dr["RecordCount"].ToString()); } tmp = ParseDataRow(dr, Template); if (i % 2 == 0) { tmp = tmp.Replace("[ROWCSS]", ItemCss); } else { tmp = tmp.Replace("[ROWCSS]", AltItemCSS); } i += 1; sb.Append(tmp); } dr.Close(); } sb.Append(FooterTemplate); int pageCount = 1; pageCount = Convert.ToInt32(System.Math.Ceiling((double)recordCount / PageSize)); ControlUtils cUtils = new ControlUtils(); string otherPrefix = string.Empty; if (TagId > 0 | CategoryId > 0) { int id = -1; if (TagId > 0) { id = TagId; } else { id = CategoryId; } using (IDataReader dr = DataProvider.Instance().Tags_Get(PortalId, ModuleId, id)) { while (dr.Read()) { otherPrefix = Utilities.CleanName(dr["TagName"].ToString()); } dr.Close(); } } sb.Append(cUtils.BuildPager(TabId, ModuleId, groupPrefix, forumPrefix, ForumGroupId, ForumId, TagId, CategoryId, otherPrefix, PageIndex, pageCount)); return(sb.ToString()); }
public string Render() { ForumController fc = new ForumController(); string fs = fc.GetForumsForUser(ForumUser.UserRoles, PortalId, ModuleId, "CanEdit"); if (! (string.IsNullOrEmpty(fs))) { _canEdit = true; } System.Text.StringBuilder sb = new System.Text.StringBuilder(); string forumPrefix = string.Empty; string groupPrefix = string.Empty; _mainSettings = DataCache.MainSettings(ModuleId); if (_mainSettings.URLRewriteEnabled) { if (ForumId > 0) { Forum f = fc.GetForum(PortalId, ModuleId, ForumId); if (f != null) { forumPrefix = f.PrefixURL; groupPrefix = f.ForumGroup.PrefixURL; } } else if (ForumGroupId > 0) { ForumGroupController grp = new ForumGroupController(); ForumGroupInfo g = grp.Groups_Get(ModuleId, ForumGroupId); if (g != null) { groupPrefix = g.PrefixURL; } } } string tmp = string.Empty; Data.Topics db = new Data.Topics(); int recordCount = 0; int i = 0; sb.Append(HeaderTemplate); using (IDataReader dr = db.TopicsList(PortalId, PageIndex, PageSize, ForumIds, CategoryId, TagId)) { while (dr.Read()) { if (recordCount == 0) { recordCount = int.Parse(dr["RecordCount"].ToString()); } tmp = ParseDataRow(dr, Template); if (i % 2 == 0) { tmp = tmp.Replace("[ROWCSS]", ItemCss); } else { tmp = tmp.Replace("[ROWCSS]", AltItemCSS); } i += 1; sb.Append(tmp); } dr.Close(); } sb.Append(FooterTemplate); int pageCount = 1; pageCount = Convert.ToInt32(System.Math.Ceiling((double)recordCount / PageSize)); ControlUtils cUtils = new ControlUtils(); string otherPrefix = string.Empty; if (TagId > 0 | CategoryId > 0) { int id = -1; if (TagId > 0) { id = TagId; } else { id = CategoryId; } using (IDataReader dr = DataProvider.Instance().Tags_Get(PortalId, ModuleId, id)) { while (dr.Read()) { otherPrefix = Utilities.CleanName(dr["TagName"].ToString()); } dr.Close(); } } sb.Append(cUtils.BuildPager(TabId, ModuleId, groupPrefix, forumPrefix, ForumGroupId, ForumId, TagId, CategoryId, otherPrefix, PageIndex, pageCount)); return sb.ToString(); }