protected void lnk_Delete_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { int @int = WebUtils.GetInt((sender as LinkButton).CommandArgument); AdsInfo dataById = Ads.GetDataById(@int); if (dataById == null) { base.ShowAjaxMsg(this.UpdatePanel1, "没有找到此广告信息,广告不存在或者已删除"); } else if (Ads.Delete(@int)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除广告[" + dataById.AdName + "] thành công"); base.ShowAjaxMsg(this.UpdatePanel1, "删除广告成功"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "删除广告失败"); } } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int id = (int)GridView1.DataKeys[e.RowIndex].Value; Ads obj = new Ads(); obj.Delete(id); Response.Write("<script>window.location.reload();</script>"); } catch (Exception ex) { lblMessage.Text = ex.Message; } }
public JsonResult DelAds(int id) { Ads entity = Ads.Find(Ads._.Id == id); if (entity == null) { tip.Message = "系统找不到本广告!"; return(Json(tip)); } Core.Admin.WriteLogActions("删除广告(id:" + entity.Id + ");"); entity.Delete(); tip.Status = JsonTip.SUCCESS; tip.Message = "删除广告成功"; return(Json(tip)); }
protected void btn_DelBat_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { string repeaterCheckIDs = base.GetRepeaterCheckIDs(this.Repeater1, "chk", "autoid"); if (!string.IsNullOrEmpty(repeaterCheckIDs)) { if (Ads.Delete(repeaterCheckIDs)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "批量删除广告成功"); base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại"); } } } }