/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btndelete1_Click(object sender, EventArgs e) { if (fmcost.Delete(Convert.ToInt32(txt_id.Value))) { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "删除成功!", ""); BindGv(pageSize, pageIndex); } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "删除失败!", ""); } }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("goods_", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.Goods bll = new BLL.Goods(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除货物成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("goods_list.aspx", "customer_id={0}&store_mode_id={1}&handling_mode_id={2}&keywords={3}", this.customer_id.ToString(), this.store_mode_id.ToString(), this.handling_mode_id.ToString(), this.keywords)); }
private void btConfirm_Click(object sender, EventArgs e) { if (tbID.Text.Trim() == "" || tbRoomType.Text.Trim() == "") { MessageBox.Show("输入信息不完整!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); flag = 1; } if (flag == 0) { if (tbRoomType.Text.Trim() == "双人间" || tbRoomType.Text.Trim() == "单人间" || tbRoomType.Text.Trim() == "套房") { Maticsoft.BLL.Goods go = new BLL.Goods(); string str1 = string.Format("goodsID = '{0}'", tbID.Text.Trim()); string string1 = string.Format("{0}", tbID.Text.Trim()); string str2 = string.Format("{0}", tbRoomType.Text.Trim()); if (go.GetRecordCount(str1) > 0) { if (go.Delete(string1, str2) == true) { MessageBox.Show("删除成功!"); ((Main_Admin)this.Owner).RoomGoodsLoad(); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("删除失败!"); } } else { MessageBox.Show("不存在此物品编号!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("房型不存在!", "删除失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }