public AjaxResponse DoDeleteThread(int threadID, int categoryID) { var resp = new AjaxResponse { rs2 = threadID.ToString(), rs3 = categoryID.ToString() }; var thread = ForumDataProvider.GetThreadByID(TenantProvider.CurrentTenantID, threadID); if (thread == null || !ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null)) { resp.rs1 = "0"; resp.rs4 = Resources.ForumResource.ErrorAccessDenied; return(resp); } try { RemoveDataHelper.RemoveThread(thread); resp.rs1 = "1"; } catch (Exception ex) { resp.rs1 = "0"; resp.rs4 = ex.Message.HtmlEncode(); } return(resp); }
public AjaxResponse DoDeleteThreadCategory(int id) { var resp = new AjaxResponse { rs2 = id.ToString() }; List <Thread> threads; var category = ForumDataProvider.GetCategoryByID(TenantProvider.CurrentTenantID, id, out threads); if (category == null) { resp.rs1 = "1"; return(resp); } if (!ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null)) { resp.rs1 = "0"; resp.rs3 = Resources.ForumResource.ErrorAccessDenied; return(resp); } try { RemoveDataHelper.RemoveThreadCategory(category); resp.rs1 = "1"; } catch (Exception ex) { resp.rs1 = "0"; resp.rs3 = ex.Message.HtmlEncode(); } return(resp); }
public ForumThreadWrapper DeleteThread(int threadid) { var thread = ForumDataProvider.GetThreadByID(TenantProvider.CurrentTenantID, threadid); if (thread == null || !ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null)) { throw new SecurityException(ForumResource.ErrorAccessDenied); } RemoveDataHelper.RemoveThread(thread); return(new ForumThreadWrapper(thread)); }
public ForumTopicWrapper DeleteTopic(int topicid) { var topic = ForumDataProvider.GetTopicByID(TenantProvider.CurrentTenantID, topicid); if (topic == null || !ForumManager.Settings.ForumManager.ValidateAccessSecurityAction(ForumAction.TopicDelete, topic)) { throw new SecurityException(ForumResource.ErrorAccessDenied); } RemoveDataHelper.RemoveTopic(topic); return(new ForumTopicWrapper(topic)); }
public AjaxResponse DoDeletePost(int idPost, Guid settingsID) { _forumManager = Community.Forum.ForumManager.Settings.ForumManager; var resp = new AjaxResponse { rs2 = idPost.ToString() }; var post = ForumDataProvider.GetPostByID(TenantProvider.CurrentTenantID, idPost); if (post == null) { resp.rs1 = "0"; resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied; return(resp); } if (!_forumManager.ValidateAccessSecurityAction(ForumAction.PostDelete, post)) { resp.rs1 = "0"; resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied; return(resp); } try { var result = RemoveDataHelper.RemovePost(post); if (result == DeletePostResult.Successfully) { resp.rs1 = "1"; resp.rs3 = Resources.ForumUCResource.SuccessfullyDeletePostMessage; } else if (result == DeletePostResult.ReferencesBlock) { resp.rs1 = "0"; resp.rs3 = Resources.ForumUCResource.ExistsReferencesChildPosts; } else { resp.rs1 = "0"; resp.rs3 = Resources.ForumUCResource.ErrorDeletePost; } } catch (Exception e) { resp.rs1 = "0"; resp.rs3 = HttpUtility.HtmlEncode(e.Message); } return(resp); }
public ForumCategoryWrapper DeleteThreadCategory(int categoryid) { List <Thread> threads; var category = ForumDataProvider.GetCategoryByID(TenantProvider.CurrentTenantID, categoryid, out threads); if (category == null || !ForumManager.Instance.ValidateAccessSecurityAction(ForumAction.GetAccessForumEditor, null)) { throw new SecurityException(ForumResource.ErrorAccessDenied); } RemoveDataHelper.RemoveThreadCategory(category); return(new ForumCategoryWrapper(category, threads)); }
public ForumTopicPostWrapper DeletePost(int postid) { var post = ForumDataProvider.GetPostByID(TenantId, postid); if (post == null || !ForumManager.Settings.ForumManager.ValidateAccessSecurityAction(ForumAction.PostDelete, post)) { throw new SecurityException(ForumResource.ErrorAccessDenied); } var result = RemoveDataHelper.RemovePost(post); if (result != DeletePostResult.Successfully) { throw new Exception("DeletePostResult: " + result); } return(new ForumTopicPostWrapper(post)); }
public AjaxResponse DoDeleteTopic(int idTopic, Guid settingsID) { _forumManager = Community.Forum.ForumManager.Settings.ForumManager; var resp = new AjaxResponse { rs2 = idTopic.ToString() }; var topic = ForumDataProvider.GetTopicByID(TenantProvider.CurrentTenantID, idTopic); if (topic == null) { resp.rs1 = "0"; resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied; return(resp); } if (!_forumManager.ValidateAccessSecurityAction(ForumAction.TopicDelete, topic)) { resp.rs1 = "0"; resp.rs3 = Resources.ForumUCResource.ErrorAccessDenied; return(resp); } try { RemoveDataHelper.RemoveTopic(topic); resp.rs1 = "1"; resp.rs3 = Resources.ForumUCResource.SuccessfullyDeleteTopicMessage; resp.rs4 = topic.ThreadID.ToString(); } catch (Exception ex) { resp.rs1 = "0"; resp.rs3 = ex.Message.HtmlEncode(); } return(resp); }