private void bt_add_Click(object sender, EventArgs e) { if (str_zdflbm == "") { MessageBox.Show("请先选择字典分类!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } bool lb = false; if (str_zdflbm == "20")//危害因素 { lb = true; } else { lb = false; } Form_xtjcsjinsert frm = new Form_xtjcsjinsert("insert", str_zdflbm, lb); if (frm.ShowDialog() == DialogResult.OK) { dgv_zdmx.DataSource = mainbiz.Get_xt_zdxm(str_zdflbm); MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void bt_update_Click(object sender, EventArgs e) { if (object.Equals(null, dgv_zdmx.CurrentRow)) { return; } if (str_zdflbm == "") { return; } DataGridViewRow dgr = dgv_zdmx.CurrentRow; string str_xh = dgr.Cells["xh"].Value.ToString(); string str_bzdm = dgr.Cells["bzdm"].Value.ToString(); string str_xmmc = dgr.Cells["xmmc"].Value.ToString(); string str_tybz = dgr.Cells["tybz"].Value.ToString(); string lbbh = dgr.Cells["lbbh"].Value.ToString(); bool bool_tybz = false; bool lb = false; if (str_zdflbm == "20")//危害因素 { lb = true; } else { lb = false; } if (str_tybz == "1") { bool_tybz = true; } Form_xtjcsjinsert frm = new Form_xtjcsjinsert("update", str_zdflbm, str_xh, str_bzdm, str_xmmc, bool_tybz, lbbh, lb); if (frm.ShowDialog() == DialogResult.OK) { dgv_zdmx.DataSource = mainbiz.Get_xt_zdxm(str_zdflbm); MessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }