/// <summary> /// 验证输入的是否正确 /// </summary> /// <param name="property"></param> /// <param name="ValueStr"></param> /// <returns></returns> private bool checkValudate(StimControlProperty property, string ValueStr, Hashtable htItem) { bool ch = true; if (property.CheckRegular != null) { PropertyGrid.Item.SYSMethod Method = new PropertyGrid.Item.SYSMethod(); //0,系统方法;1,正则表达式;2,sql语句 switch (property.CheckRegular.ValueType) { case "0": ch = Method.CheckValue(property.CheckRegular.ValueApp, ValueStr); break; case "1": ch = Method.RegexCheck(ValueStr, property.CheckRegular.ValueRegular); break; case "2": string sql = property.CheckRegular.ValueSql; Hashtable ht = new Hashtable(); //ht.Add(property.Name, ValueStr); //获取系统默认值 PropertyGrid.Item.SysValue _sysValue = new PropertyGrid.Item.SysValue(); foreach (PropertyGrid.TxtValObject obj in _sysValue.ValueList) { if (sql.IndexOf(":" + obj.Val) > 0) { ht.Add(obj.Val, _sysValue.GetValue(obj.Val)); } } //获取界面其他控件的值 foreach (DictionaryEntry objDE in htItem) { StimControlProperty tempProperty = objDE.Key as StimControlProperty; if (sql.IndexOf(":" + tempProperty.Name) > 0) { ht.Add(tempProperty.Name, objDE.Value); } } ch = (new BLL.STIM_CONFIG()).SqlCheckValue(sql, ht); break; } } return(ch); }