源码——WinForm窗体一次性数据合法性验证

正则表达式都在程序里,呵呵……

13.gif


None.gif using  System;
None.gif
using  System.Data;
None.gif
using  System.Windows.Forms;
None.gif
None.gif
None.gif
namespace  HEWin.Sys
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 功能:验证DataTable、DataRow和DataForm数据的合法性
InBlock.gif    
/// 原理:使用DataColoum的扩展属性和窗口控件的Tag属性,存放数据的规范,调用本类来验证输入数据的合法性.
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class sysValidate: IDisposable
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private HEWin.Sys.sysErrors _Errors=new sysErrors();
InBlock.gif        
private System.Windows.Forms.Control _FocusControl;
InBlock.gif        
static  private string UnString=@"\\'";
InBlock.gif        
static  private System.Text.RegularExpressions.Regex  _CHAR=new System.Text.RegularExpressions.Regex("["+UnString+"]");
InBlock.gif        
InBlock.gif        
public     void  Dispose()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif         _Errors.Dispose();
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public      sysValidate()   
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 功能:判断一个窗体上所有控件的数据合法性
InBlock.gif        
/// 原理:根据控件的Tag属性存放的数据规范来验证数据的合法性,
InBlock.gif        
///      将错误返回到错误对象集合里.
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="frm">窗口的引用</param>
ExpandedSubBlockEnd.gif        
/// <returns>错误集合对象</returns>

InBlock.gif        public Sys.sysErrors validateForm(System.Windows.Forms.Form frm)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this._FocusControl=null;
InBlock.gif            
if(_Errors!=null) _Errors.Dispose();
InBlock.gif            _Errors    
=new HEWin.Sys.sysErrors();
InBlock.gif            
foreach(System.Windows.Forms.Control ctl in frm.Controls)
InBlock.gif                _Errors.MergeErrors(validateControl(ctl));
InBlock.gif            
if(this._FocusControl!=null)
InBlock.gif                
this._FocusControl.Focus();
InBlock.gif            
return _Errors;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 功能:判断一个窗体上可见控件的数据合法性
InBlock.gif        
/// 原理:根据控件的Tag属性存放的数据规范来验证数据的合法性,
InBlock.gif        
///      将错误返回到错误对象集合里.
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="frm">窗口的引用</param>
InBlock.gif        
/// <param name="Visible">true:表示对可见控件进行判断</param>
ExpandedSubBlockEnd.gif        
/// <returns>错误集合对象</returns>

InBlock.gif        public Sys.sysErrors validateForm(System.Windows.Forms.Form frm,bool Enabled)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this._FocusControl=null;
InBlock.gif            
if(_Errors!=null) _Errors.Dispose();
InBlock.gif            _Errors    
=new HEWin.Sys.sysErrors();
InBlock.gif            
foreach(System.Windows.Forms.Control ctl in frm.Controls)
InBlock.gif                _Errors.MergeErrors(validateControl(ctl,Enabled));
InBlock.gif            
if(this._FocusControl!=null)
InBlock.gif                
this._FocusControl.Focus();
InBlock.gif            
return _Errors;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 功能:判断一个控件的数据合法性
InBlock.gif        
/// 原理:根据控件的Tag属性存放的数据规范来验证数据的合法性,
InBlock.gif        
///      将错误返回到错误对象集合里.
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="ctl">控件的引用</param>
ExpandedSubBlockEnd.gif        
/// <returns>错误集合对象</returns>

InBlock.gif        public Sys.sysErrors validateControl(System.Windows.Forms.Control ctl)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            HEWin.Sys.sysErrors errs    
= new HEWin.Sys.sysErrors();
InBlock.gif            
InBlock.gif            
switch (ctl.GetType().ToString())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
case "System.Windows.Forms.GroupBox" :
InBlock.gif                    
foreach(System.Windows.Forms.Control ctlInner in ctl.Controls)
InBlock.gif                        errs.MergeErrors(validateControl(ctlInner));        
//递归
InBlock.gif
                    break;
InBlock.gif                
case "System.Windows.Forms.Panel" :
InBlock.gif                    
foreach(System.Windows.Forms.Control ctlInner in ctl.Controls)
InBlock.gif                        errs.MergeErrors(validateControl(ctlInner));        
//递归
InBlock.gif
                    break;
