home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 November / PCWNOV07.iso / shared / regwiz.cab / RegWizUI.dll / HTML / SUBINFODATA.VBS < prev    next >
Encoding:
Text File  |  2005-07-13  |  52.3 KB  |  2,199 lines

  1. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  2. ' File: SubInfoData.cpp
  3. ' Author: Parag Dixit
  4. '
  5. ' Provides script API's for operations on the  subscription database
  6. '
  7. '''
  8. ' IMPORTANT NOTE: You must call the function below before using any API's or objects in this class
  9. '''
  10. ' Function InitScriptAPI(p_objSubMgr)
  11. ' Purpose: Initialize script API's
  12. '
  13. ' Pararmeters:
  14. ' [in] p_objSubMgr: Sub manager object created using object tag with license key
  15. '
  16. ' Returns:
  17. ' VOID 
  18. '
  19. ''
  20. ' Function DeinitScriptAPI()
  21. ' Purpose: Un Initialize script API's
  22. '
  23. ' Pararmeters:
  24. '
  25. ' Returns:
  26. ' VOID 
  27. '
  28. '
  29. '
  30. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  31. ' Classes
  32. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  33. ' CSUBSCRIPTIONDATA
  34. '
  35. ' This class holds all the subscription data.
  36. '
  37. ' CSubscriptionData Properties...
  38. '
  39. ' Name: AppId
  40. ' Type: string
  41. ' Semantics: This is an identifier that defines the application category.
  42. ' Example: VSO, MPF, MPS etc.
  43. '
  44. ' Name: AppCode
  45. ' Type: string
  46. ' Semantics: This is the application code. For perpetual versions, the application code will 
  47. '            vary from version to version. For online versions, the application 
  48. '            code and the appid are the same.
  49. ' Example: VSH8 (Home Edition, v8.0), VSP9 (Pro Edition, v9.0)
  50. '
  51. ' Name: AccountId
  52. ' Type: string
  53. ' Semantics: The user account identifier.
  54. ' Example: 701456
  55. '
  56. ' Name: Perpetual
  57. ' Type: long
  58. ' Semantics: Part of the subscription type. If this attribute is 1, then its a perpetual version.
  59. '            If value is 0, then its a subscription. The default value is 0.
  60. '
  61. ' Name: Trial
  62. ' Type: long
  63. ' Semantics: Part of the subscription type. If this attribute is 1, then its a trial version.
  64. '            If value is 0, then its a paid version. The default value is 0.
  65. '
  66. ' Name: ExpiryDate
  67. ' Type: string
  68. ' Semantics: Online version will stop running and user will not get any updates after this date.  
  69. '            User will get all the updates/upgrades as long as the subscription is not expired.
  70. '            Perpetual versions will continue to run even after this date, but will not get any 
  71. '            Content updates (DAT files, Spam filters, etc).  Also user will only get Content update and 
  72. '            bug fixes before the expiry of this date. Format of the expiry date is yyyymmdd
  73. ' Example: 20030508
  74. '
  75. ' Name: SyncUrl
  76. ' Type: string
  77. ' Semantics: The full path to the Url that will be used to periodically synchronize the user's 
  78. '            subscription information on the computer with the backend.
  79. '            This should be same for all the apps for the give Backend for performance reasons.
  80. ' Example: http://us.mcafee.com/apps/vso/en-us/vso5/syncapp.asp
  81. '
  82. ' Name: Website
  83. ' Type: string
  84. ' Semantics: The domain name of the website with which this application is connected.
  85. ' Example: Fr.mcafee.com,Us.mcafee.com, etc.
  86. '
  87. ' Name: Backend
  88. ' Type: string
  89. ' Semantics: The Web services database identifier
  90. ' Example: McAf_Ebizsol,AOL, etc.
  91. '
  92. ' Name: AffId
  93. ' Type: string
  94. ' Semantics: Web services identify a package by the affiliate Id. 
  95. '            For e.g. the affiliate Id may be used to describe a DELL VSO 90 day trial.
  96. ' Example: 111-22
  97. '
  98. ' Name: Lang
  99. ' Type: string
  100. ' Semantics: The language of the application
  101. ' Example: en-us
  102. '
  103. ''
  104. ' CSubscriptionData Example Usage
  105. '---------------------------------
  106. ' Dim objSubInfo
  107. ' Set objSubInfo = new CSubscriptionData
  108. ' objSubInfo.AccountID = "3434"
  109. '  etc...
  110. '
  111. '
  112. ''''''''''''''''''''''''''''''''
  113. ' CAPPDATA
  114. '
  115. ' This class has all application specific data
  116. '
  117. ' CAppData Properties...
  118. '
  119. ' Name: No_Die
  120. ' Type: string
  121. ' Semantics: This is application specific information. This flag specifies if product is no_die (no_die = 1)
  122. '
  123. '
  124. ' CAppData Example Usage
  125. '---------------------------------
  126. ' Dim objAppInfo
  127. ' Set objAppInfo = new CAppData
  128. ' objSubInfo.No_Die = "1"
  129. '  etc...
  130. '
  131. '''''''''''''''''''''''''''''''
  132. ' CBACKWARDCOMPATIBILITYSUBINFO
  133. '
  134. ' This class is a wrapper for functions that extact information for 'older' applications that store their information in the registry
  135. '
  136. ' CBackwardCompatibilitySubInfo methods...
  137. '
  138. ' Public Function GetExpiryDate(p_AppId, ByRef p_lRetVal)
  139. ' Purpose: To get the application expiry date for legacy applications
  140. '
  141. ' Pararmeters:
  142. ' [in] p_AppId     : The Application ID
  143. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  144. '
  145. ' Returns:
  146. ' The application expiry date
  147. ''
  148. ' Public Function GetAccountId(p_AppId, ByRef p_lRetVal)
  149. ' Purpose: To get account ID for legacy applications
  150. '
  151. ' Pararmeters:
  152. ' [in] p_AppId     : The Application ID
  153. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  154. '
  155. ' Returns:
  156. ' The application specific account ID
  157. ''
  158. ' Public Function GetSubType(p_AppId, ByRef p_lRetVal)
  159. ' Purpose: To get the subtype for legacy applications
  160. '
  161. ' Pararmeters:
  162. ' [in] p_AppId     : The Application ID
  163. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  164. '
  165. ' Returns:
  166. ' The application sub-type
  167. ''
  168. ' Public Function GetExpiryDays(p_AppId, ByRef p_lRetVal)
  169. ' Purpose: To get the number of days for the application to expire
  170. '
  171. ' Pararmeters:
  172. ' [in] p_AppId     : The Application ID
  173. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  174. '
  175. ' Returns:
  176. ' The number of days to expire
  177. ''
  178. ' Public Function GetAppCode(p_AppId, ByRef p_lRetVal)
  179. ' Purpose: To get the application code if present
  180. '
  181. ' Pararmeters:
  182. ' [in] p_AppId     : The Application ID
  183. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  184. '
  185. ' Returns:
  186. ' The application code
  187. ''
  188. ' Public Function IsAppExpired(p_AppId, ByRef p_lRetVal)
  189. ' Purpose: To determine if the app is expired
  190. '
  191. ' Pararmeters:
  192. ' [in] p_AppId     : The Application ID
  193. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  194. '
  195. ' Returns:
  196. ' 'True' if app is expired, 'False' if not.
  197. ''
  198. ' Public Function IsPerpetual(p_AppId, ByRef p_lRetVal)
  199. ' Purpose: To determine if the app is a perpetual version
  200. '
  201. ' Pararmeters:
  202. ' [in] p_AppId     : The Application ID
  203. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  204. '
  205. ' Returns:
  206. ' 'True' if app is perpetual, 'False' if not.
  207. ''
  208. ' Public Function IsTrial(p_AppId, ByRef p_lRetVal)
  209. ' Purpose: To determine if the app is a trial version
  210. '
  211. ' Pararmeters:
  212. ' [in] p_AppId     : The Application ID
  213. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  214. '
  215. ' Returns:
  216. ' 'True' if app is a trial version, 'False' if not.
  217. ''
  218. ' Public Function IsNoDie(p_AppId, ByRef p_lRetVal)
  219. '
  220. ' Purpose: To determine if the app has the no-die flag set
  221. '
  222. ' Pararmeters:
  223. ' [in] p_AppId     : The Application ID
  224. ' [out] p_lRetVal  : An MCSUBDATA_* error code
  225. '
  226. ' Returns:
  227. ' 'True' if app has no-die flag set, 'False' if not.
  228. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  229. ' API Functions
  230. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  231. '
  232. ''
  233. ' Function IsAppActivated(p_AppId, p_AppCode, p_Backend, ByRef lRetVal)
  234. ' Purpose: To find out whether the application identified by AppdId, AppCode and Backend 
  235. ' has been activated on the backend. An application is assumed to be 
  236. ' activated only if there is an entry in the subscription database identified by 
  237. ' the AppId, AppCode, Backend and the entry contains the mandatory 
  238. ' information like expiry_date, sub_type, accnt_id.
  239. '
  240. ' Pararmeters:
  241. ' [in] p_AppId   : The Application ID
  242. ' [in] p_AppCode : Application Code
  243. ' [in] p_Backend : Backend  
  244. ' [out] lRetVal  : An MCSUBDATA_* error code
  245. '
  246. ' Returns:
  247. ' 'True' if application information is found in the database.
  248. ' 'False' if application information was not found in the database.
  249. '
  250. ''
  251. ' Function IsPartnerAppActivated(p_AppId, p_AppCode, p_Backend, p_AffID, ByRef lRetVal)
  252. ' Find whether the application identified by AppdId, 
  253. ' AppCode, AffID and Backend has subscription information in the database.
  254. '
  255. ' Pararmeters:
  256. ' [in] p_AppId   : The Application ID
  257. ' [in] p_AppCode : Application Code
  258. ' [in] p_Backend : Backend  
  259. ' [in] p_AffID     : The Affiliate ID
  260. ' [out] lRetVal  : An MCSUBDATA_* error code
  261. '
  262. ' Returns:
  263. ' 'True' if application information is found in the database.
  264. ' 'False' if application information was not found in the database.
  265. '
  266. ''
  267. ' Function IsAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, ByRef lRetVal)
  268. ' Find whether the application identified by AppdId, 
  269. ' AppCode and Backend has subscription information in the database.
  270. '
  271. ' Pararmeters:
  272. ' [in] p_AppId   : The Application ID
  273. ' [in] p_AppCode : Application Code
  274. ' [in] p_Backend : Backend  
  275. ' [in] p_Trial     : Trial
  276. ' [out] lRetVal  : An MCSUBDATA_* error code
  277. '
  278. ' Returns:
  279. ' 'True' if application information is found in the database.
  280. ' 'False' if application information was not found in the database.
  281. '
  282. ''
  283. ' Function IsPartnerAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, p_AffId, ByRef lRetVal)
  284. ' Find whether the application identified by AppdId, 
  285. ' AppCode and Backend has subscription information in the database.
  286. '
  287. ' Pararmeters:
  288. ' [in] p_AppId   : The Application ID
  289. ' [in] p_AppCode : Application Code
  290. ' [in] p_Backend : Backend  
  291. ' [in] p_Trial     : Trial
  292. ' [in] p_AffId     : Affiliate ID
  293. ' [out] lRetVal  : An MCSUBDATA_* error code
  294. '
  295. ' Returns:
  296. ' 'True' if application information is found in the database.
  297. ' 'False' if application information was not found in the database.
  298. '
  299. ''
  300. ' Function GetUserRegistered(p_Backend, p_AccntID)
  301. ' Finds out if the subscription database has at least one user id associated with Backend.
  302. '
  303. ' Pararmeters:
  304. ' [in] p_Backend : Backend  
  305. ' [out] p_AccntID : The AccountID returned for that backend
  306. '
  307. ' Returns:
  308. ' An MCSUBDATA_* error code
  309. '
  310. ''
  311. ' Function CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, p_AppInfo)
  312. ' Write the subscription information for the application identified by AppId, AppCode into the subscription database. 
  313. '
  314. ' Pararmeters:
  315. ' [in] p_AppId     : AppID
  316. ' [in] p_AppCode : The App Code
  317. ' [in] p_SubInfo : A CSubscriptionData instance, with relevant properties for Subscription info  set
  318. ' [in] p_AppInfo : A CAppData instance, with relevant properties for Appinfo  set
  319. '
  320. ' Returns: An MCSUBDATA_* error code
  321. ''
  322. ' Function AddSubInfo(p_AppId, p_AppCode, p_SubInfo, p_bForce)
  323. ' Write the subscription information for the application identified by AppId, AppCode into the subscription database. 
  324. '
  325. ' Pararmeters:
  326. ' [in] p_AppId     : AppID
  327. ' [in] p_AppCode : The App Code
  328. ' [in] p_SubInfo : A CSubscriptionData instance, with all parameters set
  329. '
  330. ' Returns: An MCSUBDATA_* error code
  331. ''
  332. ' Function AddSubInfoEx(p_AppId, p_AppCode, p_SubInfo, p_AppInfo, p_bForce)
  333. ' Write the subscription information for the application identified by AppId, AppCode into the subscription database. 
  334. '
  335. ' Pararmeters:
  336. ' [in] p_AppId     : AppID
  337. ' [in] p_AppCode : The App Code
  338. ' [in] p_SubInfo : A CSubscriptionData instance, with all parameters set
  339. ' [in] p_AppInfo : Application Info object
  340. '
  341. ' Returns: An MCSUBDATA_* error code
  342.  
  343. ' Sameer(07/09/2004): This was added as a separate function so that the caller has the option to pass in
  344. ' the application info object. This will be used ONLY IFF p_bForce = True. As can be seen in the flow below
  345. ' if p_bForce = False then the application info object is not used.
  346. ' A used case scenario is for DELL registrations where there is an existing appinfo section with "no_die = 1".
  347. ' For a subsequent registration AddSubInfoEx is called with p_bForce = TRUE and the existing appinfo object. That
  348. ' we preserve the no_die flag for subsequent registrations also.
  349.  
  350. ''
  351. ' Function GetSubInfo(p_AppId, p_AppCode, lRetVal)
  352. ' Get the subscription information identified by AppId and AppCode from the database. 
  353. '
  354. ' Pararmeters:
  355. ' [in] p_AppId     : AppID
  356. ' [in] p_AppCode : The App Code
  357. ' [out] p_obj      : A CSubscriptionData object with all known properties set.
  358. '                      All unused properties are ""
  359. '
  360. ' Returns: A MCSUBDATA_* error code
  361. '
  362. ''
  363. ' Function GetAppInfo(p_AppId, p_AppCode, lRetVal)
  364. ' Get the subscription information identified by AppId and AppCode from the database. 
  365. '
  366. ' Pararmeters:
  367. ' [in] p_AppId     : AppID
  368. ' [in] p_AppCode : The App Code
  369. ' [out] p_obj      : A CAppData object with all known properties set.
  370. '                      All unused properties are ""
  371. '
  372. ' Returns: A MCSUBDATA_* error code
  373. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  374.  
  375.  
  376. option explicit
  377.  
  378.  
  379. ''
  380. ' Globals
  381. ''
  382. Dim g_obj_6704E42E_E5F6_Manager
  383.  
  384. ''
  385. ' Constants
  386. ''
  387. '
  388. ' These come from the object
  389. '
  390. Const MCSUBDATA_CURRENT_VERSION = "0.21"
  391.  
  392. Const MCSUBDATA_MCSUBOBJRET_SUCCESS                        = 7000
  393. Const MCSUBDATA_MCSUBOBJRET_OUTOFMEMORY                    = 14            'ERROR_OUTOFMEMORY
  394. Const MCSUBDATA_MCSUBOBJRET_NOINTERFACE                    = 2147500034    'E_NOINTERFACE
  395. Const MCSUBDATA_MCSUBOBJRET_INVALIDARG                    = 2147483651    'E_INVALIDARG
  396. Const MCSUBDATA_MCSUBOBJRET_ERROR                        = 7004
  397. Const MCSUBDATA_MCSUBOBJRET_READONLYPROPERTY            = 7005
  398. Const MCSUBDATA_MCSUBOBJRET_SUBDB_NOTFOUND                = 7006
  399. Const MCSUBDATA_MCSUBOBJRET_XMLCOMP_NOTFOUND            = 7007
  400. Const MCSUBDATA_MCSUBOBJRET_DB_LOADFAILED                = 7008
  401. Const MCSUBDATA_MCSUBOBJRET_DB_CHECKSUMFAILED            = 7009
  402. Const MCSUBDATA_MCSUBOBJRET_DB_CREATEFAILED                = 7010
  403. Const MCSUBDATA_MCSUBOBJRET_DB_ELEMENT_NOTFOUND            = 7011
  404. Const MCSUBDATA_MCSUBOBJRET_APPREG_FAILED                = 7012
  405. Const MCSUBDATA_MCSUBOBJRET_DATAENCRYPTION_FAILED        = 7013
  406. Const MCSUBDATA_MCSUBOBJRET_CREATE_ELEM_FAILED            = 7014
  407. Const MCSUBDATA_MCSUBOBJRET_BACKENDREG_FAILED            = 7015
  408. Const MCSUBDATA_MCSUBOBJRET_SUBDBPATH_NOTFOUND            = 7016
  409. Const MCSUBDATA_MCSUBOBJRET_SAVE_FAILED                    = 7017
  410. Const MCSUBDATA_MCSUBOBJRET_MANDATORYPROP_UNDEFINED        = 7018
  411. Const MCSUBDATA_MCSUBOBJRET_INVALIDSUBINFO_VER            = 7019
  412. Const MCSUBDATA_MCSUBOBJRET_INVALID_APPSUBINFO            = 7020
  413. Const MCSUBDATA_MCSUBOBJRET_PROP_MISMATCH                = 7021
  414. Const MCSUBDATA_MCSUBOBJRET_INVALID_PROPNAME            = 7022
  415. Const MCSUBDATA_MCSUBOBJRET_CREATEDIR_FAILED            = 7023
  416. Const MCSUBDATA_MCSUBOBJRET_EXCLUSIVEDBACCESS_FAILED    = 7024
  417. Const MCSUBDATA_MCSUBOBJRET_NO_PROPERTIES_SET            = 7025
  418. Const MCSUBDATA_MCSUBOBJRET_DATADECRYPTION_FAILED        = 7026
  419. Const MCSUBDATA_MCSUBOBJRET_NOAPPS_REGISTERED            = 7027
  420. Const MCSUBDATA_MCSUBOBJRET_DB_REMOVEELEM_FAILED        = 7028
  421. Const MCSUBDATA_MCSUBOBJRET_APP_NOT_REGISTERED            = 7029
  422. Const MCSUBDATA_MCSUBOBJRET_PROP_INVALIDDATA            = 7030
  423. Const MCSUBDATA_MCSUBOBJRET_DB_CORRUPT                    = 1392            'ERROR_FILE_CORRUPT
  424.  
  425.  
  426. '
  427. ' These are used internally in the scripts
  428. '
  429. Dim MCSUBDATA_SUCCESS
  430. MCSUBDATA_SUCCESS                                         = MCSUBDATA_MCSUBOBJRET_SUCCESS
  431. Const MCSUBDATA_INVALID_PARAMETER                        = 87           'ERROR_INVALID_PARAMETER
  432. Const MCSUBDATA_COULD_NOT_CREATE_OBJECT                    = 2           
  433. Const MCSUBDATA_COULD_NOT_GET_PROP_LIST                    = 3           
  434.  
  435.  
  436. ''
  437. ' Some well known Property names (these are known by the object)
  438. ''
  439. Const MCSUBINFO_PROP_APPID_STR                            = "appid"
  440. Const MCSUBINFO_PROP_APPCODE_STR                        = "app_code"
  441. Const MCSUBINFO_PROP_ACCNTID_STR                        = "accnt_id"
  442. Const MCSUBINFO_PROP_EXPIRYDATE_STR                        = "settings"
  443. Const MCSUBINFO_PROP_BACKEND_STR                        = "backend"
  444. Const MCSUBINFO_PROP_SUBINFOVER_STR                        = "subinfo_ver"
  445. Const MCSUBINFO_PROP_SUBCHECKURL_STR                    = "sync_url"
  446. ''
  447. ' Property values known by the script
  448. ''
  449. Const MCSUBINFO_PROP_WEBSITE_STR                        = "website"
  450. Const MCSUBINFO_PROP_AFFID_STR                            = "affid"
  451. Const MCSUBINFO_PROP_PERPETUAL_STR                         = "perpetual"
  452. Const MCSUBINFO_PROP_TRIAL_STR                             = "trial"
  453. Const MCSUBINFO_PROP_LANG_STR                             = "applang"
  454.  
  455. Const MCSUBINFO_TOTAL_KNOWN_SUBDATA_PROP_COUNT            = 12
  456.  
  457. ''
  458. ' App Data property names:
  459. ''
  460. Const MCSUBINFO_PROP_NODIE_STR                            = "no_die"
  461.  
  462. Const MCSUBINFO_TOTAL_KNOWN_APPDATA_PROP_COUNT            = 1
  463.  
  464. ''
  465. ' Enums
  466. ''
  467. Const MCSUBINFO_ENUM_INFOTYPE_SUBDATA                    = 1
  468. Const MCSUBINFO_ENUM_INFOTYPE_APPDATA                    = 2
  469.  
  470. ''
  471. ' CData is the base class with all the property handling logic
  472. ''
  473. Class CData
  474. '{
  475.     Private m_prop
  476.     Private m_cntProp
  477.  
  478.     Public Property Get PropertyCount()
  479.     '{
  480.         PropertyCount = m_cntProp
  481.     '}
  482.     End Property
  483.  
  484.     Public Property Let PropertyCount(cnt)
  485.     '{
  486.         Dim iIdx
  487.         Dim iNewPropCnt
  488.  
  489.         iNewPropCnt = m_cntProp + cnt
  490.         ReDim Preserve m_prop(1, iNewPropCnt)
  491.         
  492.         For iIdx = m_cntProp to iNewPropCnt Step 1
  493.         '{
  494.             m_prop(0, iIdx) = ""
  495.             m_prop(1, iIdx) = ""
  496.         '}
  497.         Next
  498.  
  499.         m_cntProp = iNewPropCnt 
  500.     '}
  501.     End Property
  502.  
  503.     Public Property Get Property(propName)
  504.     '{
  505.         Dim iIdx
  506.  
  507.         For iIdx = LBound(m_prop, 2) to UBound(m_prop, 2) Step 1
  508.         '{
  509.             If propName = m_prop(0, iIdx) Then
  510.             '{
  511.                 Property = m_prop(1, iIdx)
  512.                 Exit Property
  513.             '}
  514.             End If
  515.         '}
  516.         Next
  517.  
  518.         Property = CStr("")
  519.     '}
  520.     End Property
  521.  
  522.     Public Property Let Property(propName, propValue)
  523.     '{
  524.         Dim iIdx
  525.  
  526.         ''
  527.         ' First Try to Find propName.
  528.         ' If not found, then create a new property in the last empty slot
  529.         ''
  530.         For iIdx = LBound(m_prop, 2) to UBound(m_prop, 2) Step 1
  531.         '{
  532.             If propName = m_prop(0, iIdx) Then
  533.             '{
  534.                 m_prop(1, iIdx) = propValue
  535.                 Exit Property
  536.             '}
  537.             End If
  538.         '}
  539.         Next
  540.         
  541.         For iIdx = LBound(m_prop, 2) to UBound(m_prop, 2) Step 1
  542.         '{
  543.             If "" = m_prop(0, iIdx) Then
  544.             '{
  545.                 m_prop(0, iIdx) = propName
  546.                 m_prop(1, iIdx) = propValue
  547.                 Exit Property
  548.             '}
  549.             End If
  550.         '}
  551.         Next
  552.     '}
  553.     End Property
  554.  
  555.     Public Property Get PropertyNameList()
  556.     '{
  557.         Dim iIdx
  558.         Dim listProp()
  559.         Dim listCnt
  560.  
  561.         listCnt = 0
  562.  
  563.         For iIdx = LBound(m_prop, 2) to UBound(m_prop, 2) Step 1
  564.         '{
  565.             If not "" = m_prop(0, iIdx) Then
  566.             '{
  567.                 listCnt = listCnt + 1
  568.                 ReDim Preserve listProp(listCnt)
  569.                 listProp(listCnt - 1) = m_prop(0, iIdx)
  570.             '}
  571.             End If
  572.         '}
  573.         Next
  574.  
  575.         PropertyNameList = listProp
  576.     '}
  577.     End Property
  578.  
  579.     Private Sub Class_Initialize
  580.     '{
  581.         m_cntProp = 0
  582.         m_prop = Array()
  583.         ReDim m_prop(1, m_cntProp)
  584.     '}
  585.     End Sub
  586.  
  587.     Private Sub Class_Terminate
  588.     '{
  589.         ReDim m_prop(1)
  590.     '}
  591.     End Sub
  592. '}
  593. End Class
  594.  
  595. ''
  596. ' CAppData 'inherits' from CData and is used for the AppData information (eg NO_DIE flag)
  597. ''
  598. Class CAppData
  599. '{
  600.     Private m_objBaseCls
  601.  
  602.     Public Property Get No_Die()
  603.     '{
  604.         No_Die = Base.Property(MCSUBINFO_PROP_NODIE_STR)
  605.     '}
  606.     End Property
  607.  
  608.     Public Property Let No_Die(flag)
  609.     '{
  610.         Base.Property(MCSUBINFO_PROP_NODIE_STR) = flag
  611.     '}
  612.     End Property
  613.  
  614.     Public Property Get Base()
  615.     '{
  616.         Set Base = m_objBaseCls
  617.     '}
  618.     End Property
  619.     
  620.     Private Sub Class_Initialize
  621.     '{
  622.         Set m_objBaseCls = new CData
  623.  
  624.         If not m_objBaseCls is nothing Then 
  625.         '{
  626.             m_objBaseCls.PropertyCount = MCSUBINFO_TOTAL_KNOWN_APPDATA_PROP_COUNT
  627.             m_objBaseCls.Property(MCSUBINFO_PROP_NODIE_STR) = ""
  628.         '}
  629.         End If
  630.     '}
  631.     End Sub
  632.  
  633.     Private Sub Class_Terminate
  634.     '{
  635.         If not m_objBaseCls is nothing Then
  636.         '{
  637.             Set m_objBaseCls = nothing
  638.         '}
  639.         End If
  640.     '}
  641.     End Sub
  642. '}
  643. End Class
  644.  
  645. ''
  646. ' CSubscriptionData 'inherits' from CData and holds all the subscription info data
  647. ''
  648. Class CSubscriptionData
  649. '{
  650.     Private m_objBaseCls
  651.     
  652.     Public Property Get AppId()
  653.     '{
  654.         AppId = Base.Property(MCSUBINFO_PROP_APPID_STR)
  655.     '}
  656.     End Property
  657.  
  658.     Public Property Let AppId(AId)
  659.     '{
  660.         Base.Property(MCSUBINFO_PROP_APPID_STR) = AId
  661.     '}
  662.     End Property
  663.     
  664.     Public Property Get AppCode()
  665.     '{
  666.         AppCode = Base.Property(MCSUBINFO_PROP_APPCODE_STR)
  667.     '}
  668.     End Property
  669.  
  670.     Public Property Let AppCode(Acode)
  671.     '{
  672.         Base.Property(MCSUBINFO_PROP_APPCODE_STR) = Acode
  673.     '}
  674.     End Property
  675.  
  676.     Public Property Get AccountId()
  677.     '{
  678.         AccountId = Base.Property(MCSUBINFO_PROP_ACCNTID_STR)
  679.     '}
  680.     End Property
  681.  
  682.     Public Property Let AccountId(AccntId)
  683.     '{
  684.         Base.Property(MCSUBINFO_PROP_ACCNTID_STR) = AccntId
  685.     '}
  686.     End Property
  687.  
  688.     Public Property Get Perpetual()
  689.     '{
  690.         Perpetual = Base.Property(MCSUBINFO_PROP_PERPETUAL_STR)
  691.     '}
  692.     End Property
  693.  
  694.     Public Property Let Perpetual(sT)
  695.     '{
  696.         Base.Property(MCSUBINFO_PROP_PERPETUAL_STR) = sT
  697.     '}
  698.     End Property
  699.     
  700.     Public Property Get Trial()
  701.     '{
  702.         Trial = Base.Property(MCSUBINFO_PROP_TRIAL_STR)
  703.     '}
  704.     End Property
  705.  
  706.     Public Property Let Trial(sT)
  707.     '{
  708.         Base.Property(MCSUBINFO_PROP_TRIAL_STR) = sT
  709.     '}
  710.     End Property
  711.     
  712.     Public Property Get ExpiryDate()
  713.     '{
  714.         ExpiryDate = Base.Property(MCSUBINFO_PROP_EXPIRYDATE_STR)
  715.     '}
  716.     End Property
  717.  
  718.     Public Property Let ExpiryDate(expDate)
  719.     '{
  720.         Base.Property(MCSUBINFO_PROP_EXPIRYDATE_STR) = expDate
  721.     '}
  722.     End Property
  723.  
  724.     Public Property Get SyncUrl()
  725.     '{
  726.         SyncUrl = Base.Property(MCSUBINFO_PROP_SUBCHECKURL_STR)
  727.     '}
  728.     End Property
  729.  
  730.     Public Property Let SyncUrl(sUrl)
  731.     '{
  732.         Base.Property(MCSUBINFO_PROP_SUBCHECKURL_STR) = sUrl
  733.     '}
  734.     End Property
  735.  
  736.     Public Property Get Website()
  737.     '{
  738.         WebSite = Base.Property(MCSUBINFO_PROP_WEBSITE_STR)
  739.     '}
  740.     End Property
  741.  
  742.     Public Property Let Website(wSite)
  743.     '{
  744.         Base.Property(MCSUBINFO_PROP_WEBSITE_STR) = wSite
  745.     '}
  746.     End Property
  747.  
  748.     Public Property Get Backend()
  749.     '{
  750.         Backend = Base.Property(MCSUBINFO_PROP_BACKEND_STR)
  751.     '}
  752.     End Property
  753.  
  754.     Public Property Let Backend(backendId)
  755.     '{
  756.         Base.Property(MCSUBINFO_PROP_BACKEND_STR) = backendId
  757.     '}
  758.     End Property
  759.  
  760.     Public Property Get AffId()
  761.     '{
  762.         AffId = Base.Property(MCSUBINFO_PROP_AFFID_STR)
  763.     '}
  764.     End Property
  765.  
  766.     Public Property Let AffId(aff_id)
  767.     '{
  768.         Base.Property(MCSUBINFO_PROP_AFFID_STR) = aff_id
  769.     '}
  770.     End Property
  771.  
  772.     Public Property Get Lang()
  773.     '{
  774.         Lang = Base.Property(MCSUBINFO_PROP_LANG_STR)
  775.     '}
  776.     End Property
  777.  
  778.     Public Property Let Lang(lang_id)
  779.     '{
  780.         Base.Property(MCSUBINFO_PROP_LANG_STR) = lang_id
  781.     '}
  782.     End Property
  783.  
  784.     Public Property Get DBVersion()
  785.     '{
  786.         DBVersion = Base.Property(MCSUBINFO_PROP_SUBINFOVER_STR)
  787.     '}
  788.     End Property
  789.  
  790.     Public Property Let DBVersion(ver)
  791.     '{
  792.         Base.Property(MCSUBINFO_PROP_SUBINFOVER_STR) = ver
  793.     '}
  794.     End Property
  795.     
  796.     Public Property Get Base()
  797.     '{
  798.         Set Base = m_objBaseCls
  799.     '}
  800.     End Property
  801.     
  802.     Private Sub Class_Initialize
  803.     '{
  804.         Set m_objBaseCls = new CData
  805.  
  806.         If not m_objBaseCls is nothing Then 
  807.         '{
  808.             m_objBaseCls.PropertyCount = MCSUBINFO_TOTAL_KNOWN_SUBDATA_PROP_COUNT
  809.             m_objBaseCls.Property(MCSUBINFO_PROP_APPID_STR)            = ""
  810.             m_objBaseCls.Property(MCSUBINFO_PROP_APPCODE_STR)        = ""
  811.             m_objBaseCls.Property(MCSUBINFO_PROP_PERPETUAL_STR)        = "0"
  812.             m_objBaseCls.Property(MCSUBINFO_PROP_TRIAL_STR)            = "0"
  813.             m_objBaseCls.Property(MCSUBINFO_PROP_ACCNTID_STR)        = ""
  814.             m_objBaseCls.Property(MCSUBINFO_PROP_EXPIRYDATE_STR)    = ""
  815.             m_objBaseCls.Property(MCSUBINFO_PROP_BACKEND_STR)        = ""
  816.             m_objBaseCls.Property(MCSUBINFO_PROP_SUBINFOVER_STR)    = ""
  817.             m_objBaseCls.Property(MCSUBINFO_PROP_SUBCHECKURL_STR)    = ""
  818.             m_objBaseCls.Property(MCSUBINFO_PROP_WEBSITE_STR)        = ""
  819.             m_objBaseCls.Property(MCSUBINFO_PROP_AFFID_STR)            = ""
  820.             m_objBaseCls.Property(MCSUBINFO_PROP_LANG_STR)            = ""
  821.         '}
  822.         End If
  823.     '}
  824.     End Sub
  825.  
  826.     Private Sub Class_Terminate
  827.     '{
  828.         If not m_objBaseCls is nothing Then
  829.         '{
  830.             Set m_objBaseCls = nothing
  831.         '}
  832.         End If
  833.     '}
  834.     End Sub
  835. '}
  836. End Class
  837.  
  838. Class CSubMrg
  839. '{
  840.     Private m_objSubMgr
  841.     Private m_objSubInfo
  842.     Private m_objAppInfo
  843.  
  844.     Public Property Get SubManager()
  845.     '{
  846.         Set SubManager = m_objSubMgr
  847.     '}
  848.     End Property
  849.  
  850.     Public Property Get SubInfo()
  851.     '{
  852.         Set SubInfo = m_objSubInfo
  853.     '}
  854.     End Property
  855.     
  856.     Public Property Get AppInfo()
  857.     '{
  858.         Set AppInfo = m_objAppInfo
  859.     '}
  860.     End Property
  861.     
  862.     Public Function CreateAppInfoObject(p_AppId, p_AppCode)
  863.     '{
  864.         Dim lRetVal
  865.         
  866.         If m_objSubMgr is nothing Then
  867.         '{
  868.             CreateAppInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  869.             Exit Function
  870.         '}
  871.         End if
  872.  
  873.         Set m_objAppInfo = m_objSubMgr.CreateAppInfo(p_AppId, lRetVal)
  874.         If m_objAppInfo is Nothing Or not IsObject(m_objAppInfo) Then
  875.         '{
  876.             CreateAppInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  877.             Exit Function
  878.         '}
  879.         End If
  880.  
  881.         CreateAppInfoObject = lRetVal
  882.     '}
  883.     End Function
  884.     
  885.     Public Function CreateSubInfoObject(p_AppId, p_AppCode)
  886.     '{
  887.         Dim lRetVal
  888.         
  889.         If m_objSubMgr is nothing Then
  890.         '{
  891.             CreateSubInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  892.             Exit Function
  893.         '}
  894.         End if
  895.  
  896.         Set m_objSubInfo = m_objSubMgr.CreateSubInfo(p_AppId, p_AppCode, lRetVal)
  897.         If m_objSubInfo is Nothing Or not IsObject(m_objSubInfo) Then
  898.         '{
  899.             CreateSubInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  900.             Exit Function
  901.         '}
  902.         End If
  903.  
  904.         CreateSubInfoObject = lRetVal
  905.     '}
  906.     End Function
  907.  
  908.     Public Function GetSubInfoObject(p_AppId, p_AppCode)
  909.     '{
  910.         Dim lRetVal
  911.         
  912.         If m_objSubMgr is nothing Then
  913.         '{
  914.             GetSubInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  915.             Exit Function
  916.         '}
  917.         End if
  918.  
  919.         Set m_objSubInfo = m_objSubMgr.GetSubInfo(p_AppId, p_AppCode, lRetVal)
  920.         If m_objSubInfo is Nothing Or not IsObject(m_objSubInfo) Then
  921.         '{
  922.             GetSubInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  923.             Exit Function
  924.         '}
  925.         End If
  926.  
  927.         GetSubInfoObject = lRetVal
  928.     '}
  929.     End Function
  930.     
  931.     Public Function GetAppInfoObject(p_AppId)
  932.     '{
  933.         Dim lRetVal
  934.         
  935.         If m_objSubMgr is nothing Then
  936.         '{
  937.             GetAppInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  938.             Exit Function
  939.         '}
  940.         End if
  941.  
  942.         Set m_objAppInfo = m_objSubMgr.GetAppInfo(p_AppId, lRetVal)
  943.         If m_objAppInfo is Nothing Or not IsObject(m_objAppInfo) Then
  944.         '{
  945.             GetAppInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  946.             Exit Function
  947.         '}
  948.         End If
  949.  
  950.         GetAppInfoObject = lRetVal
  951.     '}
  952.     End Function
  953.     
  954.     Private Sub Class_Initialize
  955.     '{
  956.         Set m_objSubMgr = g_obj_6704E42E_E5F6_Manager
  957.  
  958.         Set m_objSubInfo = nothing
  959.         Set m_objAppInfo = nothing
  960.     '}
  961.     End Sub
  962.  
  963.     Private Sub Class_Terminate
  964.     '{
  965.         If not m_objSubInfo is nothing Then
  966.         '{
  967.             Set m_objSubInfo = nothing
  968.         '}
  969.         End If
  970.         
  971.         If not m_objAppInfo is nothing Then
  972.         '{
  973.             Set m_objAppInfo = nothing
  974.         '}
  975.         End If
  976.     '}
  977.     End Sub
  978. '}
  979. End Class
  980.  
  981. Class CBackwardCompatibilitySubInfo
  982. '{
  983.     Private m_objSubMgr
  984.     Private m_objLegacySubMgr
  985.     Dim m_lRetVal
  986.     
  987.     Public Function GetExpiryDate(p_AppId, ByRef p_lRetVal)
  988.     '{
  989.         If m_objLegacySubMgr is nothing Then
  990.         '{
  991.             p_lRetVal = m_lRetVal
  992.             GetExpiryDate = ""
  993.             Exit Function
  994.         '}
  995.         End If
  996.         
  997.         GetExpiryDate = m_objLegacySubMgr.GetExpiryDate(p_AppId, p_lRetVal)
  998.     '}
  999.     End Function
  1000.     
  1001.     Public Function GetAccountId(p_AppId, ByRef p_lRetVal)
  1002.     '{
  1003.         If m_objLegacySubMgr is nothing Then
  1004.         '{
  1005.             p_lRetVal = m_lRetVal
  1006.             GetAccountId = ""
  1007.             Exit Function
  1008.         '}
  1009.         End If
  1010.         
  1011.         GetAccountId = m_objLegacySubMgr.GetAccountId(p_AppId, p_lRetVal)                
  1012.     '}
  1013.     End Function
  1014.     
  1015.     Public Function GetSubType(p_AppId, ByRef p_lRetVal)
  1016.     '{
  1017.         If m_objLegacySubMgr is nothing Then
  1018.         '{
  1019.             p_lRetVal = m_lRetVal
  1020.             GetSubType = ""
  1021.             Exit Function
  1022.         '}
  1023.         End If
  1024.  
  1025.         GetSubType = m_objLegacySubMgr.GetSubType(p_AppId, p_lRetVal)                
  1026.     '}
  1027.     End Function
  1028.     
  1029.     Public Function GetExpiryDays(p_AppId, ByRef p_lRetVal)
  1030.     '{
  1031.         If m_objLegacySubMgr is nothing Then
  1032.         '{
  1033.             p_lRetVal = m_lRetVal
  1034.             GetExpiryDays = ""
  1035.             Exit Function
  1036.         '}
  1037.         End If
  1038.         
  1039.         GetExpiryDays = m_objLegacySubMgr.GetExpiryDays(p_AppId, p_lRetVal)                
  1040.     '}
  1041.     End Function            
  1042.     
  1043.     Public Function GetAppCode(p_AppId, ByRef p_lRetVal)
  1044.     '{
  1045.         If m_objLegacySubMgr is nothing Then
  1046.         '{
  1047.             p_lRetVal = m_lRetVal
  1048.             GetAppCode = ""
  1049.             Exit Function
  1050.         '}
  1051.         End If
  1052.         
  1053.         GetAppCode = m_objLegacySubMgr.GetAppCode(p_AppId, p_lRetVal)                
  1054.     '}
  1055.     End Function            
  1056.     
  1057.     Public Function IsAppExpired(p_AppId, ByRef p_lRetVal)
  1058.     '{
  1059.         If m_objLegacySubMgr is nothing Then
  1060.         '{
  1061.             p_lRetVal = m_lRetVal
  1062.             IsAppExpired = ""
  1063.             Exit Function
  1064.         '}
  1065.         End If
  1066.         
  1067.         IsAppExpired = m_objLegacySubMgr.IsAppExpired(p_AppId, p_lRetVal)                
  1068.     '}
  1069.     End Function            
  1070.  
  1071.     Public Function IsPerpetual(p_AppId, ByRef p_lRetVal)
  1072.     '{
  1073.         If m_objLegacySubMgr is nothing Then
  1074.         '{
  1075.             p_lRetVal = m_lRetVal
  1076.             IsPerpetual = ""
  1077.             Exit Function
  1078.         '}
  1079.         End If
  1080.         
  1081.         IsPerpetual = m_objLegacySubMgr.IsPerpetual(p_AppId, p_lRetVal)                
  1082.     '}
  1083.     End Function            
  1084.  
  1085.     Public Function IsTrial(p_AppId, ByRef p_lRetVal)
  1086.     '{
  1087.         If m_objLegacySubMgr is nothing Then
  1088.         '{
  1089.             p_lRetVal = m_lRetVal
  1090.             IsTrial = ""
  1091.             Exit Function
  1092.         '}
  1093.         End If
  1094.         
  1095.         IsTrial = m_objLegacySubMgr.IsTrial(p_AppId, p_lRetVal)                
  1096.     '}
  1097.     End Function
  1098.  
  1099.     Public Function IsNoDie(p_AppId, ByRef p_lRetVal)
  1100.     '{
  1101.         If m_objLegacySubMgr is nothing Then
  1102.         '{
  1103.             p_lRetVal = m_lRetVal
  1104.             IsNoDie = ""
  1105.             Exit Function
  1106.         '}
  1107.         End If
  1108.         
  1109.         IsNoDie = m_objLegacySubMgr.IsNoDie(p_AppId, p_lRetVal)                
  1110.     '}
  1111.     End Function
  1112.     
  1113.     Private Sub Class_Initialize
  1114.     '{
  1115.         Set m_objSubMgr = g_obj_6704E42E_E5F6_Manager 'createObject("McSubMgr.McSubMgr")
  1116.         m_lRetVal = MCSUBDATA_SUCCESS
  1117.         
  1118.         If not m_objSubMgr is nothing Then
  1119.         '{
  1120.             Set m_objLegacySubMgr = m_objSubMgr.GetLegacySubMgr(m_lRetVal)
  1121.         '}
  1122.         End If
  1123.     '}
  1124.     End Sub
  1125.  
  1126.     Private Sub Class_Terminate
  1127.     '{
  1128.         If not m_objLegacySubMgr is nothing Then
  1129.         '{
  1130.             Set m_objLegacySubMgr = nothing
  1131.         '}
  1132.         End If
  1133.         
  1134.         If not m_objSubMgr is nothing Then
  1135.         '{
  1136.             Set m_objSubMgr = nothing
  1137.         '}
  1138.         End If
  1139.     '}
  1140.     End Sub
  1141. '}
  1142. End Class
  1143.  
  1144.  
  1145. ''
  1146. ' Function InitScriptAPI(p_objSubMgr)
  1147. ' Purpose: Initialize script API's
  1148. '
  1149. ' Pararmeters:
  1150. ' [in] p_objSubMgr: Sub manager object created using object tag with liscense key
  1151. '
  1152. ' Returns:
  1153. ' VOID 
  1154. '
  1155. Function InitScriptAPI(p_objSubMgr)
  1156. '{
  1157.     Set g_obj_6704E42E_E5F6_Manager = p_objSubMgr
  1158. '}
  1159. End Function
  1160.  
  1161.  
  1162. ''
  1163. ' Function DeinitScriptAPI()
  1164. ' Purpose: Un Initialize script API's
  1165. '
  1166. ' Pararmeters:
  1167. '
  1168. ' Returns:
  1169. ' VOID 
  1170. '
  1171. Function DeinitScriptAPI()
  1172. '{
  1173.     If not g_obj_6704E42E_E5F6_Manager is nothing Then
  1174.     '{
  1175.         Set g_obj_6704E42E_E5F6_Manager = nothing
  1176.     '}
  1177.     End If
  1178. '}
  1179. End Function
  1180.  
  1181.  
  1182. ''
  1183. ' Function IsAppActivated(p_AppId, p_AppCode, p_Backend, ByRef lRetVal)
  1184. ' Purpose: To find out whether the application identified by AppdId, AppCode and Backend 
  1185. ' has been activated on the backend. An application is assumed to be 
  1186. ' activated only if there is an entry in the subscription database identified by 
  1187. ' the AppId, AppCode, Backend and the entry contains the mandatory 
  1188. ' information like expiry_date, sub_type, accnt_id.
  1189. '
  1190. ' Pararmeters:
  1191. ' [in] p_AppId   : The Application ID
  1192. ' [in] p_AppCode : Application Code
  1193. ' [in] p_Backend : Backend  
  1194. ' [out] lRetVal  : An MCSUBDATA_* error code
  1195. '
  1196. ' Returns:
  1197. ' 'True' if application information is found in the database.
  1198. ' 'False' if application information was not found in the database.
  1199. '
  1200. Function IsAppActivated(p_AppId, p_AppCode, p_Backend, ByRef lRetVal)
  1201. '{
  1202.     Dim subMgr
  1203.     Dim lPropRetVal
  1204.     Dim propBackend, propAccntId, propExpiryDate, propTrial, propPerpetual
  1205.  
  1206.     Set subMgr = new CSubMrg
  1207.  
  1208.     IsAppActivated = False
  1209.     lRetVal = MCSUBDATA_SUCCESS
  1210.     
  1211.     If subMgr is nothing Then
  1212.     '{
  1213.         lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1214.         Exit Function
  1215.     '}
  1216.     End if
  1217.  
  1218.     If "" = p_AppId Or "" = p_AppCode Or "" = p_Backend Then
  1219.     '{
  1220.         lRetVal = MCSUBDATA_INVALID_PARAMETER
  1221.         Exit Function
  1222.     '}
  1223.     End if
  1224.  
  1225.     lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
  1226.  
  1227.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1228.     '{
  1229.         '
  1230.         ' If object creation fails, it could be because there is no database present. This does not denote an error condition
  1231.         '
  1232.         lRetVal = MCSUBDATA_SUCCESS
  1233.         Exit Function
  1234.     '}
  1235.     End If
  1236.     
  1237.     propBackend = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_BACKEND_STR, lPropRetVal) 
  1238.     
  1239.     '
  1240.     ' Backend property not found or it does not match, return false
  1241.     '
  1242.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or not p_Backend = propBackend Then
  1243.     '{
  1244.         Exit Function
  1245.     '}
  1246.     End if
  1247.  
  1248.     '
  1249.     ' If any of the below properties are not found or are invalid return false
  1250.     '
  1251.     propAccntId = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_ACCNTID_STR, lPropRetVal) 
  1252.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or propAccntId = "" Then
  1253.     '{
  1254.         Exit Function
  1255.     '}
  1256.     End if
  1257.     
  1258.     propPerpetual = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_PERPETUAL_STR, lPropRetVal) 
  1259.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or propPerpetual = "" Then
  1260.     '{
  1261.         Exit Function
  1262.     '}
  1263.     End if
  1264.     
  1265.     propTrial = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_TRIAL_STR, lPropRetVal) 
  1266.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or propTrial = "" Then
  1267.     '{
  1268.         Exit Function
  1269.     '}
  1270.     End If
  1271.  
  1272.     propExpiryDate = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_EXPIRYDATE_STR, lPropRetVal) 
  1273.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or propExpiryDate = "" Then
  1274.     '{
  1275.         Exit Function
  1276.     '}
  1277.     End if
  1278.  
  1279.     '
  1280.     ' If it got here without exiting then app is registered
  1281.     '
  1282.     IsAppActivated = True
  1283. '}
  1284. End Function
  1285.  
  1286. ''
  1287. ' Function IsPartnerAppActivated(p_AppId, p_AppCode, p_Backend, p_AffID, ByRef lRetVal)
  1288. ' Find whether the application identified by AppdId, 
  1289. ' AppCode, AffID and Backend has subscription information in the database.
  1290. '
  1291. ' Pararmeters:
  1292. ' [in] p_AppId   : The Application ID
  1293. ' [in] p_AppCode : Application Code
  1294. ' [in] p_Backend : Backend  
  1295. ' [in] p_AffID     : The Affiliate ID
  1296. ' [out] lRetVal  : An MCSUBDATA_* error code
  1297. '
  1298. ' Returns:
  1299. ' 'True' if application information is found in the database.
  1300. ' 'False' if application information was not found in the database.
  1301. '
  1302. Function IsPartnerAppActivated(p_AppId, p_AppCode, p_Backend, p_AffID, ByRef lRetVal)
  1303. '{
  1304.     Dim subMgr
  1305.     Dim propAffId
  1306.     Dim lPropRetVal
  1307.     
  1308.     IsPartnerAppActivated = False
  1309.     lRetVal = MCSUBDATA_SUCCESS
  1310.  
  1311.     If "" = p_AppId Or "" = p_AppCode Or "" = p_Backend Or "" = p_AffID Then
  1312.     '{
  1313.         lRetVal = MCSUBDATA_INVALID_PARAMETER
  1314.         Exit Function
  1315.     '}
  1316.     End if
  1317.  
  1318.     If False = IsAppActivated(p_AppId, p_AppCode, p_Backend, lRetVal) Then
  1319.     '{
  1320.         Exit Function    
  1321.     '}
  1322.     End if
  1323.  
  1324.     '
  1325.     ' If everything satisfied from IsAppRegisted then check for AffId
  1326.     '
  1327.     Set subMgr = new CSubMrg
  1328.  
  1329.     If subMgr is nothing Then
  1330.     '{
  1331.         lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1332.         Exit Function
  1333.     '}
  1334.     End if
  1335.  
  1336.     lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
  1337.  
  1338.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1339.     '{
  1340.         '
  1341.         ' If object creation fails, it could be because there is no database present. This does not denote an error condition
  1342.         '
  1343.         lRetVal = MCSUBDATA_SUCCESS
  1344.         Exit Function
  1345.     '}
  1346.     End If
  1347.     
  1348.     propAffId = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_AFFID_STR, lPropRetVal) 
  1349.     
  1350.     '
  1351.     ' Backend property not found or it does not match, return false
  1352.     '
  1353.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or not p_AffID = propAffId Then
  1354.     '{
  1355.         Exit Function
  1356.     '}
  1357.     End if
  1358.     
  1359.     IsPartnerAppActivated = True
  1360. '}
  1361. End Function
  1362.  
  1363. ''
  1364. ' Function IsAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, ByRef lRetVal)
  1365. ' Find whether the application identified by AppdId, 
  1366. ' AppCode and Backend has subscription information in the database.
  1367. '
  1368. ' Pararmeters:
  1369. ' [in] p_AppId   : The Application ID
  1370. ' [in] p_AppCode : Application Code
  1371. ' [in] p_Backend : Backend  
  1372. ' [in] p_Trial     : Trial
  1373. ' [out] lRetVal  : An MCSUBDATA_* error code
  1374. '
  1375. ' Returns:
  1376. ' 'True' if application information is found in the database.
  1377. ' 'False' if application information was not found in the database.
  1378. '
  1379. Function IsAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, ByRef lRetVal)
  1380. '{
  1381.     Dim subMgr
  1382.     Dim lPropRetVal
  1383.     Dim propBackend
  1384.     Dim propTrial
  1385.  
  1386.     IsAppPresent = False
  1387.  
  1388.     Set subMgr = new CSubMrg
  1389.     If subMgr is nothing Then
  1390.     '{
  1391.         lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1392.         Exit Function
  1393.     '}
  1394.     End if
  1395.  
  1396.     If "" = p_AppId Or "" = p_AppCode Then
  1397.     '{
  1398.         lRetVal = MCSUBDATA_INVALID_PARAMETER
  1399.         Exit Function
  1400.     '}
  1401.     End if
  1402.  
  1403.     lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
  1404.  
  1405.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1406.     '{
  1407.         '
  1408.         ' Negate lRetVal here since clients check for it first
  1409.         '
  1410.         lRetVal = MCSUBDATA_SUCCESS
  1411.         Exit Function
  1412.     '}
  1413.     End If
  1414.     
  1415.     propBackend = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_BACKEND_STR, lPropRetVal) 
  1416.     
  1417.     '
  1418.     ' Backend property not found or it does not match, return false
  1419.     '
  1420.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
  1421.     '{
  1422.         Exit Function
  1423.     '}
  1424.     End if
  1425.  
  1426.     If not "" = p_Backend Then
  1427.     '{
  1428.         If not p_Backend = propBackend Then
  1429.         '{
  1430.             Exit Function
  1431.         '}
  1432.         End if
  1433.     '}
  1434.     End if
  1435.  
  1436.     '
  1437.     ' Trial property not found or it does not match, return false
  1438.     '
  1439.     propTrial = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_TRIAL_STR, lPropRetVal) 
  1440.  
  1441.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
  1442.     '{
  1443.         Exit Function
  1444.     '}
  1445.     End if
  1446.  
  1447.     If not "" = p_Trial Then
  1448.     '{
  1449.         If not p_Trial = propTrial Then
  1450.         '{
  1451.             Exit Function
  1452.         '}
  1453.         End if
  1454.     '}
  1455.     End if
  1456.  
  1457.     IsAppPresent = True
  1458.  
  1459. '}
  1460. End Function
  1461.  
  1462.  
  1463. ''
  1464. ' Function IsPartnerAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, p_AffId, ByRef lRetVal)
  1465. ' Find whether the application identified by AppdId, 
  1466. ' AppCode and Backend has subscription information in the database.
  1467. '
  1468. ' Pararmeters:
  1469. ' [in] p_AppId   : The Application ID
  1470. ' [in] p_AppCode : Application Code
  1471. ' [in] p_Backend : Backend  
  1472. ' [in] p_Trial     : Trial
  1473. ' [in] p_AffId     : Affiliate ID
  1474. ' [out] lRetVal  : An MCSUBDATA_* error code
  1475. '
  1476. ' Returns:
  1477. ' 'True' if application information is found in the database.
  1478. ' 'False' if application information was not found in the database.
  1479. '
  1480. Function IsPartnerAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, p_AffId, ByRef lRetVal)
  1481. '{
  1482.     Dim subMgr
  1483.     Dim lPropRetVal
  1484.     Dim propBackend
  1485.     Dim propTrial
  1486.     Dim propAffId
  1487.  
  1488.     IsPartnerAppPresent = False
  1489.  
  1490.     Set subMgr = new CSubMrg
  1491.     If subMgr is nothing Then
  1492.     '{
  1493.         lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1494.         Exit Function
  1495.     '}
  1496.     End if
  1497.  
  1498.     If "" = p_AppId Or "" = p_AppCode Then
  1499.     '{
  1500.         lRetVal = MCSUBDATA_INVALID_PARAMETER
  1501.         Exit Function
  1502.     '}
  1503.     End if
  1504.  
  1505.     lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
  1506.  
  1507.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1508.     '{
  1509.         '
  1510.         ' Negate lRetVal here since clients check for it first
  1511.         '
  1512.         lRetVal = MCSUBDATA_SUCCESS
  1513.         Exit Function
  1514.     '}
  1515.     End If
  1516.     
  1517.     propBackend = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_BACKEND_STR, lPropRetVal) 
  1518.     
  1519.     '
  1520.     ' Backend property not found or it does not match, return false
  1521.     '
  1522.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
  1523.     '{
  1524.         Exit Function
  1525.     '}
  1526.     End if
  1527.  
  1528.     If not "" = p_Backend Then
  1529.     '{
  1530.         If not p_Backend = propBackend Then
  1531.         '{
  1532.             Exit Function
  1533.         '}
  1534.         End if
  1535.     '}
  1536.     End if
  1537.  
  1538.     '
  1539.     ' Trial property not found or it does not match, return false
  1540.     '
  1541.     propTrial = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_TRIAL_STR, lPropRetVal) 
  1542.  
  1543.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
  1544.     '{
  1545.         Exit Function
  1546.     '}
  1547.     End if
  1548.  
  1549.     If not "" = p_Trial Then
  1550.     '{
  1551.         If not p_Trial = propTrial Then
  1552.         '{
  1553.             Exit Function
  1554.         '}
  1555.         End if
  1556.     '}
  1557.     End if
  1558.  
  1559.     '
  1560.     ' AffId property not found or it does not match, return false
  1561.     '
  1562.     propAffId = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_AFFID_STR, lPropRetVal) 
  1563.  
  1564.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
  1565.     '{
  1566.         Exit Function
  1567.     '}
  1568.     End if
  1569.  
  1570.     If not "" = p_AffId Then
  1571.     '{
  1572.         If not p_AffId = propAffId Then
  1573.         '{
  1574.             Exit Function
  1575.         '}
  1576.         End if
  1577.     '}
  1578.     End if
  1579.  
  1580.     IsPartnerAppPresent = True
  1581.  
  1582. '}
  1583. End Function
  1584.  
  1585.  
  1586. ''
  1587. ' Function GetUserRegistered(p_Backend, p_AccntID)
  1588. ' Finds out if the subscription database has at least one user id associated with Backend.
  1589. '
  1590. ' Pararmeters:
  1591. ' [in] p_Backend : Backend  
  1592. ' [out] p_AccntID : The AccountID returned for that backend
  1593. '
  1594. ' Returns:
  1595. ' An MCSUBDATA_* error code
  1596. '
  1597. Function GetUserRegistered(p_Backend, ByRef p_AccntID)
  1598. '{
  1599.     Dim subMgr
  1600.     Dim bIsUserReg
  1601.  
  1602.     GetUserRegistered = False
  1603.  
  1604.     If "" = p_Backend Then
  1605.     '{
  1606.         GetUserRegistered = MCSUBDATA_INVALID_PARAMETER
  1607.         Exit Function
  1608.     '}
  1609.     End if
  1610.  
  1611.     Set subMgr = new CSubMrg
  1612.     If subMgr is nothing Then
  1613.     '{
  1614.         GetUserRegistered = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1615.         Exit Function
  1616.     '}
  1617.     End if
  1618.  
  1619.     GetUserRegistered = subMgr.SubManager.GetUserRegisteredForBackend(p_Backend, p_AccntID)
  1620. '}
  1621. End Function
  1622.  
  1623. ''
  1624. ' Function CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, p_AppInfo)
  1625. ' Write the subscription information for the application identified by AppId, AppCode into the subscription database. 
  1626. '
  1627. ' Pararmeters:
  1628. ' [in] p_AppId     : AppID
  1629. ' [in] p_AppCode : The App Code
  1630. ' [in] p_SubInfo : A CSubscriptionData instance, with relevant properties for Subscription info  set
  1631. ' [in] p_AppInfo : A CAppData instance, with relevant properties for Appinfo  set
  1632. '
  1633. ' Returns: An MCSUBDATA_* error code
  1634. '
  1635. Function CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, p_AppInfo)
  1636. '{
  1637.     Dim subMgr
  1638.     Dim lRetVal
  1639.     Dim listProp
  1640.     Dim iIdx
  1641.     Dim propValue
  1642.     
  1643.     If "" = p_AppId Or "" = p_AppCode Or p_SubInfo is nothing Then
  1644.     '{
  1645.         CreateNewApplication = MCSUBDATA_INVALID_PARAMETER
  1646.         Exit Function
  1647.     '}
  1648.     End If
  1649.  
  1650.     Set subMgr = new CSubMrg
  1651.     If subMgr is nothing Then
  1652.     '{
  1653.         CreateNewApplication = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1654.         Exit Function
  1655.     '}
  1656.     End if
  1657.  
  1658.     lRetVal = subMgr.CreateSubInfoObject(p_AppId, p_AppCode)
  1659.     
  1660.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1661.     '{
  1662.         CreateNewApplication = lRetVal
  1663.         Exit Function
  1664.     '}
  1665.     End If
  1666.     
  1667.     '
  1668.     ' Set all the properties and then commit. If some property has not been set, Commit will return
  1669.     ' an error. Escalate this to the client
  1670.     '
  1671.     listProp = p_SubInfo.Base.PropertyNameList
  1672.     
  1673.     If not IsArray(listProp) Then
  1674.     '{
  1675.         CreateNewApplication = MCSUBDATA_COULD_NOT_GET_PROP_LIST
  1676.         Exit Function
  1677.     '}
  1678.     End If
  1679.     
  1680.     For iIdx = LBound(listProp, 1) to UBound(listProp, 1) step 1
  1681.     '{
  1682.         If not "" = listProp(iIdx) Then
  1683.         '{
  1684.             propValue = p_SubInfo.Base.Property(listProp(iIdx))
  1685.             If not "" = propValue Then
  1686.             '{
  1687.                 lRetVal = subMgr.SubInfo.SetProperty(listProp(iIdx), propValue)
  1688.                 If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1689.                 '{
  1690.                     CreateNewApplication = lRetVal
  1691.                     Exit Function
  1692.                 '}
  1693.                 End If
  1694.             '}
  1695.             End If
  1696.         '}
  1697.         End If
  1698.     '}
  1699.     Next
  1700.     
  1701.     lRetVal = subMgr.SubInfo.Commit
  1702.     
  1703.     '
  1704.     ' Created the SubInfo object. Now create the Appinfo object.
  1705.     ' Only create it if we are successful adding subinfo data
  1706.     '
  1707.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1708.     '{
  1709.         CreateNewApplication = lRetVal
  1710.         Exit Function
  1711.     '}
  1712.     End If
  1713.      
  1714.     If not p_AppInfo is nothing Then
  1715.     '{
  1716.         lRetVal = subMgr.CreateAppInfoObject(p_AppId, p_AppCode)
  1717.     
  1718.         If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1719.         '{
  1720.             CreateNewApplication = lRetVal
  1721.             Exit Function
  1722.         '}
  1723.         End If
  1724.         
  1725.         listProp = p_AppInfo.Base.PropertyNameList
  1726.         
  1727.         If not IsArray(listProp) Then
  1728.         '{
  1729.             CreateNewApplication = MCSUBDATA_COULD_NOT_GET_PROP_LIST
  1730.             Exit Function
  1731.         '}
  1732.         End If
  1733.         
  1734.         For iIdx = LBound(listProp, 1) to UBound(listProp, 1) step 1
  1735.         '{
  1736.             If not "" = listProp(iIdx) Then
  1737.             '{
  1738.                 propValue = p_AppInfo.Base.Property(listProp(iIdx))
  1739.                 If not "" = propValue Then
  1740.                 '{
  1741.                     lRetVal = subMgr.AppInfo.SetProperty(listProp(iIdx), propValue)
  1742.                     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1743.                     '{
  1744.                         CreateNewApplication = lRetVal
  1745.                         Exit Function
  1746.                     '}
  1747.                     End If
  1748.                 '}
  1749.                 End If
  1750.             '}
  1751.             End If
  1752.         '}
  1753.         Next
  1754.         
  1755.         lRetVal = subMgr.AppInfo.Commit
  1756.     '}
  1757.     Else
  1758.     '{
  1759.         '
  1760.         ' If appInfo is nothing, we blindly remove the data
  1761.         '
  1762.         subMgr.SubManager.RemoveAppInfo(p_AppId)
  1763.         
  1764.     '}
  1765.     End If
  1766.     
  1767.     CreateNewApplication = lRetVal
  1768. '}
  1769. End Function
  1770.  
  1771. ''
  1772. ' Function AddSubInfo(p_AppId, p_AppCode, p_SubInfo, p_bForce)
  1773. ' Write the subscription information for the application identified by AppId, AppCode into the subscription database. 
  1774. '
  1775. ' Pararmeters:
  1776. ' [in] p_AppId     : AppID
  1777. ' [in] p_AppCode : The App Code
  1778. ' [in] p_SubInfo : A CSubscriptionData instance, with all parameters set
  1779. '
  1780. ' Returns: An MCSUBDATA_* error code
  1781. '
  1782. Function AddSubInfo(p_AppId, p_AppCode, p_SubInfo, p_bForce)
  1783. '{
  1784.     Dim subMgr
  1785.     Dim lRetVal
  1786.  
  1787.     If "" = p_AppId Or "" = p_AppCode Or p_SubInfo is nothing Then
  1788.     '{
  1789.         AddSubInfo = MCSUBDATA_INVALID_PARAMETER
  1790.         Exit Function
  1791.     '}
  1792.     End If
  1793.  
  1794.     Set subMgr = new CSubMrg
  1795.     If subMgr is nothing Then
  1796.     '{
  1797.         AddSubInfo = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1798.         Exit Function
  1799.     '}
  1800.     End if
  1801.  
  1802.     If False = p_bForce Then
  1803.     '{
  1804.         If True = subMgr.SubManager.IsOldAppInstalled(p_AppId, lRetVal) Then
  1805.         '{
  1806.             AddSubInfo = lRetVal
  1807.             Exit Function
  1808.         '}
  1809.         Else
  1810.         '{
  1811.             
  1812.             ' Sameer (11/10/2003): If Force = False then we have to check the 
  1813.             ' subscription database to see if there is data for AppId. We should not
  1814.             ' check for the combination of AppId, AppCode. Hence we should pass AppCode
  1815.             ' as "" so that MCSUBMGR will return information if there is any data for AppId.
  1816.  
  1817.             lRetVal = subMgr.GetSubInfoObject(p_AppId, "")
  1818.             If MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1819.             '{
  1820.                 AddSubInfo = lRetVal
  1821.                 Exit Function
  1822.             '}
  1823.             End If
  1824.         '}
  1825.         End If
  1826.     '}
  1827.     End If
  1828.     
  1829.     AddSubInfo = CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, nothing)
  1830. '}
  1831. End Function
  1832.  
  1833. ''
  1834. ' Function AddSubInfoEx(p_AppId, p_AppCode, p_SubInfo, p_AppInfo, p_bForce)
  1835. ' Write the subscription information for the application identified by AppId, AppCode into the subscription database. 
  1836. '
  1837. ' Pararmeters:
  1838. ' [in] p_AppId     : AppID
  1839. ' [in] p_AppCode : The App Code
  1840. ' [in] p_SubInfo : A CSubscriptionData instance, with all parameters set
  1841. ' [in] p_AppInfo : Application Info object
  1842. '
  1843. ' Returns: An MCSUBDATA_* error code
  1844. '
  1845. ' Sameer(07/09/2004): This was added as a separate function so that the caller has the option to pass in
  1846. ' the application info object. This will be used ONLY IFF p_bForce = True. As can be seen in the flow below
  1847. ' if p_bForce = False then the application info object is not used.
  1848. ' A used case scenario is for DELL registrations where there is an existing appinfo section with "no_die = 1".
  1849. ' For a subsequent registration AddSubInfoEx is called with p_bForce = TRUE and the existing appinfo object. That
  1850. ' we preserve the no_die flag for subsequent registrations also.
  1851.  
  1852. '
  1853. Function AddSubInfoEx(p_AppId, p_AppCode, p_SubInfo, p_AppInfo, p_bForce)
  1854. '{
  1855.     Dim subMgr
  1856.     Dim lRetVal
  1857.  
  1858.     If "" = p_AppId Or "" = p_AppCode Or p_SubInfo is nothing Then
  1859.     '{
  1860.         AddSubInfoEx = MCSUBDATA_INVALID_PARAMETER
  1861.         Exit Function
  1862.     '}
  1863.     End If
  1864.  
  1865.     Set subMgr = new CSubMrg
  1866.     If subMgr is nothing Then
  1867.     '{
  1868.         AddSubInfoEx = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1869.         Exit Function
  1870.     '}
  1871.     End if
  1872.  
  1873.     If False = p_bForce Then
  1874.     '{
  1875.         If True = subMgr.SubManager.IsOldAppInstalled(p_AppId, lRetVal) Then
  1876.         '{
  1877.             AddSubInfoEx = lRetVal
  1878.             Exit Function
  1879.         '}
  1880.         Else
  1881.         '{
  1882.             
  1883.             ' Sameer (11/10/2003): If Force = False then we have to check the 
  1884.             ' subscription database to see if there is data for AppId. We should not
  1885.             ' check for the combination of AppId, AppCode. Hence we should pass AppCode
  1886.             ' as "" so that MCSUBMGR will return information if there is any data for AppId.
  1887.  
  1888.             lRetVal = subMgr.GetSubInfoObject(p_AppId, "")
  1889.             If MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1890.             '{
  1891.                 AddSubInfoEx = lRetVal
  1892.                 Exit Function
  1893.             '}
  1894.             End If
  1895.         '}
  1896.         End If
  1897.     '}
  1898.     End If
  1899.     
  1900.     AddSubInfoEx = CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, p_AppInfo)
  1901. '}
  1902. End Function
  1903.  
  1904. ''
  1905. ' Function H_GetSubInfo(p_eType, p_AppId, p_AppCode, lRetVal)
  1906. ' Get the subscription information identified by AppId and AppCode from the database. 
  1907. '
  1908. ' Pararmeters:
  1909. ' [in] p_eType     : Type of info get. See MCSUBINFO_ENUM_INFOTYPE*
  1910. ' [in] p_AppId     : AppID
  1911. ' [in] p_AppCode : The App Code
  1912. ' [out] p_obj      : A CSubscriptionData/CAppData object with all known properties set.
  1913. '                      All unused properties are ""
  1914. '
  1915. ' Returns: A MCSUBDATA_* error code
  1916. Function H_GetSubInfo(p_eType, p_AppId, p_AppCode, ByRef p_obj)
  1917. '{
  1918.     Dim subMgr
  1919.     Dim iIdx
  1920.     Dim listProp
  1921.     Dim objSubInfo
  1922.     Dim maxPropCount
  1923.     Dim lRetVal
  1924.     
  1925.     Set p_obj = nothing
  1926.     maxPropCount = 0
  1927.     lRetVal = MCSUBDATA_SUCCESS
  1928.  
  1929.     If "" = p_AppId Then
  1930.     '{
  1931.         H_GetSubInfo = MCSUBDATA_INVALID_PARAMETER
  1932.         Exit Function
  1933.     '}
  1934.     End If
  1935.  
  1936.     Set subMgr = new CSubMrg
  1937.     If subMgr is nothing Then
  1938.     '{
  1939.         H_GetSubInfo = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1940.         Exit Function
  1941.     '}
  1942.     End if
  1943.     
  1944.     select case p_eType
  1945.     '{
  1946.         case MCSUBINFO_ENUM_INFOTYPE_SUBDATA
  1947.             lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
  1948.             
  1949.         case MCSUBINFO_ENUM_INFOTYPE_APPDATA
  1950.             lRetVal = subMgr.GetAppInfoObject(p_AppId)
  1951.             
  1952.         case Else
  1953.             lRetVal = MCSUBDATA_INVALID_PARAMETER
  1954.     '}
  1955.     End select
  1956.  
  1957.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1958.     '{
  1959.         H_GetSubInfo = lRetVal
  1960.         Exit Function
  1961.     '}
  1962.     End If
  1963.     
  1964.     select case p_eType
  1965.     '{
  1966.         case MCSUBINFO_ENUM_INFOTYPE_SUBDATA
  1967.             lRetVal = subMgr.SubInfo.GetAllProperties(listProp)
  1968.             Set objSubInfo = new CSubscriptionData
  1969.             If objSubInfo is nothing Then
  1970.             '{
  1971.                 lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1972.             '}
  1973.             End If
  1974.             maxPropCount = MCSUBINFO_TOTAL_KNOWN_SUBDATA_PROP_COUNT
  1975.                     
  1976.         case MCSUBINFO_ENUM_INFOTYPE_APPDATA
  1977.             lRetVal = subMgr.AppInfo.GetAllProperties(listProp)
  1978.             Set objSubInfo = new CAppData
  1979.             If objSubInfo is nothing Then
  1980.             '{
  1981.                 lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
  1982.             '}
  1983.             End If
  1984.             maxPropCount = MCSUBINFO_TOTAL_KNOWN_APPDATA_PROP_COUNT
  1985.             
  1986.         case Else
  1987.             lRetVal = MCSUBDATA_INVALID_PARAMETER
  1988.     '}
  1989.     End select
  1990.     
  1991.     If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
  1992.     '{
  1993.         H_GetSubInfo = lRetVal
  1994.         Exit Function
  1995.     '}
  1996.     End If 
  1997.     
  1998.     '
  1999.     ' First make sure you allocate enough extra space
  2000.     '
  2001.     If (maxPropCount - UBound(listProp, 1)) < 0 Then
  2002.     '{
  2003.         objSubInfo.Base.PropertyCount = UBound(listProp, 1) - maxPropCount
  2004.     '}
  2005.     End If
  2006.     
  2007.     For iIdx = LBound(listProp, 1) to UBound(listProp, 1) Step 1
  2008.     '{
  2009.         objSubInfo.Base.Property(listProp(iIdx, 0)) = listProp(iIdx, 1)
  2010.     '}
  2011.     Next
  2012.     
  2013.     Set p_obj = objSubInfo
  2014.     
  2015.     H_GetSubInfo = lRetVal
  2016. '}
  2017. End Function
  2018.  
  2019.  
  2020. ''
  2021. ' Function GetSubInfo(p_AppId, p_AppCode, lRetVal)
  2022. ' Get the subscription information identified by AppId and AppCode from the database. 
  2023. '
  2024. ' Pararmeters:
  2025. ' [in] p_AppId     : AppID
  2026. ' [in] p_AppCode : The App Code
  2027. ' [out] p_obj      : A CSubscriptionData object with all known properties set.
  2028. '                      All unused properties are ""
  2029. '
  2030. ' Returns: A MCSUBDATA_* error code
  2031. Function GetSubInfo(p_AppId, p_AppCode, ByRef p_obj)
  2032. '{
  2033.     GetSubInfo = H_GetSubInfo(MCSUBINFO_ENUM_INFOTYPE_SUBDATA, p_AppId, p_AppCode, p_obj)
  2034. '}
  2035. End Function
  2036.  
  2037. ''
  2038. ' Function GetAppInfo(p_AppId, p_AppCode, lRetVal)
  2039. ' Get the subscription information identified by AppId and AppCode from the database. 
  2040. '
  2041. ' Pararmeters:
  2042. ' [in] p_AppId     : AppID
  2043. ' [in] p_AppCode : The App Code
  2044. ' [out] p_obj      : A CAppData object with all known properties set.
  2045. '                      All unused properties are ""
  2046. '
  2047. ' Returns: A MCSUBDATA_* error code
  2048. Function GetAppInfo(p_AppId, p_AppCode, ByRef p_obj)
  2049. '{
  2050.     GetAppInfo = H_GetSubInfo(MCSUBINFO_ENUM_INFOTYPE_APPDATA, p_AppId, p_AppCode, p_obj)
  2051. '}
  2052. End Function
  2053.  
  2054.  
  2055. Function Main()
  2056. '{
  2057.     Dim objSubInfo
  2058.     Dim objAppInfo
  2059.     Dim lRetVal
  2060.     
  2061.     Set objSubInfo = new CSubscriptionData
  2062.     Set objAppInfo = new CAppData
  2063.     
  2064.     objSubInfo.AccountId = "2324235"
  2065.     objSubInfo.ExpiryDate = "20021212"
  2066.     objSubInfo.SyncUrl = "http://www.mcafee.com"
  2067.     objSubInfo.WebSite = "http://www.mcafee.com"
  2068.     objSubInfo.Backend = "aol"
  2069.     objSubInfo.affId = "345"
  2070.     objSubInfo.DBVersion = "1.0"
  2071.     
  2072.     objAppInfo.No_Die = "1"
  2073.             
  2074.     lRetVal = CreateNewApplication("VSO", "VSH8", objSubInfo, objAppInfo)
  2075.     
  2076.     If not MCSUBDATA_SUCCESS = lRetVal Then
  2077.     '{
  2078.         MsgBox "CreateNewApplication failed. ErrorCode: " & lRetVal
  2079.         Exit Function
  2080.     '}
  2081.     End If
  2082.     
  2083.     objSubInfo.AccountId = "12345"
  2084.     
  2085.     lRetVal = AddSubInfo("VSO", "VSH8", objSubInfo, True)
  2086.     
  2087.     If not MCSUBDATA_SUCCESS = lRetVal Then
  2088.     '{
  2089.         MsgBox "AddSubInfo for VSO failed. ErrorCode: " & lRetVal
  2090.         Exit Function
  2091.     '}
  2092.     End If
  2093.     
  2094.     objSubInfo.AccountId = "12345"
  2095.     
  2096.     lRetVal = AddSubInfo("MPF", "MPF2", objSubInfo, False)
  2097.     
  2098.     If not MCSUBDATA_SUCCESS = lRetVal Then
  2099.     '{
  2100.         MsgBox "AddSubInfo for MPF failed. ErrorCode: " & lRetVal
  2101.         Exit Function
  2102.     '}
  2103.     End If
  2104.     
  2105.     objSubInfo.AccountId = "9999999"
  2106.     
  2107.     lRetVal = AddSubInfo("MPS", "MPS2", objSubInfo, False)
  2108.     
  2109.     If not MCSUBDATA_SUCCESS = lRetVal Then
  2110.     '{
  2111.         MsgBox "AddSubInfo for MPS failed. ErrorCode: " & lRetVal
  2112.         Exit Function
  2113.     '}
  2114.     End If
  2115.     
  2116.     'MsgBox "IsAppActivated(appid, appcode, backend) = " & IsAppActivated("MP S", "", "aol", lRetVal) & ", " & lRetVal
  2117.     
  2118.     'MsgBox "IsPartnerAppActivated(appid, appcode, backend, affid) = " & IsPartnerAppActivated("MPS", "MPS2", "aol", "345", lRetVal) & ", " & lRetVal
  2119.     
  2120.     'MsgBox "IsAppPresent(p_AppId, p_AppCode, p_Backend) = " & IsAppPresent("MPS", "MPS", "aol", lRetVal) & ", " & lRetVal
  2121.     
  2122.     Dim accntID
  2123.     accntID = "2323"
  2124.     'MsgBox "IsUserRegistered(p_Backend, p_AccntID) = " & GetUserRegistered("aol", accntID, lRetVal) & ", " & accntID & ", " & lRetVal
  2125.     
  2126.     Dim retSubInfo
  2127.     
  2128.     lRetVal = GetSubInfo("VSO", "", retSubInfo)
  2129.     
  2130.     If retSubInfo is nothing Then
  2131.     '{
  2132.         MsgBox "Could not get subinfo. RetVal = " & lRetVal
  2133.     '}
  2134.     Else
  2135.     '{
  2136.         Dim listProp, idx
  2137.         Dim props, prop
  2138.         listProp = retSubInfo.Base.PropertyNameList
  2139.         props = ""
  2140.         for idx = LBound(listProp, 1) to UBound(listProp, 1)
  2141.         '{
  2142.             prop = retSubInfo.Base.Property(listProp(idx))
  2143.             If not "" = prop Then
  2144.             '{
  2145.                 props = props & listProp(idx) & " = " & prop & Chr(10)
  2146.             '}
  2147.             End If
  2148.         '}
  2149.         Next
  2150.         
  2151.         MsgBox props
  2152.         
  2153.     '}
  2154.     End If
  2155. '}
  2156. End Function
  2157.