private void DeletePost(object sender, RoutedEventArgs e) { MessageBoxResult message = MessageBox.Show("Are you sure to delete this post?", "", MessageBoxButton.YesNo, MessageBoxImage.Question); switch (message) { case MessageBoxResult.Yes: { bool isSuccess = _postBLL.DeletePost(_current_post.Id); if (isSuccess) { MessageBox.Show("Successfully deleted!"); } else { MessageBox.Show("Sorry, we can't do it..."); } Refresh(); break; } case MessageBoxResult.No: break; } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int postid = 0; postid = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); try { PostBLL pb = new PostBLL(); int i = pb.DeletePost(postid); if (i == 1) { Response.Write("<script language='javascript'>alert('Post has been deleted !');</script>"); GridView1.DataBind(); } else Response.Write("<script language='javascript'>alert('Post is failed to be deleted !');</script>"); } catch (SqlException ex) { Response.Write(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { base.CheckAdminPower("ReadPost", PowerCheckType.Single); string action = RequestHelper.GetQueryString <string>("Action"); int id = RequestHelper.GetQueryString <int>("ID"); if ((!string.IsNullOrEmpty(action)) && (id != -2147483648)) { if (!string.IsNullOrEmpty(action)) { if (action == "Up") { base.CheckAdminPower("UpdatePostOrder", PowerCheckType.Single); PostBLL.MoveUp(id); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Post"), id); } else if (action == "Down") { base.CheckAdminPower("UpdatePostOrder", PowerCheckType.Single); PostBLL.MoveDown(id); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Post"), id); } else if (action == "Delete") { base.CheckAdminPower("DeletePost", PowerCheckType.Single); PostBLL.DeletePost(id); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Post"), id); } } } PostInfo Model = new PostInfo(); Model.ParentId = 0; base.BindControl(PostBLL.ReadPostCateNamedList(), this.RecordList); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int postid = 0; postid = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); try { PostBLL pb = new PostBLL(); int i = pb.DeletePost(postid); if (i == 1) { Response.Write("<script language='javascript'>alert('Post has been deleted !');</script>"); GridView1.DataBind(); } else { Response.Write("<script language='javascript'>alert('Post is failed to be deleted !');</script>"); } } catch (SqlException ex) { Response.Write(ex.ToString()); } }
public ResultModel Delete(int id) { try { _postBLL.DeletePost(id); return(new ResultModel(Code.OK, "thành công")); } catch (Exception) { return(new ResultModel(Code.SVERROR, "lỗi hệ thống")); } }
public JsonResult DeletePost(int ID) { List <PostImageDTO> imagelist = bll.DeletePost(ID); foreach (var item in imagelist) { if (System.IO.File.Exists(Server.MapPath("~/Areas/Admin/Content/PostImage/" + item.ImagePath))) { System.IO.File.Delete(Server.MapPath("~/Areas/Admin/Content/PostImage/" + item.ImagePath)); } } return(Json("")); }
public JsonResult DeletePost(int ID) { List <PostImageDTO> imageList = bll.DeletePost(ID); foreach (PostImageDTO item in imageList) { string imageFullPath = Server.MapPath("~/Areas/Admin/Content/PostImages/" + item.ImagePath); if (System.IO.File.Exists(imageFullPath)) { System.IO.File.Delete(imageFullPath); } } return(Json("")); }
protected void Delete(int id) { PostInfo post = PostBLL.ReadPost(id); //只能删除自己公司的并且旗下没有分类的信息 if (post.CompanyID == base.UserCompanyID && PostBLL.ReadPostListByParentID(id).Count == 0) { PostBLL.DeletePost(id); } else { ScriptHelper.Alert("请先删除子分类"); } }
protected void Page_Load(object sender, EventArgs e) { if (fvPost.CurrentMode == FormViewMode.Insert) { if (hfInsert.Value == "-1") { ((HiddenField)fvPost.FindControl("hfParentId")).Value = Request.QueryString["id"]; } else { ((HiddenField)fvPost.FindControl("hfParentId")).Value = hfInsert.Value; } } string strDeleteID = Request.Form.Get("DeleteID"); if (strDeleteID != "" && strDeleteID != null) { PostBLL objBll = new PostBLL(); string strParentID = objBll.GetPost(Convert.ToInt32(strDeleteID)).ParentId.ToString(); int code = 0; objBll.DeletePost(Convert.ToInt32(strDeleteID), ref code); if (code != 0)//code=2292 { SessionSet.PageMessage = "该工作岗位已被引用,不能删除!"; } else { ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"window.parent.tvPostChangeCallBack.callback('Delete','" + strParentID + @"', 'Rebuild'); if(window.parent.tvPost.get_nodes().get_length() > 0) { window.parent.tvPost.get_nodes().getNode(0).select(); }", true); } } }
public ActionResult Delete(Guid id) { postBLL.DeletePost(id); return(RedirectToAction("List")); }