InBlock.gif                
default :
InBlock.gif                    Sys.sysError err 
= validate(ctl);
InBlock.gif                    
if (err != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
if (this._FocusControl==null && ctl.Visible)
InBlock.gif                            
this._FocusControl=ctl;
InBlock.gif                        
if(this._FocusControl!=null && ctl.TabIndex<this._FocusControl.TabIndex && ctl.Visible)
InBlock.gif                            
this._FocusControl=ctl;
InBlock.gif                        errs.AddError(err);
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
break;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
return errs;
ExpandedSubBlockEnd.gif        }

InBlock.gif    
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 功能:判断一个可见控件的数据合法性
InBlock.gif        
/// 原理:根据控件的Tag属性存放的数据规范来验证数据的合法性,
InBlock.gif        
///      将错误返回到错误对象集合里.
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="ctl">控件的引用</param>
InBlock.gif        
/// <param name="Visible">true:表示对可见控件进行判断</param>
ExpandedSubBlockEnd.gif        
/// <returns>错误集合对象</returns>

InBlock.gif        public Sys.sysErrors validateControl(System.Windows.Forms.Control ctl,bool Enabled)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
InBlock.gif            HEWin.Sys.sysErrors errs    
= new HEWin.Sys.sysErrors();
InBlock.gif            
InBlock.gif            
switch (ctl.GetType().ToString())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
case "System.Windows.Forms.GroupBox" :
InBlock.gif                    
foreach(System.Windows.Forms.Control ctlInner in ctl.Controls)
InBlock.gif                        errs.MergeErrors(validateControl(ctlInner,Enabled));        
//递归
InBlock.gif
                    break;
InBlock.gif                
case "System.Windows.Forms.Panel" :
InBlock.gif                    
foreach(System.Windows.Forms.Control ctlInner in ctl.Controls)
InBlock.gif                        errs.MergeErrors(validateControl(ctlInner,Enabled));        
//递归
InBlock.gif
                    break;
InBlock.gif                
default :
InBlock.gif                    
if (ctl.Visible!=Enabled)  
InBlock.gif                        
return errs;
InBlock.gif                    
InBlock.gif                    
if(ctl is System.Windows.Forms.TextBox&&( ((TextBox)ctl).ReadOnly==Enabled))
InBlock.gif                        
return errs;
InBlock.gif
InBlock.gif                    Sys.sysError err 
= validate(ctl);
InBlock.gif                    
if (err != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
if (this._FocusControl==null && ctl.Visible)
InBlock.gif                            
this._FocusControl=ctl;
InBlock.gif                        
if(this._FocusControl!=null && ctl.TabIndex<this._FocusControl.TabIndex && ctl.Visible)
InBlock.gif                            
this._FocusControl=ctl;
InBlock.gif                        errs.AddError(err);
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
break;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
return errs;
ExpandedSubBlockEnd.gif        }

InBlock.gif    
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 功能:判断一个控件数据的合法性
InBlock.gif        
/// 原理:根据控件的Tag属性存放的数据规范来验证数据的合法性,所有验证控件的函数都是调用此函数来执行验证的.
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="ctl">控件的引用</param>
ExpandedSubBlockEnd.gif        
/// <returns>返回错误集合对象</returns>

InBlock.gif        private Sys.sysError validate(System.Windows.Forms.Control ctl)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
InBlock.gif            
InBlock.gif            
if (ctl.Tag != null && ctl.Tag.ToString() != "0;")
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
string strTag = ctl.Tag.ToString();
InBlock.gif                
string strText = ctl.Text;
InBlock.gif
InBlock.gif                
if (strTag.IndexOf(";"== -1)
InBlock.gif                    
return null;
InBlock.gif
InBlock.gif                
string strVid = "";
InBlock.gif                System.Text.RegularExpressions.Regex regex;
InBlock.gif                
if (strTag.Length >= 1)
InBlock.gif                    strVid 
= strTag.Substring(0,1);
InBlock.gif                
else
InBlock.gif                    
return null;
InBlock.gif                
string strVname = "";
InBlock.gif                
string strVmaxmin = "";
InBlock.gif                
string strFill = "0";
InBlock.gif
InBlock.gif                Sys.sysError _Error 
= new Sys.sysError();
InBlock.gif
InBlock.gif                
switch (strVid)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
case "1" :
InBlock.gif                        
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            regex 
= new System.Text.RegularExpressions.Regex
InBlock.gif                                (
@"^\d+;(?<vname>[\u4E00-\u9FA0]+);(?<vfill>\d+);(?<vmaxmin>\d+,\d+);(?<vfraction>\d+);");    //匹配数字验证的正则表达式
InBlock.gif

InBlock.gif                            strVname 
= regex.Match(strTag).Result("${vname}");
InBlock.gif                            strFill 
= regex.Match(strTag).Result("${vfill}");
InBlock.gif                            strVmaxmin 
= regex.Match(strTag).Result("${vmaxmin}");
InBlock.gif                            
int intFraction = Convert.ToInt32(regex.Match(strTag).Result("${vfraction}"));
InBlock.gif
InBlock.gif                            
if (strFill == "1")
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                
if (strText == "")                                            //是否必填
ExpandedSubBlockStart.gifContractedSubBlock.gif
                                dot.gif{
InBlock.gif                                    _Error 
= new HEWin.Sys.sysError(-1,strVname,1001,"不能为空!");                // D(1) = B(00000001)
InBlock.gif
                                    return _Error;
ExpandedSubBlockEnd.gif                                }

ExpandedSubBlockEnd.gif                            }

InBlock.gif                            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                
if (strText == "")
InBlock.gif                                    
return null;
ExpandedSubBlockEnd.gif                            }

InBlock.gif
InBlock.gif
InBlock.gif                            regex 
= new System.Text.RegularExpressions.Regex(@"^\d*\.?\d+$");        //是否有非法字符(此处必须全部为数字)
InBlock.gif
                            if (strText != ""&&(!regex.IsMatch(strText)||strText.Substring(0,1)=="."))
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                _Error 
= new HEWin.Sys.sysError(-1,strVname,1002,"必须为数字!");                                        // D(16) = B(00010000)
InBlock.gif
                                return _Error;
ExpandedSubBlockEnd.gif                            }

InBlock.gif
InBlock.gif                            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                System.Decimal test
=System.Convert.ToDecimal(strText);
ExpandedSubBlockEnd.gif                            }

InBlock.gif                            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                _Error 
= new HEWin.Sys.sysError(-1,strVname,1002,"必须为数字!");                                        // D(16) = B(00010000)
InBlock.gif
                                return _Error    ;
ExpandedSubBlockEnd.gif                            }

InBlock.gif                        
InBlock.gif
InBlock.gif
InBlock.gif                            regex 
= new System.Text.RegularExpressions.Regex(@"^(?<vmin>\d+),(?<vmax>\d+)",
InBlock.gif                                System.Text.RegularExpressions.RegexOptions.Compiled);
InBlock.gif
InBlock.gif
InBlock.gif                            
//要判断非常大的数据吗??
InBlock.gif

InBlock.gif                            
long lngMax = 0;
InBlock.gif                            
long lngMin = 0;
InBlock.gif                        
InBlock.gif                            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                lngMax 
= Convert.ToInt64(regex.Match(strVmaxmin).Result("${vmax}"));
InBlock.gif                                lngMin 
= Convert.ToInt64(regex.Match(strVmaxmin).Result("${vmin}"));
InBlock.gif
InBlock.gif                                
if (strText == "0")
ExpandedSubBlockStart.gifContractedSubBlock.gif                                
dot.gif{
InBlock.gif                                    _Error 
= new sysError(-1,strVname,1003,"不能为0!");
InBlock.gif                                    
return _Error;                        //非0判断
ExpandedSubBlockEnd.gif
                                }

InBlock.gif
InBlock.gif                                
if (System.Math.Ceiling(Convert.ToDouble(strText)) > lngMax)        //最大值判断
InBlock.gif
                                    if (System.Math.Floor(Convert.ToDouble(strText)) != lngMax)
ExpandedSubBlockStart.gifContractedSubBlock.gif                                    
dot.gif{
InBlock.gif                                        _Error 
= new sysError(-1,strVname,1004,"最大值超出范围!");                                                // D(2) = B(00000010)
InBlock.gif
                                        return _Error;
ExpandedSubBlockEnd.gif                                    }

