public Bookmark RemoveBookmarkFromFavourite(long bookmarkID) { var b = Dao.GetBookmarkByID(bookmarkID); var comments = GetBookmarkComments(b); var result = Dao.RemoveBookmarkFromFavourite(bookmarkID); if (b != null) { DeletedBookmarkUrl = b.URL; UnSubscribe(b.ID.ToString(CultureInfo.InvariantCulture), BookmarkingBusinessConstants.NotifyActionNewComment); } if (result == null) { foreach (var comment in comments) { CommonControlsConfigurer.FCKUploadsRemoveForItem("bookmarking_comments", comment.ID.ToString()); } AscCache.Default.Remove("communityScreen" + TenantProvider.CurrentTenantID); } return(result); }
public AjaxResponse DoDeleteThread(int threadID, int categoryID) { AjaxResponse resp = new AjaxResponse(); resp.rs2 = threadID.ToString(); resp.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 { var removedPostIDs = new List <int>(); ForumDataProvider.RemoveThread(TenantProvider.CurrentTenantID, thread.ID, out removedPostIDs); ForumActivityPublisher.DeleteThread(thread); ForumManager.Instance.RemoveAttachments(thread); removedPostIDs.ForEach(idPost => CommonControlsConfigurer.FCKUploadsRemoveForItem(ForumManager.Settings.FileStoreModuleID, idPost.ToString())); 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 { List <int> removedPostIDs; ForumDataProvider.RemoveThreadCategory(TenantProvider.CurrentTenantID, category.ID, out removedPostIDs); ForumManager.Instance.RemoveAttachments(category); removedPostIDs.ForEach(idPost => CommonControlsConfigurer.FCKUploadsRemoveForItem(ForumManager.Settings.FileStoreModuleID, idPost.ToString())); resp.rs1 = "1"; } catch (Exception ex) { resp.rs1 = "0"; resp.rs3 = ex.Message.HtmlEncode(); } return(resp); }
protected void cmdDelete_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(WikiPage) || IsFile) { return; } var pageName = PageNameUtil.Decode(WikiPage); var page = Wiki.GetPage(pageName); CommunitySecurity.DemandPermissions(new WikiObjectsSecurityObject(page), Common.Constants.Action_RemovePage); foreach (var cat in Wiki.GetCategoriesRemovedWithPage(pageName)) { WikiNotifySource.Instance.GetSubscriptionProvider().UnSubscribe(Common.Constants.AddPageToCat, cat.CategoryName); } Wiki.RemoveCategories(pageName); WikiNotifySource.Instance.GetSubscriptionProvider().UnSubscribe(Common.Constants.EditPage, pageName); foreach (var comment in Wiki.GetComments(pageName)) { CommonControlsConfigurer.FCKUploadsRemoveForItem("wiki_comments", comment.Id.ToString()); } Wiki.RemovePage(pageName); FactoryIndexer <WikiWrapper> .DeleteAsync(page); Response.RedirectLC("Default.aspx", this); } catch (Exception err) { WikiMaster.PrintInfoMessage(err.Message, InfoType.Alert); } }