private void lkbtnDeleteCheck_Click(object sender, EventArgs e) { int?nullable = null; foreach (GridViewRow row in this.grdCutDownList.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if (box.Checked) { nullable = new int?(nullable.GetValueOrDefault()); int cutDownId = Convert.ToInt32(this.grdCutDownList.DataKeys[row.RowIndex].Value, CultureInfo.InvariantCulture); CutDownInfo cutDown = PromoteHelper.GetCutDown(cutDownId); nullable = new int?(nullable.GetValueOrDefault() + 1); PromoteHelper.DeleteCutDown(cutDownId); } } if (nullable.HasValue) { this.BindCutDown(); this.ShowMsg(string.Format("成功删除{0}条砍价活动", nullable), true); } else { this.ShowMsg("请先选择需要删除的砍价活动", false); } }
private void grdCutDownList_RowDeleting(object sender, GridViewDeleteEventArgs e) { CutDownInfo cutDown = PromoteHelper.GetCutDown((int)this.grdCutDownList.DataKeys[e.RowIndex].Value); /* * if ((cutDown.Status == CutDownStatus.) || (groupBuy.Status == GroupBuyStatus.EndUntreated)) * { * this.ShowMsg("团购活动正在进行中或结束未处理,不允许删除", false); * } */ if (PromoteHelper.DeleteCutDown((int)this.grdCutDownList.DataKeys[e.RowIndex].Value)) { this.BindCutDown(); this.ShowMsg("成功删除了选择的砍价活动", true); } else { this.ShowMsg("删除失败", false); } }