InBlock.gif
InBlock.gif                                
if (System.Math.Ceiling(Convert.ToDouble(strText)) < lngMin)                            //最小值判断
ExpandedSubBlockStart.gifContractedSubBlock.gif
                                dot.gif{
InBlock.gif                                    _Error 
= new sysError(-1,strVname,1005,"最小值超出范围!");                                                // D(4) = B(00000100)
InBlock.gif
                                    return _Error;
ExpandedSubBlockEnd.gif                                }

ExpandedSubBlockEnd.gif                            }

InBlock.gif                            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                _Error 
= new sysError(-1,strVname,1006,"所填数据过大!");                                            //所填数据过大
InBlock.gif
                                return _Error;
ExpandedSubBlockEnd.gif                            }

InBlock.gif
InBlock.gif                            
if (strText.IndexOf("."!= -1)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                regex 
= new System.Text.RegularExpressions.Regex(@"^\d+\.(?<vfraction>\d+$)");
InBlock.gif                                
if (regex.Match(strText).Result("${vfraction}").Length > intFraction)    //小数位数判断
ExpandedSubBlockStart.gifContractedSubBlock.gif
                                dot.gif{
InBlock.gif                                    _Error 
= new sysError(-1,strVname,1007,"小数位数过长!");                                                        // D(8) = B(00001000)                        
InBlock.gif
                                    return _Error;
ExpandedSubBlockEnd.gif                                }

InBlock.gif                                
ExpandedSubBlockEnd.gif                            }

ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            _Error 
= new sysError(-1,strVname,1499,"判断条件出错!");                //判断条件出错
InBlock.gif
                            return _Error;
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
break;
InBlock.gif                    
case "2" :
InBlock.gif                        
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
//检查控件的Tag属性设置是否正确
InBlock.gif
                            regex = new System.Text.RegularExpressions.Regex
InBlock.gif                                (
@"^\d+;(?<vname>[\u4E00-\u9FA0]+);(?<vfill>\d+);(?<vmaxmin>\d+,\d+);");
InBlock.gif                        
InBlock.gif                            strVname 
= regex.Match(strTag).Result("${vname}");
InBlock.gif                            strFill 
= regex.Match(strTag).Result("${vfill}");
InBlock.gif                            strVmaxmin 
= regex.Match(strTag).Result("${vmaxmin}");
InBlock.gif
InBlock.gif                            
//判断是否必填
InBlock.gif
                            if (strFill == "1")
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                
if (strText == "")
ExpandedSubBlockStart.gifContractedSubBlock.gif                                
dot.gif{
InBlock.gif                                    _Error 
= new sysError(-1,strVname,1001,"不能为空!");
InBlock.gif                                    
return _Error;
ExpandedSubBlockEnd.gif                                }

ExpandedSubBlockEnd.gif                            }

InBlock.gif
InBlock.gif                            
//判断是否有非法字符
InBlock.gif
                            if (_CHAR.IsMatch(strText) && strText != "")    
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                _Error 
= new sysError(-1,strVname,1008,"存在“"+UnString+"“等非法字符!");
InBlock.gif                                
return _Error;
ExpandedSubBlockEnd.gif                            }

InBlock.gif
InBlock.gif
InBlock.gif                            
if (_CHAR.IsMatch(strText) && strText != "")    
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                _Error 
= new sysError(-1,strVname,1008,"存在“"+UnString+"”等非法字符!");
InBlock.gif                                
return _Error;
ExpandedSubBlockEnd.gif                            }

InBlock.gif
InBlock.gif
InBlock.gif                            
//判断字符最大最小长度
InBlock.gif                            
//HEWin.Sys.sysFunction.MsgWarning(strVmaxmin);
InBlock.gif
                            regex = new System.Text.RegularExpressions.Regex(@"^(?<vmin>\d+),(?<vmax>\d+)");
InBlock.gif                            
int intMax = Convert.ToInt32(regex.Match(strVmaxmin).Result("${vmax}"));
InBlock.gif                            
int intMin = Convert.ToInt32(regex.Match(strVmaxmin).Result("${vmin}"));
InBlock.gif                            
//最大字符长度
InBlock.gif
                            if (strText.Length > intMax)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                _Error 
= new sysError(-1,strVname,1009,"所填字符太长!");
InBlock.gif                                
return _Error;
ExpandedSubBlockEnd.gif                            }

InBlock.gif                                
//最小长度
InBlock.gif
                            else if (strText.Length < intMin)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                _Error 
