home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comredis.cab / webuicompare.vbs < prev    next >
Encoding:
Text File  |  2000-06-12  |  1.7 KB  |  62 lines

  1. //<script language=VBScript>
  2. const WEBUI_COMPARE_VER = "1627"
  3.  
  4. function ValidatorConvert(Operand, DataType, Output) 
  5.     on error resume next
  6.     select case DataType
  7.         case "Integer"
  8.             Output = CInt(Operand)
  9.         case "Double"
  10.             Output = CDbl(Operand)
  11.         case "DateTime"
  12.             Output = CDate(Operand)
  13.         case "Currency"
  14.             Output = CCur(Operand)
  15.         case else
  16.             Output = CStr(Operand)
  17.     end select
  18.     ValidatorConvert = (err.number = 0)
  19.     if DataType = "Integer" then 
  20.         if Output <> CDbl(Operand) then
  21.             ValidatorConvert = false
  22.         end if
  23.     end if
  24. end function
  25.  
  26. function ValidatorCompare(Operand1, Operand2, Operator, DataType)
  27.     dim Op1, Op2 
  28.     on error resume next
  29.     
  30.     if not ValidatorConvert(Operand1, DataType, Op1) then
  31.         ValidatorCompare = false
  32.         exit function
  33.     end if
  34.     
  35.     if Operator = "DataTypeCheck" then
  36.         ValidatorCompare = true
  37.         exit function
  38.     end if        
  39.     
  40.     if not ValidatorConvert(Operand2, DataType, Op2) then
  41.         ValidatorCompare = true
  42.         exit function
  43.     end if
  44.     
  45.     select case Operator 
  46.         case "Equal"
  47.             ValidatorCompare = Op1 = Op2
  48.         case "NotEqual"
  49.             ValidatorCompare = Op1 <> Op2
  50.         case "GreaterThan"
  51.             ValidatorCompare = Op1 > Op2
  52.         case "GreaterThanEqual"
  53.             ValidatorCompare = Op1 >= Op2
  54.         case "LessThan"
  55.             ValidatorCompare = Op1 < Op2
  56.         case "LessThanEqual"
  57.             ValidatorCompare = Op1 <= Op2
  58.         case else
  59.             ValidatorCompare = Op1 = Op2
  60.     end select
  61. end function
  62.