/// <summary> /// 获得规则信息,返回一个rulinfo对象 /// </summary> /// <param name="rulename">名称</param> /// <returns></returns> public RuleInfoOriginal GetRuleInfo(string rulename) { string str_sql = $"select * from 数据解析库.规则信息表_基础 where 名称='{rulename}'"; DataRow mydr = MySqlHelper.ExecuteDataRow(SystemInfo._strConn, str_sql); RuleInfoOriginal myri = new RuleInfoOriginal(); myri._guizemingcheng = mydr["名称"].ToString(); myri._guizeshuoming = mydr["规则说明"].ToString(); myri._wenbentezheng = mydr["文本特征"].ToString(); myri._chuangjianren = mydr["创建人"].ToString(); myri._chuangjianshijian = mydr["创建时间"].ToString(); return(myri); }
/// <summary> /// 解析规则窗体的构造函数,带参数 /// </summary> /// <param name="rulename">名称</param> public JcjxRuleForm(string rulename) { InitializeComponent(); //获得数据库中rulename的对象,包括名称,规则说明,规则详情 RuleInfoOriginal myri = GetRuleInfo(rulename); //名称赋值 tb_guizemingcheng.Text = myri._guizemingcheng; //规则说明赋值 tb_shuoming.Text = myri._guizeshuoming; //文本特征集合转化成jigexiguize类,构造uc,添加到panel中 JiexiGuize myjiexiguize = JsonConvert.DeserializeObject <JiexiGuize>(myri._wenbentezheng); for (int i = myjiexiguize.ruleinfo.Count - 1; i >= 0; i--) { UCRuleInfo myuc = new UCRuleInfo(myjiexiguize.ruleinfo[i]); myuc.Dock = DockStyle.Top; panel_wenbentezheng.Controls.Add(myuc); panel_wenbentezheng.Controls.SetChildIndex(myuc, 0); } }