/// <summary> /// 点击格式标准化下的规则列表时触发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgv_biaozhunhua_CellContentClick(object sender, DataGridViewCellEventArgs e) { string ruleName = dgv_biaozhunhua.Rows[e.RowIndex].Cells[1].Value.ToString(); //点击编辑按钮时 if (e.ColumnIndex == 4 && e.RowIndex >= 0) { //获得规则的信息ruleinfo RuleInfo myri = new RuleInfo(ruleName, "格式标准化"); myri.GetRuleInfo(); //把ruleinfo传给wjmruleform窗体,立刻加载信息 BzhRuleForm myForm = new BzhRuleForm(myri); if (myForm.ShowDialog() == DialogResult.OK) { MessageBox.Show($"规则 {myForm._ruleInfo.ruleName} 保存成功!"); } } //点击删除按钮时 if (e.ColumnIndex == 5 && e.RowIndex >= 0) { DialogResult mydr = MessageBox.Show($"是否删除规则 {ruleName} ?", "消息提醒", MessageBoxButtons.YesNoCancel); if (mydr == DialogResult.Yes) { string str_sql = $"delete from 数据解析库.规则信息表 where 规则名称='{ruleName}' and 删除=0"; MySqlHelper.ExecuteNonQuery(SystemInfo._strConn, str_sql); //更新下拉列表 ////删除列表成功提示 //刷新格则列表显示 UpdateRules("格式标准化", string.Empty, dgv_biaozhunhua); SelectRules(cbb_format2.Text, dgv_biaozhunhua); MessageBox.Show($"规则 {ruleName} 已成功删除!"); } } }
/// <summary> /// 点击标准化格式模块中的新建规则能力 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lbl_xinjianguize2_Click(object sender, EventArgs e) { BzhRuleForm myform = new BzhRuleForm(); if (myform.ShowDialog() == DialogResult.OK) { UpdateRules("格式标准化", dgv_biaozhunhua); MessageBox.Show($"规则 {myform._ruleInfo.ruleName} 保存成功!"); } }