private void buttonX1_Click(object sender, EventArgs e) { if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?")) { if (Bm != null) { if (Bm.Position >= 0) { int index = Math.Max(0, Bm.Position); //DataSet dataSet =supergrid.PrimaryGrid.DataSource as DataSet; if (ds != null) { DataTable table = ds.Tables[0]; goodmethod.tb_goodDelete(table.Rows[index]["GoodId"].ToString()); table.Rows.RemoveAt(index); ds.AcceptChanges(); superGridControl1.PrimaryGrid.PurgeDeletedRows(true); } } } } }
private void btnDeleteClick(object sender, EventArgs e) { if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?")) { if (Bm != null) { if (Bm.Position >= 0) { string id = tbgoodid.Text.Trim(); if (!string.IsNullOrEmpty(id)) { goodmethod.tb_goodDelete(id); } FreshGoods(); GridRow gr = (GridRow)superGridControl1.PrimaryGrid.GetRowFromIndex(0); if (gr != null) { SetcontrolsValueFromGrid(gr); } LogHelper.WriteLog(username + " 删除产品【产品编号:" + id + " 名称:" + tbgoodsname.Text.Trim() + " 货号:" + tbitemno.Text.Trim() + "器型编号:" + tbmodelno.Text.Trim() + "】"); if (Bm.Count == 0) { toolbar1.btndelete.Enabled = false; toolbar1.btnedit.Enabled = false; } } } } }