//Handle delete button click event public void ApprovedDelete_Article(Object sender, RepeaterCommandEventArgs e) { if ((e.CommandName == "Delete")) { ArticleRepository Article = new ArticleRepository(); string[] commandArgsDelete = e.CommandArgument.ToString().Split(new char[] { ',' }); Article.ID = int.Parse(commandArgsDelete[0].ToString()); // Article ID int User_ID = int.Parse(commandArgsDelete[1].ToString()); // Get the UserID Caching.PurgeCacheItems("Newest_Articles"); Caching.PurgeCacheItems("ArticleCategory_SideMenu"); Caching.PurgeCacheItems("Last5_ArticlePublishedByUser_" + User_ID); //Perform delete Article.Delete(Article); //Release allocated memory Article = null; //Redirect to confirm delete page Response.Redirect("articlemanager.aspx"); } if ((e.CommandName == "Approved")) { string[] commandArgsApproved = e.CommandArgument.ToString().Split(new char[] { ',' }); int ArticleID = int.Parse(commandArgsApproved[0].ToString()); // Get the Article ID int UserID = int.Parse(commandArgsApproved[1].ToString()); // Get the UserID //Refresh cache Caching.PurgeCacheItems("Newest_Articles"); Caching.PurgeCacheItems("ArticleCategory_SideMenu"); Caching.PurgeCacheItems("Last5_ArticlePublishedByUser_" + UserID); int Err = Blogic.ActionProcedureDataProvider.FinalizeAddArticle(ArticleID); // If error occured, stop further processing and notify user. if (Err != 0) { JSLiteral.Text = "Error occured while processing your submit."; return; } //Redirect to confirm delete page Response.Redirect("articlemanager.aspx"); } }
//Handle the delete button click event public void Delete_Article(Object sender, RepeaterCommandEventArgs e) { if ((e.CommandName == "Delete")) { ArticleRepository DeleteArticle = new ArticleRepository(); DeleteArticle.ID = Convert.ToInt32(e.CommandArgument); Caching.PurgeCacheItems("Newest_Articles"); Caching.PurgeCacheItems("ArticleCategory_SideMenu"); //Perform delete DeleteArticle.Delete(); //Release allocated memory DeleteArticle = null; //Redirect to confirm delete page Response.Redirect("articlemanager.aspx"); } }