public void Delete(HttpContext context) { string text = context.Request["ids"]; if (string.IsNullOrWhiteSpace(text)) { throw new HidistroAshxException("错误的活动编号"); } int[] array = (from d in text.Split(',') select int.Parse(d)).ToArray(); int num = 0; int num2 = array.Count(); int[] array2 = array; foreach (int giftId in array2) { if (GiftHelper.DeleteGift(giftId)) { num++; } } if (num > 0) { if (num2 == 1) { base.ReturnSuccessResult(context, "删除成功", 0, true); } else { base.ReturnSuccessResult(context, $"成功删除{num}条记录", 0, true); } return; } throw new HidistroAshxException("删除失败"); }
private void grdGift_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int giftId = (int)this.grdGift.DataKeys[e.RowIndex].Value; if (GiftHelper.DeleteGift(giftId)) { this.ShowMsg("成功的删除了一件礼品信息", true); this.BindData(); return; } this.ShowMsg("未知错误", false); }
private void grdGift_RowDeleting(object sender, GridViewDeleteEventArgs e) { int giftId = (int)grdGift.DataKeys[e.RowIndex].Value; if (GiftHelper.DeleteGift(giftId)) { ShowMsg("成功的删除了一件礼品信息", true); BindData(); } else { ShowMsg("未知错误", false); } }
private void lkbDelectCheck_Click(object sender, System.EventArgs e) { int num = 0; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdGift.Rows) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol"); if (checkBox.Checked && GiftHelper.DeleteGift(System.Convert.ToInt32(this.grdGift.DataKeys[gridViewRow.RowIndex].Value, System.Globalization.CultureInfo.InvariantCulture))) { num++; } } if (num > 0) { this.ShowMsg(string.Format("成功的删除了{0}件礼品", num), true); this.BindData(); return; } this.ShowMsg("请选择您要删除的礼品", false); }
private void lkbDelectCheck_Click(object sender, EventArgs e) { int num = 0; foreach (GridViewRow row in this.grdGift.Rows) { CheckBox box = (CheckBox) row.FindControl("checkboxCol"); if (box.Checked && GiftHelper.DeleteGift(Convert.ToInt32(this.grdGift.DataKeys[row.RowIndex].Value, CultureInfo.InvariantCulture))) { num++; } } if (num > 0) { this.ShowMsg(string.Format("成功的删除了{0}件礼品", num), true); this.BindData(); } else { this.ShowMsg("请选择您要删除的礼品", false); } }