private void BindForums() { ForumController fc = new ForumController(); dtForums = fc.GetForumView(PortalId, MOID, UserId, UserInfo.IsSuperUser, UserForumsList); drpForums.Items.Clear(); drpForums.Items.Insert(0, new ListItem(string.Empty, string.Empty)); int i = 0; int n = 1; int tmpGroupCount = 0; int tmpForumCount = 0; string tmpGroupKey = string.Empty; string tmpForumKey = string.Empty; foreach (DataRow dr in dtForums.Rows) { bool bView = Permissions.HasPerm(dr["CanView"].ToString(), ForumUser.UserRoles); string GroupName = Convert.ToString(dr["GroupName"]); int GroupId = Convert.ToInt32(dr["ForumGroupId"]); string GroupKey = GroupName + GroupId.ToString(); string ForumName = Convert.ToString(dr["ForumName"]); int ForumId = Convert.ToInt32(dr["ForumId"]); string ForumKey = ForumName + ForumId.ToString(); int ParentForumId = Convert.ToInt32(dr["ParentForumId"]); //TODO - Need to add support for Group Permissions and GroupHidden if (tmpGroupKey != GroupKey) { drpForums.Items.Insert(n, new ListItem(GroupName, "GROUPJUMP:" + GroupId)); n += 1; tmpGroupKey = GroupKey; } if (bView) { if (ParentForumId == 0) { drpForums.Items.Insert(n, new ListItem("--" + dr["ForumName"].ToString(), "FORUMJUMP:" + dr["ForumID"].ToString())); n += 1; n = GetSubForums(n, Convert.ToInt32(dr["ForumId"])); } } } if (GetViewType != null) { string sView = GetViewType; if (sView == "TOPICS" || sView == "TOPIC") { string sForum = "FORUMJUMP:" + ForumId; drpForums.SelectedIndex = drpForums.Items.IndexOf(drpForums.Items.FindByValue(sForum)); } } }
private void BindForums() { ForumController fc = new ForumController(); dtForums = fc.GetForumView(PortalId, MOID, UserId, UserInfo.IsSuperUser, UserForumsList); drpForums.Items.Clear(); drpForums.Items.Insert(0, new ListItem(string.Empty, string.Empty)); int i = 0; int n = 1; int tmpGroupCount = 0; int tmpForumCount = 0; string tmpGroupKey = string.Empty; string tmpForumKey = string.Empty; foreach (DataRow dr in dtForums.Rows) { bool bView = Permissions.HasPerm(dr["CanView"].ToString(), ForumUser.UserRoles); string GroupName = Convert.ToString(dr["GroupName"]); int GroupId = Convert.ToInt32(dr["ForumGroupId"]); string GroupKey = GroupName + GroupId.ToString(); string ForumName = Convert.ToString(dr["ForumName"]); if (ForumName.Length > 30) { ForumName = ForumName.Substring(0, 30) + "..."; } int ForumId = Convert.ToInt32(dr["ForumId"]); string ForumKey = ForumName + ForumId.ToString(); int ParentForumId = Convert.ToInt32(dr["ParentForumId"]); //TODO - Need to add support for Group Permissions and GroupHidden if (tmpGroupKey != GroupKey) { drpForums.Items.Insert(n, new ListItem(GroupName, "GROUPJUMP:" + GroupId)); n += 1; tmpGroupKey = GroupKey; } if (bView) { if (ParentForumId == 0) { drpForums.Items.Insert(n, new ListItem("--" + ForumName, "FORUMJUMP:" + dr["ForumID"].ToString())); n += 1; n = GetSubForums(n, Convert.ToInt32(dr["ForumId"])); } } } if (GetViewType != null) { string sView = GetViewType; if (sView == "TOPICS" || sView == "TOPIC") { string sForum = "FORUMJUMP:" + ForumId; drpForums.SelectedIndex = drpForums.Items.IndexOf(drpForums.Items.FindByValue(sForum)); } } }
public HttpResponseMessage GetForumsList() { var portalSettings = PortalSettings; var userInfo = portalSettings.UserInfo; var forumUser = new UserController().GetUser(portalSettings.PortalId, ActiveModule.ModuleID, userInfo.UserID); var fc = new ForumController(); var forumIds = fc.GetForumsForUser(forumUser.UserRoles, portalSettings.PortalId, ActiveModule.ModuleID, "CanView", true); DataTable ForumTable = fc.GetForumView(portalSettings.PortalId, ActiveModule.ModuleID, userInfo.UserID, userInfo.IsSuperUser, forumIds); Dictionary <string, string> rows = new Dictionary <string, string>();; foreach (DataRow dr in ForumTable.Rows) { rows.Add(dr["ForumId"].ToString(), dr["ForumName"].ToString()); } return(Request.CreateResponse(HttpStatusCode.OK, rows.ToJson())); }
public HttpResponseMessage GetForumsList() { var portalSettings = PortalSettings; var userInfo = portalSettings.UserInfo; var forumUser = new UserController().GetUser(portalSettings.PortalId, ActiveModule.ModuleID, userInfo.UserID); var fc = new ForumController(); var forumIds = fc.GetForumsForUser(forumUser.UserRoles, portalSettings.PortalId, ActiveModule.ModuleID, "CanView", true); DataTable ForumTable = fc.GetForumView(portalSettings.PortalId, ActiveModule.ModuleID, userInfo.UserID, userInfo.IsSuperUser, forumIds); Dictionary<string, string> rows = new Dictionary<string, string>();; foreach (DataRow dr in ForumTable.Rows) { rows.Add(dr["ForumId"].ToString(),dr["ForumName"].ToString()); } return Request.CreateResponse(HttpStatusCode.OK, rows.ToJson()); }