/// <summary> /// 点击基础解析模块的规则列表时触发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgv_jichujiexi_CellContentClick(object sender, DataGridViewCellEventArgs e) { string ruleName = dgv_jichujiexi.Rows[e.RowIndex].Cells[1].Value.ToString(); //点击编辑按钮时 if (e.ColumnIndex == 4 && e.RowIndex >= 0) { //获得规则的信息ruleinfo string rulename = dgv_jichujiexi.Rows[e.RowIndex].Cells[1].Value.ToString(); //把ruleinfo传给wjmruleform窗体,立刻加载信息 JcjxRuleForm myForm = new JcjxRuleForm(rulename); if (myForm.ShowDialog() == DialogResult.OK) { MessageBox.Show($"规则 {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); //更新下拉列表 ////删除列表成功提示 //刷新格则列表显示 UpdateRulesOriginal(string.Empty, dgv_jichujiexi); SelectRules(cbb_format4.Text, dgv_jichujiexi); MessageBox.Show($"规则 {ruleName} 已成功删除!"); } } }
/// <summary> /// 点击基础解析模块的新建规则按钮时触发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lbl_xinjian4_Click(object sender, EventArgs e) { //获得cbb 解析格式的index string f = cbb_format4.Text; JcjxRuleForm mywin = new JcjxRuleForm(); mywin.StartPosition = FormStartPosition.CenterParent; if (mywin.ShowDialog() == DialogResult.OK) { UpdateRules("基础解析", dgv_jichujiexi); } }