コード例 #1
0
        /// <summary>
        /// 点击大数据规则列表中的编辑和删除按钮时触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgv_dsjRules_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string ruleName = dgv_dsjRules.Rows[e.RowIndex].Cells[1].Value.ToString();

            //点击编辑按钮时
            if (e.ColumnIndex == 4 && e.RowIndex >= 0)
            {
                //获得规则的信息ruleinfo
                RuleInfo myri = new RuleInfo(ruleName, "大数据版");
                myri.GetRuleInfo();
                //把ruleinfo传给wjmruleform窗体,立刻加载信息
                DsjRuleForm myForm = new DsjRuleForm(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_dsjRules);
                    SelectRules(cbb_formatname6.Text, dgv_dsjRules);
                    MessageBox.Show($"规则 {ruleName} 已成功删除!");
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 点击大数据版模块下的新建规则按钮时触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbl_xinjian6_Click(object sender, EventArgs e)
        {
            DsjRuleForm myform = new DsjRuleForm();

            if (myform.ShowDialog() == DialogResult.OK)
            {
                UpdateRules("大数据版", dgv_dsjRules);
                MessageBox.Show($"规则 {myform._ruleInfo.ruleName} 保存成功!");
            }
        }