Public Shared Function ValidaterSummy(ByVal ctl As ArrayList, ByVal ErrLabel As HtmlImage, ByVal Title As String, ByVal VTyper As Long) As Boolean
Select Case VTyper
Case enumValidateType.VD_NOTNULL 'NOTNULL
Select Case ctl(0).GetType.Name
Case "TextBox"
If String.IsNullOrEmpty(CType(ctl(0), TextBox).Text.Trim) Then
ErrLabel.Alt = Resources.error.errNoInput.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
Case "DropDownList"
If String.IsNullOrEmpty(CType(ctl(0), DropDownList).SelectedItem.Value.Trim) Then
ErrLabel.Alt = Resources.error.errNoSelect.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
Case "ListBox"
If CType(ctl(0), ListBox).Items.Count = 0 Then
ErrLabel.Alt = Resources.error.errNoSelect.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_EMAIL 'Email書式
Select Case ctl(0).GetType.Name
Case "TextBox"
If Not mailCheck(CType(ctl(0), TextBox).Text.Trim) Then
ErrLabel.Alt = Resources.error.errEmail.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_DATE '日付書式
Select Case ctl(0).GetType.Name
Case "HtmlInputText"
If CType(ctl(0), HtmlInputText).Value.Trim > CType(ctl(1), HtmlInputText).Value.Trim Then
ErrLabel.Alt = Resources.error.errFromTo.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_AREA
Select Case ctl(0).GetType.Name
Case "TextBox"
If CType(ctl(0), TextBox).Text.Trim > CType(ctl(1), TextBox).Text.Trim Then
ErrLabel.Alt = Resources.error.errFromTo.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_NUMBICE
Select Case ctl(0).GetType.Name
Case "TextBox"
If Not IsNumeric(CType(ctl(0), TextBox).Text.Trim) Then
ErrLabel.Alt = Resources.error.errFormatInput.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_XIAOSHU
Return False
Case enumValidateType.VD_ZHENGSHU
Return False
Case enumValidateType.VD_NUMBER
Select Case ctl(0).GetType.Name
Case "TextBox"
If Not IsInteger(CType(ctl(0), TextBox).Text.Trim) Then
ErrLabel.Alt = Resources.error.errInputPlus.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_TEL '電話書式
Return False
Case enumValidateType.VD_LEN500
Select Case ctl(0).GetType.Name
Case "TextBox"
If CType(ctl(0), TextBox).Text.Length > 500 Then
ErrLabel.Alt = Resources.error.errCount500.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_LEN30
Select Case ctl(0).GetType.Name
Case "TextBox"
If CType(ctl(0), TextBox).Text.Length > 30 Then
ErrLabel.Alt = Resources.error.errCount30.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_LEN50
Select Case ctl(0).GetType.Name
Case "TextBox"
If CType(ctl(0), TextBox).Text.Length > 50 Then
ErrLabel.Alt = Resources.error.errCount50.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_LEN200
Select Case ctl(0).GetType.Name
Case "TextBox"
If CType(ctl(0), TextBox).Text.Length > 200 Then
ErrLabel.Alt = Resources.error.errCount200.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_FOLDER
Select Case ctl(0).GetType.Name
Case "TextBox"
If String.IsNullOrEmpty(CType(ctl(0), TextBox).Text.Trim) Then
ErrLabel.Alt = Resources.error.errNoInput.Replace("$1", Title)
ErrLabel.Visible = True
Return False
ElseIf Tool.markFolder(CType(ctl(0), TextBox).Text.Trim) Then
ErrLabel.Alt = Resources.error.errFormatInput.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
Case enumValidateType.VD_NUM20
Select Case ctl(0).GetType.Name
Case "TextBox"
If Integer.Parse(CType(ctl(0), TextBox).Text.Trim) > 20 Then
ErrLabel.Alt = Resources.error.errNum20.Replace("$1", Title)
ErrLabel.Visible = True
Return False
End If
End Select
End Select
ValidaterSummy = True
End Function