Exemplo n.º 1
0
        /// <summary>
        /// 点击规则列表的内容时触发的事件,编辑和删除两项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgv_wenjianmingrules_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string ruleName = dgv_wenjianmingrules.Rows[e.RowIndex].Cells["jieximingcheng"].Value.ToString();

            //点击编辑按钮时
            if (dgv_wenjianmingrules.Columns[e.ColumnIndex].Name == "bianjianniu" && e.RowIndex >= 0)
            {
                //获得规则的信息ruleinfo
                RuleInfo myri = new RuleInfo(ruleName, "文件名标准化");
                myri.GetRuleInfo();
                //把ruleinfo传给wjmruleform窗体,立刻加载信息
                WjmRuleForm myform = new WjmRuleForm(myri);
                if (myform.ShowDialog() == DialogResult.OK)
                {
                    //UpdateWenjianmingRules();
                }
            }
            //点击删除按钮时
            if (dgv_wenjianmingrules.Columns[e.ColumnIndex].Name == "shanchuanniu" && 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_wenjianmingrules);
                    SelectRules(cbb_formatName1.Text, dgv_wenjianmingrules);
                    MessageBox.Show($"规则 {ruleName} 已删除成功!");
                }
            }
        }
Exemplo n.º 2
0
        private void lbl_xinjianguize1_Click(object sender, EventArgs e)
        {
            //实例化一个文件名标准化规则编辑窗体
            WjmRuleForm myform = new WjmRuleForm();

            if (myform.ShowDialog() == DialogResult.OK)
            {
                UpdateRules("文件名标准化", dgv_wenjianmingrules);
            }
        }