private void DeleteGriftById() { if (!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && base.Request.QueryString["oper"].Trim() == "delete" && !string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0) { int giftId = int.Parse(base.Request.QueryString["GiftId"].Trim()); GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId); if (SubsiteGiftHelper.DeleteGiftById(giftId)) { this.ReloadGiftsList(true); this.ShowMsg("删除礼品" + giftDetails.Name + "成功!", true); return; } this.ShowMsg("删除礼品" + giftDetails.Name + "失败!", false); } }
void DeleteGriftById() { if ((!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && (base.Request.QueryString["oper"].Trim() == "delete")) && (!string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && (int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0))) { int giftId = int.Parse(base.Request.QueryString["GiftId"].Trim()); GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId); if (SubsiteGiftHelper.DeleteGiftById(giftId)) { ReloadGiftsList(true); ShowMsg("删除礼品" + giftDetails.Name + "成功!", true); } else { ShowMsg("删除礼品" + giftDetails.Name + "失败!", false); } } }
protected void lkbtnDelete_Click(object sender, EventArgs e) { int num = 0; foreach (GridViewRow row in grdGift.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if ((box != null) && box.Checked) { num++; } } if (num == 0) { ShowMsg("请先选择要删除的礼品", false); } else { bool success = true; string msg = "删除礼品成功!"; foreach (GridViewRow row2 in grdGift.Rows) { CheckBox box2 = (CheckBox)row2.FindControl("checkboxCol"); if (box2.Checked) { int giftId = (int)grdGift.DataKeys[row2.RowIndex].Value; if (!SubsiteGiftHelper.DeleteGiftById(giftId)) { success = false; msg = "删除礼品失败!"; break; } } } ShowMsg(msg, success); ReloadGiftsList(true); } }
private void lkbtnDelete_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 != null && checkBox.Checked) { num++; } } if (num == 0) { this.ShowMsg("请先选择要删除的礼品", false); return; } bool success = true; string string_ = "删除礼品成功!"; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow2 in this.grdGift.Rows) { System.Web.UI.WebControls.CheckBox checkBox2 = (System.Web.UI.WebControls.CheckBox)gridViewRow2.FindControl("checkboxCol"); if (checkBox2.Checked) { int giftId = (int)this.grdGift.DataKeys[gridViewRow2.RowIndex].Value; if (!SubsiteGiftHelper.DeleteGiftById(giftId)) { success = false; string_ = "删除礼品失败!"; break; } } } this.ShowMsg(string_, success); this.ReloadGiftsList(true); }