/// <summary> /// 查询数据 /// </summary> private void ReadData() { string condition = ""; if (this.te_material.Text.Length > 0) { condition = "MATERIALNAME like '%" + this.te_material.Text + "%'"; } BLL.MATERIAL_INFO materialBll = new MATERIAL_INFO(); this.gridControl1.DataSource = materialBll.GetList(condition).Tables[0]; this.gridView1.BestFitColumns(); DBUtility.ToolHelper.DrawRowIndicator(gridView1, 40); DBUtility.ToolHelper.SetLineColorofGridView(this.gridView1); }
/// <summary> /// 删除数据 /// </summary> /// <param name="id"></param> /// <returns></returns> private bool deleteData(int id) { try { BLL.NODEMATERIALS nodematerialsBll = new NODEMATERIALS(); int recordCount = nodematerialsBll.GetRecordCount("MATERIALNO = " + id.ToString()); if (recordCount > 0) { MessageBox.Show("该材料信息已经被使用,不能被删除!", "提示信息"); return(false); } else { BLL.MATERIAL_INFO materialBll = new MATERIAL_INFO(); materialBll.Delete(id); return(true); } } catch (Exception exception) { MessageBox.Show("删除失败!", exception.Message); return(false); } }