= new sysError(-1,strVname,1010,"所填字符太短!");
InBlock.gif                                
return _Error;                                                                
ExpandedSubBlockEnd.gif                            }

InBlock.gif
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            _Error 
= new sysError(-1,strVname,1499,"判断条件出错!");                //判断条件出错
InBlock.gif
                            return _Error;
ExpandedSubBlockEnd.gif                        }

InBlock.gif                                        
InBlock.gif                        
break;
InBlock.gif
InBlock.gif                    
case "3" :
InBlock.gif                        
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            regex 
= new System.Text.RegularExpressions.Regex
InBlock.gif                                (
@"^\d+;(?<vname>[\u4E00-\u9FA0]+);(?<vfill>\d+);(?<vmaxmin>\d{4}\-\d{1,2}\-\d{1,2},\d{4}\-\d{1,2}\-\d{1,2});",
InBlock.gif                                System.Text.RegularExpressions.RegexOptions.Compiled);
InBlock.gif                            
//DateTimePicker控件
InBlock.gif
                            if (ctl.GetType().ToString() == "System.Windows.Forms.DateTimePicker")
InBlock.gif                                strText 
= ((System.Windows.Forms.DateTimePicker)ctl).Value.ToString("yyyy-MM-dd");
InBlock.gif
InBlock.gif                            strVname 
= regex.Match(strTag).Result("${vname}");
InBlock.gif                            strFill 
= regex.Match(strTag).Result("${vfill}");
InBlock.gif                            strVmaxmin 
= regex.Match(strTag).Result("${vmaxmin}");
InBlock.gif
InBlock.gif
InBlock.gif                            
//是否必填
InBlock.gif
                            if (strFill == "1")
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                
if (strText == "")
ExpandedSubBlockStart.gifContractedSubBlock.gif                                
dot.gif{
InBlock.gif                                    _Error 
= new sysError(-1,strVname,1001,"不能为空!");                //判断条件出错
InBlock.gif
                                    return _Error;
ExpandedSubBlockEnd.gif                                }

ExpandedSubBlockEnd.gif                            }

InBlock.gif
InBlock.gif                            
//最大最小日期
InBlock.gif
                            regex = new System.Text.RegularExpressions.Regex(@"^(?<vmin>\d{4}\-\d{1,2}\-\d{1,2}),(?<vmax>\d{4}\-\d{1,2}\-\d{1,2})");
InBlock.gif                            
//最大日期
InBlock.gif

InBlock.gif                            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                
if (Convert.ToDateTime(strText) > Convert.ToDateTime(regex.Match(strVmaxmin).Result("${vmax}")))
ExpandedSubBlockStart.gifContractedSubBlock.gif                                
dot.gif{
InBlock.gif                                    _Error 
= new sysError(-1,strVname,1011,"所填日期太大!");                
InBlock.gif                                    
return _Error;
ExpandedSubBlockEnd.gif                                }

InBlock.gif                                    
//最小日期
InBlock.gif
                                else if (Convert.ToDateTime(strText) < Convert.ToDateTime(regex.Match(strVmaxmin).Result("${vmin}")))
ExpandedSubBlockStart.gifContractedSubBlock.gif                                
dot.gif{
InBlock.gif                                    _Error 
= new sysError(-1,strVname,1011,"所填日期太小!");    
InBlock.gif                                    
return _Error;
ExpandedSubBlockEnd.gif                                }

ExpandedSubBlockEnd.gif                            }

InBlock.gif                            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                _Error 
= new sysError(-1,strVname,1012,"不是类似“yyyy-MM-dd“格式的日期!");
InBlock.gif                                
return _Error;
ExpandedSubBlockEnd.gif                            }

InBlock.gif
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            _Error 
= new sysError(-1,strVname,1499,"判断条件出错!");                //判断条件出错
InBlock.gif
                            return _Error;
ExpandedSubBlockEnd.gif                        }

InBlock.gif
InBlock.gif                        
break;
InBlock.gif
InBlock.gif                    
default :
InBlock.gif                        _Error 
= new sysError(-1,ctl.Name,1498,"Tag判断条件无法解析!");
InBlock.gif                        
return _Error;
ExpandedSubBlockEnd.gif                }
            
ExpandedSubBlockEnd.gif            }

InBlock.gif            
InBlock.gif            
return null;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值