Esempio n. 1
0
        private void lbl_xinjianguize_Click(object sender, EventArgs e)
        {
            //获得cbb 解析格式的index
            string f = cbb_jiexigeshi.Text;

            JJWinForm.WinFormGuize mywin = new JJWinForm.WinFormGuize();
            mywin.StartPosition = FormStartPosition.CenterParent;
            if (mywin.ShowDialog() == DialogResult.OK)
            {
                _mycontroller.UpdateDGV(dgv_jiexiguize);
                cbb_jiexigeshi.Text = string.Empty;
                cbb_jiexigeshi.Text = f;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 点击编辑,删除按钮时触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgv_jiexiguize_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //获得选中的规则名称
            //List<string> list_select = new List<string>();
            //foreach (DataGridViewRow dr in dgv_jiexiguize.Rows)
            //{
            //    bool b =Convert.ToBoolean( (dr.Cells[0] as DataGridViewCheckBoxCell).EditingCellFormattedValue);
            //    if (b)
            //    {
            //        list_select.Add(dr.Cells["jieximingcheng"].Value.ToString());
            //    }
            //}
            //获得cbb 解析格式的index
            string f = cbb_jiexigeshi.Text;

            //点击编辑按钮事件,注意如果是基础规则那么点击无效
            if (dgv_jiexiguize.Columns[e.ColumnIndex].Name == "bianjianniu" && e.RowIndex >= 0)
            {
                //从数据库中获得该规则对应的文本特征,显示到新打开的winformguize中
                string rulename = dgv_jiexiguize.Rows[e.RowIndex].Cells["jieximingcheng"].Value.ToString();
                if (rulename.Contains("基础规则"))
                {
                    MessageBox.Show("不可编辑基础规则!");
                    return;
                }
                //构造一个winformguize
                JJWinForm.WinFormGuize mywin = new JJWinForm.WinFormGuize(rulename);
                mywin.StartPosition = FormStartPosition.CenterParent;
                if (mywin.ShowDialog() == DialogResult.OK)
                {
                    //刷新数据
                    _mycontroller.UpdateDGV(dgv_jiexiguize);
                }
                cbb_jiexigeshi.Text = string.Empty;
                cbb_jiexigeshi.Text = f;
            }
            //点击删除按钮事件,注意如果是基础规则那么点击无效
            if (dgv_jiexiguize.Columns[e.ColumnIndex].Name == "shanchuanniu" && e.RowIndex >= 0)
            {
                //获得名称
                string rulename = dgv_jiexiguize.Rows[e.RowIndex].Cells["jieximingcheng"].Value.ToString();
                if (rulename.Contains("基础规则"))//基础规则点击无效
                {
                    MessageBox.Show("不可删除基础规则!");
                    return;
                }
                //规则信息表该条规则的删除字段赋值为1
                _mycontroller.DeleteGuize(rulename);
                //刷新数据
                _mycontroller.UpdateDGV(dgv_jiexiguize);
                cbb_jiexigeshi.Text = string.Empty;
                cbb_jiexigeshi.Text = f;
            }
            //选中的规则前面打勾

            //foreach (DataGridViewRow dr in dgv_jiexiguize.Rows)
            //{
            //    string str_rule = dr.Cells["jieximingcheng"].Value.ToString();
            //    if (list_select.Contains(str_rule))
            //    {
            //        (dr.Cells[0] as DataGridViewCheckBoxCell).Value = true;
            //    }
            //}
        }