protected void DelBtn_Click(object sender, System.EventArgs e) { System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>(); foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdCoupondsList.Rows) { if (gridViewRow.RowIndex >= 0) { System.Web.UI.WebControls.CheckBox checkBox = gridViewRow.Cells[0].FindControl("cbId") as System.Web.UI.WebControls.CheckBox; if (checkBox.Checked) { list.Add(int.Parse(this.grdCoupondsList.DataKeys[gridViewRow.RowIndex].Value.ToString())); } } } if (list.Count <= 0) { this.ShowMsg("请至少选择一条要删除的数据!", false); return; } foreach (int current in list) { int num = 0; if (!this.bInt(current.ToString(), ref num)) { this.ShowMsg("选择优惠券出错!", false); return; } } foreach (int current2 in list) { CouponHelper.DeleteCoupon(current2); } this.ShowMsg("删除优惠券成功!", true); this.BindData(); }
public void Delete(HttpContext context) { int value = base.GetIntParam(context, "CouponId", false).Value; if (CouponHelper.DeleteCoupon(value)) { base.ReturnSuccessResult(context, "删除成功", 0, true); return; } throw new HidistroAshxException("删除优惠券失败!"); }
private void grdCoupons_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int couponId = (int)this.grdCoupons.DataKeys[e.RowIndex].Value; if (CouponHelper.DeleteCoupon(couponId)) { this.BindCoupons(); this.ShowMsg("成功删除了选定张优惠券", true); return; } this.ShowMsg("删除优惠券失败", false); }
private void grdCoupondsList_RowDeleting(object sender, GridViewDeleteEventArgs e) { int couponId = (int)this.grdCoupondsList.DataKeys[e.RowIndex].Value; if (!CouponHelper.DeleteCoupon(couponId)) { this.ShowMsg("未知错误", false); } else { this.BindData(); this.ShowMsg("成功删除了选择的优惠券", true); } }
private void grdCoupons_RowDeleting(object sender, GridViewDeleteEventArgs e) { int couponId = (int)grdCoupons.DataKeys[e.RowIndex].Value; if (CouponHelper.DeleteCoupon(couponId)) { BindCoupons(); ShowMsg("成功删除了选定张优惠券", true); } else { ShowMsg("删除优惠券失败", false); } }
protected void DelBtn_Click(object sender, EventArgs e) { List <int> list = new List <int>(); foreach (GridViewRow row in this.grdCoupondsList.Rows) { if (row.RowIndex >= 0) { CheckBox box = row.Cells[0].FindControl("cbId") as CheckBox; if (box.Checked) { list.Add(int.Parse(this.grdCoupondsList.DataKeys[row.RowIndex].Value.ToString())); } } } if (list.Count <= 0) { this.ShowMsg("请至少选择一条要删除的数据!", false); } else { foreach (int num in list) { int i = 0; if (!this.bInt(num.ToString(), ref i)) { this.ShowMsg("选择优惠券出错!", false); return; } } foreach (int num3 in list) { CouponHelper.DeleteCoupon(num3); } this.ShowMsg("删除优惠券成功!", true); this.BindData(); } }
protected void DelBtn_Click(object sender, EventArgs e) { string text = this.txt_ids.Text; if (!string.IsNullOrEmpty(text)) { string[] strArray = text.Split(new char[] { ',' }); for (int i = 0; i < strArray.Length; i++) { int num2 = 0; if (!this.bInt(strArray[i], ref num2)) { this.ShowMsg("选择优惠券出错!", false); return; } } for (int j = 0; j < strArray.Length; j++) { CouponHelper.DeleteCoupon(int.Parse(strArray[j])); } this.ShowMsg("删除优惠券成功!", true); this.BindData(); } }