Advertisement
simiane

23109682 Test: TestCom.cfc

Apr 16th, 2014
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <cfcomponent
  2.     name        = "TestCom"
  3.     output      = "false"
  4.     displayname = "Test component"
  5. >
  6.  
  7.     <!--- Init function --->
  8.     <cffunction name="init" access="public" returnType="any" output="false" hint="Constructor">
  9.  
  10.         <!--- Vehicle categories --->
  11.         <cfset  Variables.VehicleCategories = {
  12.                 'T1'    : 'Beetle'
  13.             ,   'T1C'   : 'Beetle Cabrio'
  14.             ,   'T2'    : 'Type 2 Split'
  15.             ,   'T2B'   : 'Type 2 Bay'
  16.             ,   'T25'   : 'Type 25'
  17.             ,   'Ghia'  : 'Karmann Ghia'
  18.             ,   'T3'    : 'Type 3'
  19.             ,   'G1'    : 'MK1 Golf'
  20.             ,   'G1C'   : 'MK1 Golf Cabriolet'
  21.             ,   'CADDY' : 'MK1 Caddy'
  22.             ,   'G2'    : 'MK2 Golf'
  23.             ,   'SC1'   : 'MK1/2 Scirocco'
  24.             ,   'T4'    : 'T4'
  25.             ,   'CO'    : 'Corrado'
  26.             ,   'MISC'  : 'MISC'
  27.         } />
  28.  
  29.         <cfreturn this />
  30.     </cffunction>
  31.  
  32.  
  33.     <!--- Get category --->
  34.     <cffunction name="getCategory" returntype="string" output="false">
  35.         <cfargument name="vehicleID" required="true" type="string" hint="Vehicle type" />
  36.  
  37.         <cfscript>
  38.             if (structKeyExists(Variables.VehicleCategories, Arguments.VehicleID)) {
  39.                 return Variables.VehicleCategories[Arguments.VehicleID];
  40.             }
  41.             else {
  42.                 return 'Base SKUs';
  43.             }
  44.         </cfscript>
  45.  
  46.     </cffunction>
  47.  
  48.     <!--- Get categories --->
  49.     <cffunction name="getVehicleCategories" returntype="struct" output="false">
  50.  
  51.         <cfscript>
  52.             return Variables.VehicleCategories;
  53.         </cfscript>
  54.  
  55.     </cffunction>  
  56.  
  57. </cfcomponent>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement