home *** CD-ROM | disk | FTP | other *** search
- //<script language=VBScript>
- const WEBUI_COMPARE_VER = "1627"
-
- function ValidatorConvert(Operand, DataType, Output)
- on error resume next
- select case DataType
- case "Integer"
- Output = CInt(Operand)
- case "Double"
- Output = CDbl(Operand)
- case "DateTime"
- Output = CDate(Operand)
- case "Currency"
- Output = CCur(Operand)
- case else
- Output = CStr(Operand)
- end select
- ValidatorConvert = (err.number = 0)
- if DataType = "Integer" then
- if Output <> CDbl(Operand) then
- ValidatorConvert = false
- end if
- end if
- end function
-
- function ValidatorCompare(Operand1, Operand2, Operator, DataType)
- dim Op1, Op2
- on error resume next
-
- if not ValidatorConvert(Operand1, DataType, Op1) then
- ValidatorCompare = false
- exit function
- end if
-
- if Operator = "DataTypeCheck" then
- ValidatorCompare = true
- exit function
- end if
-
- if not ValidatorConvert(Operand2, DataType, Op2) then
- ValidatorCompare = true
- exit function
- end if
-
- select case Operator
- case "Equal"
- ValidatorCompare = Op1 = Op2
- case "NotEqual"
- ValidatorCompare = Op1 <> Op2
- case "GreaterThan"
- ValidatorCompare = Op1 > Op2
- case "GreaterThanEqual"
- ValidatorCompare = Op1 >= Op2
- case "LessThan"
- ValidatorCompare = Op1 < Op2
- case "LessThanEqual"
- ValidatorCompare = Op1 <= Op2
- case else
- ValidatorCompare = Op1 = Op2
- end select
- end function
-