//添加吊挂设备 private void simpleButton5_Click(object sender, EventArgs e) { HoistingEquipmentInfoDao dao = new HoistingEquipmentInfoDao(); string name = textEdit3.Text.Trim(); //控制参数格式 if (name == "") { MessageBox.Show("信息不能为空!"); return; } string sql1 = "select * from HOISTINGEQUIPMENT_INFO where EQUIMENT_NAME = '" + name + "'"; if (common.SqlHelper.ExcuteSql(sql1) > 0) { MessageBox.Show("该吊挂设备已经被添加过了!", "信息提示", MessageBoxButtons.OK); return; } dao.Save(this.textEdit3.Text.Trim()); FreshForm(); }
//保存吊挂设备信息 private void simpleButton1_Click(object sender, EventArgs e) { HoistingEquipmentInfoDao dao = new HoistingEquipmentInfoDao(); string name = EQUIMENT_NAME.Text.Trim(); //控制参数格式 if (name == "") { MessageBox.Show("信息不能为空!"); return; } switch (strOperationFlag) { case "add": string sql1 = "select * from HOISTINGEQUIPMENT_INFO where EQUIMENT_NAME = '" + name + "'"; if (common.SqlHelper.ExcuteSql(sql1) > 0) { MessageBox.Show("该吊挂设备已经被添加过了!", "信息提示", MessageBoxButtons.OK); return; } dao.Save(this.EQUIMENT_NAME.Text.Trim()); this.DialogResult = DialogResult.OK; this.Close(); break; case "modify": string sql2 = "select count(*) from HOISTINGEQUIPMENT_INFO where EQUIMENT_NAME = '" + name + "' and EQUIMENT_ID <> '" + EQUIMENT_ID + "'"; if (common.SqlHelper.ExcuteSql(sql2) > 0) { MessageBox.Show("该吊挂设备已经被添加过了!", "信息提示", MessageBoxButtons.OK); this.EQUIMENT_NAME.Focus(); return; } dao.Modify(EQUIMENT_ID, this.EQUIMENT_NAME.Text.Trim()); this.DialogResult = DialogResult.OK; this.Close(); break; } }