home *** CD-ROM | disk | FTP | other *** search
Text File | 2005-07-13 | 52.3 KB | 2,199 lines |
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' File: SubInfoData.cpp
- ' Author: Parag Dixit
- '
- ' Provides script API's for operations on the subscription database
- '
- '''
- ' IMPORTANT NOTE: You must call the function below before using any API's or objects in this class
- '''
- ' Function InitScriptAPI(p_objSubMgr)
- '
- ' Purpose: Initialize script API's
- '
- ' Pararmeters:
- ' [in] p_objSubMgr: Sub manager object created using object tag with license key
- '
- ' Returns:
- ' VOID
- '
- ''
- ' Function DeinitScriptAPI()
- '
- ' Purpose: Un Initialize script API's
- '
- ' Pararmeters:
- '
- ' Returns:
- ' VOID
- '
- '
- '
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Classes
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' CSUBSCRIPTIONDATA
- '
- ' This class holds all the subscription data.
- '
- ' CSubscriptionData Properties...
- '
- ' Name: AppId
- ' Type: string
- ' Semantics: This is an identifier that defines the application category.
- ' Example: VSO, MPF, MPS etc.
- '
- ' Name: AppCode
- ' Type: string
- ' Semantics: This is the application code. For perpetual versions, the application code will
- ' vary from version to version. For online versions, the application
- ' code and the appid are the same.
- ' Example: VSH8 (Home Edition, v8.0), VSP9 (Pro Edition, v9.0)
- '
- ' Name: AccountId
- ' Type: string
- ' Semantics: The user account identifier.
- ' Example: 701456
- '
- ' Name: Perpetual
- ' Type: long
- ' Semantics: Part of the subscription type. If this attribute is 1, then its a perpetual version.
- ' If value is 0, then its a subscription. The default value is 0.
- '
- ' Name: Trial
- ' Type: long
- ' Semantics: Part of the subscription type. If this attribute is 1, then its a trial version.
- ' If value is 0, then its a paid version. The default value is 0.
- '
- ' Name: ExpiryDate
- ' Type: string
- ' Semantics: Online version will stop running and user will not get any updates after this date.
- ' User will get all the updates/upgrades as long as the subscription is not expired.
- ' Perpetual versions will continue to run even after this date, but will not get any
- ' Content updates (DAT files, Spam filters, etc). Also user will only get Content update and
- ' bug fixes before the expiry of this date. Format of the expiry date is yyyymmdd
- ' Example: 20030508
- '
- ' Name: SyncUrl
- ' Type: string
- ' Semantics: The full path to the Url that will be used to periodically synchronize the user's
- ' subscription information on the computer with the backend.
- ' This should be same for all the apps for the give Backend for performance reasons.
- ' Example: http://us.mcafee.com/apps/vso/en-us/vso5/syncapp.asp
- '
- ' Name: Website
- ' Type: string
- ' Semantics: The domain name of the website with which this application is connected.
- ' Example: Fr.mcafee.com,Us.mcafee.com, etc.
- '
- ' Name: Backend
- ' Type: string
- ' Semantics: The Web services database identifier
- ' Example: McAf_Ebizsol,AOL, etc.
- '
- ' Name: AffId
- ' Type: string
- ' Semantics: Web services identify a package by the affiliate Id.
- ' For e.g. the affiliate Id may be used to describe a DELL VSO 90 day trial.
- ' Example: 111-22
- '
- ' Name: Lang
- ' Type: string
- ' Semantics: The language of the application
- ' Example: en-us
- '
- ''
- ' CSubscriptionData Example Usage
- '---------------------------------
- ' Dim objSubInfo
- ' Set objSubInfo = new CSubscriptionData
- ' objSubInfo.AccountID = "3434"
- ' etc...
- '
- '
- ''''''''''''''''''''''''''''''''
- ' CAPPDATA
- '
- ' This class has all application specific data
- '
- ' CAppData Properties...
- '
- ' Name: No_Die
- ' Type: string
- ' Semantics: This is application specific information. This flag specifies if product is no_die (no_die = 1)
- '
- '
- ' CAppData Example Usage
- '---------------------------------
- ' Dim objAppInfo
- ' Set objAppInfo = new CAppData
- ' objSubInfo.No_Die = "1"
- ' etc...
- '
- '''''''''''''''''''''''''''''''
- ' CBACKWARDCOMPATIBILITYSUBINFO
- '
- ' This class is a wrapper for functions that extact information for 'older' applications that store their information in the registry
- '
- ' CBackwardCompatibilitySubInfo methods...
- '
- ' Public Function GetExpiryDate(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To get the application expiry date for legacy applications
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' The application expiry date
- ''
- ' Public Function GetAccountId(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To get account ID for legacy applications
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' The application specific account ID
- ''
- ' Public Function GetSubType(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To get the subtype for legacy applications
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' The application sub-type
- ''
- ' Public Function GetExpiryDays(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To get the number of days for the application to expire
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' The number of days to expire
- ''
- ' Public Function GetAppCode(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To get the application code if present
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' The application code
- ''
- ' Public Function IsAppExpired(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To determine if the app is expired
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if app is expired, 'False' if not.
- ''
- ' Public Function IsPerpetual(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To determine if the app is a perpetual version
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if app is perpetual, 'False' if not.
- ''
- ' Public Function IsTrial(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To determine if the app is a trial version
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if app is a trial version, 'False' if not.
- ''
- ' Public Function IsNoDie(p_AppId, ByRef p_lRetVal)
- '
- ' Purpose: To determine if the app has the no-die flag set
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [out] p_lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if app has no-die flag set, 'False' if not.
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' API Functions
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- '
- ''
- ' Function IsAppActivated(p_AppId, p_AppCode, p_Backend, ByRef lRetVal)
- '
- ' Purpose: To find out whether the application identified by AppdId, AppCode and Backend
- ' has been activated on the backend. An application is assumed to be
- ' activated only if there is an entry in the subscription database identified by
- ' the AppId, AppCode, Backend and the entry contains the mandatory
- ' information like expiry_date, sub_type, accnt_id.
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [in] p_AppCode : Application Code
- ' [in] p_Backend : Backend
- ' [out] lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if application information is found in the database.
- ' 'False' if application information was not found in the database.
- '
- ''
- ' Function IsPartnerAppActivated(p_AppId, p_AppCode, p_Backend, p_AffID, ByRef lRetVal)
- '
- ' Find whether the application identified by AppdId,
- ' AppCode, AffID and Backend has subscription information in the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [in] p_AppCode : Application Code
- ' [in] p_Backend : Backend
- ' [in] p_AffID : The Affiliate ID
- ' [out] lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if application information is found in the database.
- ' 'False' if application information was not found in the database.
- '
- ''
- ' Function IsAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, ByRef lRetVal)
- '
- ' Find whether the application identified by AppdId,
- ' AppCode and Backend has subscription information in the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [in] p_AppCode : Application Code
- ' [in] p_Backend : Backend
- ' [in] p_Trial : Trial
- ' [out] lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if application information is found in the database.
- ' 'False' if application information was not found in the database.
- '
- ''
- ' Function IsPartnerAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, p_AffId, ByRef lRetVal)
- '
- ' Find whether the application identified by AppdId,
- ' AppCode and Backend has subscription information in the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [in] p_AppCode : Application Code
- ' [in] p_Backend : Backend
- ' [in] p_Trial : Trial
- ' [in] p_AffId : Affiliate ID
- ' [out] lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if application information is found in the database.
- ' 'False' if application information was not found in the database.
- '
- ''
- ' Function GetUserRegistered(p_Backend, p_AccntID)
- '
- ' Finds out if the subscription database has at least one user id associated with Backend.
- '
- ' Pararmeters:
- ' [in] p_Backend : Backend
- ' [out] p_AccntID : The AccountID returned for that backend
- '
- ' Returns:
- ' An MCSUBDATA_* error code
- '
- ''
- ' Function CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, p_AppInfo)
- '
- ' Write the subscription information for the application identified by AppId, AppCode into the subscription database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [in] p_SubInfo : A CSubscriptionData instance, with relevant properties for Subscription info set
- ' [in] p_AppInfo : A CAppData instance, with relevant properties for Appinfo set
- '
- ' Returns: An MCSUBDATA_* error code
- '
- ''
- ' Function AddSubInfo(p_AppId, p_AppCode, p_SubInfo, p_bForce)
- '
- ' Write the subscription information for the application identified by AppId, AppCode into the subscription database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [in] p_SubInfo : A CSubscriptionData instance, with all parameters set
- '
- ' Returns: An MCSUBDATA_* error code
- '
- ''
- ' Function AddSubInfoEx(p_AppId, p_AppCode, p_SubInfo, p_AppInfo, p_bForce)
- '
- ' Write the subscription information for the application identified by AppId, AppCode into the subscription database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [in] p_SubInfo : A CSubscriptionData instance, with all parameters set
- ' [in] p_AppInfo : Application Info object
- '
- ' Returns: An MCSUBDATA_* error code
-
- ' Sameer(07/09/2004): This was added as a separate function so that the caller has the option to pass in
- ' the application info object. This will be used ONLY IFF p_bForce = True. As can be seen in the flow below
- ' if p_bForce = False then the application info object is not used.
- ' A used case scenario is for DELL registrations where there is an existing appinfo section with "no_die = 1".
- ' For a subsequent registration AddSubInfoEx is called with p_bForce = TRUE and the existing appinfo object. That
- ' we preserve the no_die flag for subsequent registrations also.
-
- '
- ''
- ' Function GetSubInfo(p_AppId, p_AppCode, lRetVal)
- '
- ' Get the subscription information identified by AppId and AppCode from the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [out] p_obj : A CSubscriptionData object with all known properties set.
- ' All unused properties are ""
- '
- ' Returns: A MCSUBDATA_* error code
- '
- ''
- ' Function GetAppInfo(p_AppId, p_AppCode, lRetVal)
- '
- ' Get the subscription information identified by AppId and AppCode from the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [out] p_obj : A CAppData object with all known properties set.
- ' All unused properties are ""
- '
- ' Returns: A MCSUBDATA_* error code
- '
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-
- option explicit
-
-
- ''
- ' Globals
- ''
- Dim g_obj_6704E42E_E5F6_Manager
-
- ''
- ' Constants
- ''
- '
- ' These come from the object
- '
- Const MCSUBDATA_CURRENT_VERSION = "0.21"
-
- Const MCSUBDATA_MCSUBOBJRET_SUCCESS = 7000
- Const MCSUBDATA_MCSUBOBJRET_OUTOFMEMORY = 14 'ERROR_OUTOFMEMORY
- Const MCSUBDATA_MCSUBOBJRET_NOINTERFACE = 2147500034 'E_NOINTERFACE
- Const MCSUBDATA_MCSUBOBJRET_INVALIDARG = 2147483651 'E_INVALIDARG
- Const MCSUBDATA_MCSUBOBJRET_ERROR = 7004
- Const MCSUBDATA_MCSUBOBJRET_READONLYPROPERTY = 7005
- Const MCSUBDATA_MCSUBOBJRET_SUBDB_NOTFOUND = 7006
- Const MCSUBDATA_MCSUBOBJRET_XMLCOMP_NOTFOUND = 7007
- Const MCSUBDATA_MCSUBOBJRET_DB_LOADFAILED = 7008
- Const MCSUBDATA_MCSUBOBJRET_DB_CHECKSUMFAILED = 7009
- Const MCSUBDATA_MCSUBOBJRET_DB_CREATEFAILED = 7010
- Const MCSUBDATA_MCSUBOBJRET_DB_ELEMENT_NOTFOUND = 7011
- Const MCSUBDATA_MCSUBOBJRET_APPREG_FAILED = 7012
- Const MCSUBDATA_MCSUBOBJRET_DATAENCRYPTION_FAILED = 7013
- Const MCSUBDATA_MCSUBOBJRET_CREATE_ELEM_FAILED = 7014
- Const MCSUBDATA_MCSUBOBJRET_BACKENDREG_FAILED = 7015
- Const MCSUBDATA_MCSUBOBJRET_SUBDBPATH_NOTFOUND = 7016
- Const MCSUBDATA_MCSUBOBJRET_SAVE_FAILED = 7017
- Const MCSUBDATA_MCSUBOBJRET_MANDATORYPROP_UNDEFINED = 7018
- Const MCSUBDATA_MCSUBOBJRET_INVALIDSUBINFO_VER = 7019
- Const MCSUBDATA_MCSUBOBJRET_INVALID_APPSUBINFO = 7020
- Const MCSUBDATA_MCSUBOBJRET_PROP_MISMATCH = 7021
- Const MCSUBDATA_MCSUBOBJRET_INVALID_PROPNAME = 7022
- Const MCSUBDATA_MCSUBOBJRET_CREATEDIR_FAILED = 7023
- Const MCSUBDATA_MCSUBOBJRET_EXCLUSIVEDBACCESS_FAILED = 7024
- Const MCSUBDATA_MCSUBOBJRET_NO_PROPERTIES_SET = 7025
- Const MCSUBDATA_MCSUBOBJRET_DATADECRYPTION_FAILED = 7026
- Const MCSUBDATA_MCSUBOBJRET_NOAPPS_REGISTERED = 7027
- Const MCSUBDATA_MCSUBOBJRET_DB_REMOVEELEM_FAILED = 7028
- Const MCSUBDATA_MCSUBOBJRET_APP_NOT_REGISTERED = 7029
- Const MCSUBDATA_MCSUBOBJRET_PROP_INVALIDDATA = 7030
- Const MCSUBDATA_MCSUBOBJRET_DB_CORRUPT = 1392 'ERROR_FILE_CORRUPT
-
-
- '
- ' These are used internally in the scripts
- '
- Dim MCSUBDATA_SUCCESS
- MCSUBDATA_SUCCESS = MCSUBDATA_MCSUBOBJRET_SUCCESS
- Const MCSUBDATA_INVALID_PARAMETER = 87 'ERROR_INVALID_PARAMETER
- Const MCSUBDATA_COULD_NOT_CREATE_OBJECT = 2
- Const MCSUBDATA_COULD_NOT_GET_PROP_LIST = 3
-
-
- ''
- ' Some well known Property names (these are known by the object)
- ''
- Const MCSUBINFO_PROP_APPID_STR = "appid"
- Const MCSUBINFO_PROP_APPCODE_STR = "app_code"
- Const MCSUBINFO_PROP_ACCNTID_STR = "accnt_id"
- Const MCSUBINFO_PROP_EXPIRYDATE_STR = "settings"
- Const MCSUBINFO_PROP_BACKEND_STR = "backend"
- Const MCSUBINFO_PROP_SUBINFOVER_STR = "subinfo_ver"
- Const MCSUBINFO_PROP_SUBCHECKURL_STR = "sync_url"
- ''
- ' Property values known by the script
- ''
- Const MCSUBINFO_PROP_WEBSITE_STR = "website"
- Const MCSUBINFO_PROP_AFFID_STR = "affid"
- Const MCSUBINFO_PROP_PERPETUAL_STR = "perpetual"
- Const MCSUBINFO_PROP_TRIAL_STR = "trial"
- Const MCSUBINFO_PROP_LANG_STR = "applang"
-
- Const MCSUBINFO_TOTAL_KNOWN_SUBDATA_PROP_COUNT = 12
-
- ''
- ' App Data property names:
- ''
- Const MCSUBINFO_PROP_NODIE_STR = "no_die"
-
- Const MCSUBINFO_TOTAL_KNOWN_APPDATA_PROP_COUNT = 1
-
- ''
- ' Enums
- ''
- Const MCSUBINFO_ENUM_INFOTYPE_SUBDATA = 1
- Const MCSUBINFO_ENUM_INFOTYPE_APPDATA = 2
-
- ''
- ' CData is the base class with all the property handling logic
- ''
- Class CData
- '{
- Private m_prop
- Private m_cntProp
-
- Public Property Get PropertyCount()
- '{
- PropertyCount = m_cntProp
- '}
- End Property
-
- Public Property Let PropertyCount(cnt)
- '{
- Dim iIdx
- Dim iNewPropCnt
-
- iNewPropCnt = m_cntProp + cnt
- ReDim Preserve m_prop(1, iNewPropCnt)
-
- For iIdx = m_cntProp to iNewPropCnt Step 1
- '{
- m_prop(0, iIdx) = ""
- m_prop(1, iIdx) = ""
- '}
- Next
-
- m_cntProp = iNewPropCnt
- '}
- End Property
-
- Public Property Get Property(propName)
- '{
- Dim iIdx
-
- For iIdx = LBound(m_prop, 2) to UBound(m_prop, 2) Step 1
- '{
- If propName = m_prop(0, iIdx) Then
- '{
- Property = m_prop(1, iIdx)
- Exit Property
- '}
- End If
- '}
- Next
-
- Property = CStr("")
- '}
- End Property
-
- Public Property Let Property(propName, propValue)
- '{
- Dim iIdx
-
- ''
- ' First Try to Find propName.
- ' If not found, then create a new property in the last empty slot
- ''
- For iIdx = LBound(m_prop, 2) to UBound(m_prop, 2) Step 1
- '{
- If propName = m_prop(0, iIdx) Then
- '{
- m_prop(1, iIdx) = propValue
- Exit Property
- '}
- End If
- '}
- Next
-
- For iIdx = LBound(m_prop, 2) to UBound(m_prop, 2) Step 1
- '{
- If "" = m_prop(0, iIdx) Then
- '{
- m_prop(0, iIdx) = propName
- m_prop(1, iIdx) = propValue
- Exit Property
- '}
- End If
- '}
- Next
- '}
- End Property
-
- Public Property Get PropertyNameList()
- '{
- Dim iIdx
- Dim listProp()
- Dim listCnt
-
- listCnt = 0
-
- For iIdx = LBound(m_prop, 2) to UBound(m_prop, 2) Step 1
- '{
- If not "" = m_prop(0, iIdx) Then
- '{
- listCnt = listCnt + 1
- ReDim Preserve listProp(listCnt)
- listProp(listCnt - 1) = m_prop(0, iIdx)
- '}
- End If
- '}
- Next
-
- PropertyNameList = listProp
- '}
- End Property
-
- Private Sub Class_Initialize
- '{
- m_cntProp = 0
- m_prop = Array()
- ReDim m_prop(1, m_cntProp)
- '}
- End Sub
-
- Private Sub Class_Terminate
- '{
- ReDim m_prop(1)
- '}
- End Sub
- '}
- End Class
-
- ''
- ' CAppData 'inherits' from CData and is used for the AppData information (eg NO_DIE flag)
- ''
- Class CAppData
- '{
- Private m_objBaseCls
-
- Public Property Get No_Die()
- '{
- No_Die = Base.Property(MCSUBINFO_PROP_NODIE_STR)
- '}
- End Property
-
- Public Property Let No_Die(flag)
- '{
- Base.Property(MCSUBINFO_PROP_NODIE_STR) = flag
- '}
- End Property
-
- Public Property Get Base()
- '{
- Set Base = m_objBaseCls
- '}
- End Property
-
- Private Sub Class_Initialize
- '{
- Set m_objBaseCls = new CData
-
- If not m_objBaseCls is nothing Then
- '{
- m_objBaseCls.PropertyCount = MCSUBINFO_TOTAL_KNOWN_APPDATA_PROP_COUNT
- m_objBaseCls.Property(MCSUBINFO_PROP_NODIE_STR) = ""
- '}
- End If
- '}
- End Sub
-
- Private Sub Class_Terminate
- '{
- If not m_objBaseCls is nothing Then
- '{
- Set m_objBaseCls = nothing
- '}
- End If
- '}
- End Sub
- '}
- End Class
-
- ''
- ' CSubscriptionData 'inherits' from CData and holds all the subscription info data
- ''
- Class CSubscriptionData
- '{
- Private m_objBaseCls
-
- Public Property Get AppId()
- '{
- AppId = Base.Property(MCSUBINFO_PROP_APPID_STR)
- '}
- End Property
-
- Public Property Let AppId(AId)
- '{
- Base.Property(MCSUBINFO_PROP_APPID_STR) = AId
- '}
- End Property
-
- Public Property Get AppCode()
- '{
- AppCode = Base.Property(MCSUBINFO_PROP_APPCODE_STR)
- '}
- End Property
-
- Public Property Let AppCode(Acode)
- '{
- Base.Property(MCSUBINFO_PROP_APPCODE_STR) = Acode
- '}
- End Property
-
- Public Property Get AccountId()
- '{
- AccountId = Base.Property(MCSUBINFO_PROP_ACCNTID_STR)
- '}
- End Property
-
- Public Property Let AccountId(AccntId)
- '{
- Base.Property(MCSUBINFO_PROP_ACCNTID_STR) = AccntId
- '}
- End Property
-
- Public Property Get Perpetual()
- '{
- Perpetual = Base.Property(MCSUBINFO_PROP_PERPETUAL_STR)
- '}
- End Property
-
- Public Property Let Perpetual(sT)
- '{
- Base.Property(MCSUBINFO_PROP_PERPETUAL_STR) = sT
- '}
- End Property
-
- Public Property Get Trial()
- '{
- Trial = Base.Property(MCSUBINFO_PROP_TRIAL_STR)
- '}
- End Property
-
- Public Property Let Trial(sT)
- '{
- Base.Property(MCSUBINFO_PROP_TRIAL_STR) = sT
- '}
- End Property
-
- Public Property Get ExpiryDate()
- '{
- ExpiryDate = Base.Property(MCSUBINFO_PROP_EXPIRYDATE_STR)
- '}
- End Property
-
- Public Property Let ExpiryDate(expDate)
- '{
- Base.Property(MCSUBINFO_PROP_EXPIRYDATE_STR) = expDate
- '}
- End Property
-
- Public Property Get SyncUrl()
- '{
- SyncUrl = Base.Property(MCSUBINFO_PROP_SUBCHECKURL_STR)
- '}
- End Property
-
- Public Property Let SyncUrl(sUrl)
- '{
- Base.Property(MCSUBINFO_PROP_SUBCHECKURL_STR) = sUrl
- '}
- End Property
-
- Public Property Get Website()
- '{
- WebSite = Base.Property(MCSUBINFO_PROP_WEBSITE_STR)
- '}
- End Property
-
- Public Property Let Website(wSite)
- '{
- Base.Property(MCSUBINFO_PROP_WEBSITE_STR) = wSite
- '}
- End Property
-
- Public Property Get Backend()
- '{
- Backend = Base.Property(MCSUBINFO_PROP_BACKEND_STR)
- '}
- End Property
-
- Public Property Let Backend(backendId)
- '{
- Base.Property(MCSUBINFO_PROP_BACKEND_STR) = backendId
- '}
- End Property
-
- Public Property Get AffId()
- '{
- AffId = Base.Property(MCSUBINFO_PROP_AFFID_STR)
- '}
- End Property
-
- Public Property Let AffId(aff_id)
- '{
- Base.Property(MCSUBINFO_PROP_AFFID_STR) = aff_id
- '}
- End Property
-
- Public Property Get Lang()
- '{
- Lang = Base.Property(MCSUBINFO_PROP_LANG_STR)
- '}
- End Property
-
- Public Property Let Lang(lang_id)
- '{
- Base.Property(MCSUBINFO_PROP_LANG_STR) = lang_id
- '}
- End Property
-
- Public Property Get DBVersion()
- '{
- DBVersion = Base.Property(MCSUBINFO_PROP_SUBINFOVER_STR)
- '}
- End Property
-
- Public Property Let DBVersion(ver)
- '{
- Base.Property(MCSUBINFO_PROP_SUBINFOVER_STR) = ver
- '}
- End Property
-
- Public Property Get Base()
- '{
- Set Base = m_objBaseCls
- '}
- End Property
-
- Private Sub Class_Initialize
- '{
- Set m_objBaseCls = new CData
-
- If not m_objBaseCls is nothing Then
- '{
- m_objBaseCls.PropertyCount = MCSUBINFO_TOTAL_KNOWN_SUBDATA_PROP_COUNT
- m_objBaseCls.Property(MCSUBINFO_PROP_APPID_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_APPCODE_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_PERPETUAL_STR) = "0"
- m_objBaseCls.Property(MCSUBINFO_PROP_TRIAL_STR) = "0"
- m_objBaseCls.Property(MCSUBINFO_PROP_ACCNTID_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_EXPIRYDATE_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_BACKEND_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_SUBINFOVER_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_SUBCHECKURL_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_WEBSITE_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_AFFID_STR) = ""
- m_objBaseCls.Property(MCSUBINFO_PROP_LANG_STR) = ""
- '}
- End If
- '}
- End Sub
-
- Private Sub Class_Terminate
- '{
- If not m_objBaseCls is nothing Then
- '{
- Set m_objBaseCls = nothing
- '}
- End If
- '}
- End Sub
- '}
- End Class
-
- Class CSubMrg
- '{
- Private m_objSubMgr
- Private m_objSubInfo
- Private m_objAppInfo
-
- Public Property Get SubManager()
- '{
- Set SubManager = m_objSubMgr
- '}
- End Property
-
- Public Property Get SubInfo()
- '{
- Set SubInfo = m_objSubInfo
- '}
- End Property
-
- Public Property Get AppInfo()
- '{
- Set AppInfo = m_objAppInfo
- '}
- End Property
-
- Public Function CreateAppInfoObject(p_AppId, p_AppCode)
- '{
- Dim lRetVal
-
- If m_objSubMgr is nothing Then
- '{
- CreateAppInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- Set m_objAppInfo = m_objSubMgr.CreateAppInfo(p_AppId, lRetVal)
- If m_objAppInfo is Nothing Or not IsObject(m_objAppInfo) Then
- '{
- CreateAppInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End If
-
- CreateAppInfoObject = lRetVal
- '}
- End Function
-
- Public Function CreateSubInfoObject(p_AppId, p_AppCode)
- '{
- Dim lRetVal
-
- If m_objSubMgr is nothing Then
- '{
- CreateSubInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- Set m_objSubInfo = m_objSubMgr.CreateSubInfo(p_AppId, p_AppCode, lRetVal)
- If m_objSubInfo is Nothing Or not IsObject(m_objSubInfo) Then
- '{
- CreateSubInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End If
-
- CreateSubInfoObject = lRetVal
- '}
- End Function
-
- Public Function GetSubInfoObject(p_AppId, p_AppCode)
- '{
- Dim lRetVal
-
- If m_objSubMgr is nothing Then
- '{
- GetSubInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- Set m_objSubInfo = m_objSubMgr.GetSubInfo(p_AppId, p_AppCode, lRetVal)
- If m_objSubInfo is Nothing Or not IsObject(m_objSubInfo) Then
- '{
- GetSubInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End If
-
- GetSubInfoObject = lRetVal
- '}
- End Function
-
- Public Function GetAppInfoObject(p_AppId)
- '{
- Dim lRetVal
-
- If m_objSubMgr is nothing Then
- '{
- GetAppInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- Set m_objAppInfo = m_objSubMgr.GetAppInfo(p_AppId, lRetVal)
- If m_objAppInfo is Nothing Or not IsObject(m_objAppInfo) Then
- '{
- GetAppInfoObject = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End If
-
- GetAppInfoObject = lRetVal
- '}
- End Function
-
- Private Sub Class_Initialize
- '{
- Set m_objSubMgr = g_obj_6704E42E_E5F6_Manager
-
- Set m_objSubInfo = nothing
- Set m_objAppInfo = nothing
- '}
- End Sub
-
- Private Sub Class_Terminate
- '{
- If not m_objSubInfo is nothing Then
- '{
- Set m_objSubInfo = nothing
- '}
- End If
-
- If not m_objAppInfo is nothing Then
- '{
- Set m_objAppInfo = nothing
- '}
- End If
- '}
- End Sub
- '}
- End Class
-
- Class CBackwardCompatibilitySubInfo
- '{
- Private m_objSubMgr
- Private m_objLegacySubMgr
- Dim m_lRetVal
-
- Public Function GetExpiryDate(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- GetExpiryDate = ""
- Exit Function
- '}
- End If
-
- GetExpiryDate = m_objLegacySubMgr.GetExpiryDate(p_AppId, p_lRetVal)
- '}
- End Function
-
- Public Function GetAccountId(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- GetAccountId = ""
- Exit Function
- '}
- End If
-
- GetAccountId = m_objLegacySubMgr.GetAccountId(p_AppId, p_lRetVal)
- '}
- End Function
-
- Public Function GetSubType(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- GetSubType = ""
- Exit Function
- '}
- End If
-
- GetSubType = m_objLegacySubMgr.GetSubType(p_AppId, p_lRetVal)
- '}
- End Function
-
- Public Function GetExpiryDays(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- GetExpiryDays = ""
- Exit Function
- '}
- End If
-
- GetExpiryDays = m_objLegacySubMgr.GetExpiryDays(p_AppId, p_lRetVal)
- '}
- End Function
-
- Public Function GetAppCode(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- GetAppCode = ""
- Exit Function
- '}
- End If
-
- GetAppCode = m_objLegacySubMgr.GetAppCode(p_AppId, p_lRetVal)
- '}
- End Function
-
- Public Function IsAppExpired(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- IsAppExpired = ""
- Exit Function
- '}
- End If
-
- IsAppExpired = m_objLegacySubMgr.IsAppExpired(p_AppId, p_lRetVal)
- '}
- End Function
-
- Public Function IsPerpetual(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- IsPerpetual = ""
- Exit Function
- '}
- End If
-
- IsPerpetual = m_objLegacySubMgr.IsPerpetual(p_AppId, p_lRetVal)
- '}
- End Function
-
- Public Function IsTrial(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- IsTrial = ""
- Exit Function
- '}
- End If
-
- IsTrial = m_objLegacySubMgr.IsTrial(p_AppId, p_lRetVal)
- '}
- End Function
-
- Public Function IsNoDie(p_AppId, ByRef p_lRetVal)
- '{
- If m_objLegacySubMgr is nothing Then
- '{
- p_lRetVal = m_lRetVal
- IsNoDie = ""
- Exit Function
- '}
- End If
-
- IsNoDie = m_objLegacySubMgr.IsNoDie(p_AppId, p_lRetVal)
- '}
- End Function
-
- Private Sub Class_Initialize
- '{
- Set m_objSubMgr = g_obj_6704E42E_E5F6_Manager 'createObject("McSubMgr.McSubMgr")
- m_lRetVal = MCSUBDATA_SUCCESS
-
- If not m_objSubMgr is nothing Then
- '{
- Set m_objLegacySubMgr = m_objSubMgr.GetLegacySubMgr(m_lRetVal)
- '}
- End If
- '}
- End Sub
-
- Private Sub Class_Terminate
- '{
- If not m_objLegacySubMgr is nothing Then
- '{
- Set m_objLegacySubMgr = nothing
- '}
- End If
-
- If not m_objSubMgr is nothing Then
- '{
- Set m_objSubMgr = nothing
- '}
- End If
- '}
- End Sub
- '}
- End Class
-
-
- ''
- ' Function InitScriptAPI(p_objSubMgr)
- '
- ' Purpose: Initialize script API's
- '
- ' Pararmeters:
- ' [in] p_objSubMgr: Sub manager object created using object tag with liscense key
- '
- ' Returns:
- ' VOID
- '
- Function InitScriptAPI(p_objSubMgr)
- '{
- Set g_obj_6704E42E_E5F6_Manager = p_objSubMgr
- '}
- End Function
-
-
- ''
- ' Function DeinitScriptAPI()
- '
- ' Purpose: Un Initialize script API's
- '
- ' Pararmeters:
- '
- ' Returns:
- ' VOID
- '
- Function DeinitScriptAPI()
- '{
- If not g_obj_6704E42E_E5F6_Manager is nothing Then
- '{
- Set g_obj_6704E42E_E5F6_Manager = nothing
- '}
- End If
- '}
- End Function
-
-
- ''
- ' Function IsAppActivated(p_AppId, p_AppCode, p_Backend, ByRef lRetVal)
- '
- ' Purpose: To find out whether the application identified by AppdId, AppCode and Backend
- ' has been activated on the backend. An application is assumed to be
- ' activated only if there is an entry in the subscription database identified by
- ' the AppId, AppCode, Backend and the entry contains the mandatory
- ' information like expiry_date, sub_type, accnt_id.
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [in] p_AppCode : Application Code
- ' [in] p_Backend : Backend
- ' [out] lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if application information is found in the database.
- ' 'False' if application information was not found in the database.
- '
- Function IsAppActivated(p_AppId, p_AppCode, p_Backend, ByRef lRetVal)
- '{
- Dim subMgr
- Dim lPropRetVal
- Dim propBackend, propAccntId, propExpiryDate, propTrial, propPerpetual
-
- Set subMgr = new CSubMrg
-
- IsAppActivated = False
- lRetVal = MCSUBDATA_SUCCESS
-
- If subMgr is nothing Then
- '{
- lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- If "" = p_AppId Or "" = p_AppCode Or "" = p_Backend Then
- '{
- lRetVal = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End if
-
- lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- '
- ' If object creation fails, it could be because there is no database present. This does not denote an error condition
- '
- lRetVal = MCSUBDATA_SUCCESS
- Exit Function
- '}
- End If
-
- propBackend = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_BACKEND_STR, lPropRetVal)
-
- '
- ' Backend property not found or it does not match, return false
- '
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or not p_Backend = propBackend Then
- '{
- Exit Function
- '}
- End if
-
- '
- ' If any of the below properties are not found or are invalid return false
- '
- propAccntId = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_ACCNTID_STR, lPropRetVal)
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or propAccntId = "" Then
- '{
- Exit Function
- '}
- End if
-
- propPerpetual = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_PERPETUAL_STR, lPropRetVal)
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or propPerpetual = "" Then
- '{
- Exit Function
- '}
- End if
-
- propTrial = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_TRIAL_STR, lPropRetVal)
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or propTrial = "" Then
- '{
- Exit Function
- '}
- End If
-
- propExpiryDate = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_EXPIRYDATE_STR, lPropRetVal)
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or propExpiryDate = "" Then
- '{
- Exit Function
- '}
- End if
-
- '
- ' If it got here without exiting then app is registered
- '
- IsAppActivated = True
- '}
- End Function
-
- ''
- ' Function IsPartnerAppActivated(p_AppId, p_AppCode, p_Backend, p_AffID, ByRef lRetVal)
- '
- ' Find whether the application identified by AppdId,
- ' AppCode, AffID and Backend has subscription information in the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [in] p_AppCode : Application Code
- ' [in] p_Backend : Backend
- ' [in] p_AffID : The Affiliate ID
- ' [out] lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if application information is found in the database.
- ' 'False' if application information was not found in the database.
- '
- Function IsPartnerAppActivated(p_AppId, p_AppCode, p_Backend, p_AffID, ByRef lRetVal)
- '{
- Dim subMgr
- Dim propAffId
- Dim lPropRetVal
-
- IsPartnerAppActivated = False
- lRetVal = MCSUBDATA_SUCCESS
-
- If "" = p_AppId Or "" = p_AppCode Or "" = p_Backend Or "" = p_AffID Then
- '{
- lRetVal = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End if
-
- If False = IsAppActivated(p_AppId, p_AppCode, p_Backend, lRetVal) Then
- '{
- Exit Function
- '}
- End if
-
- '
- ' If everything satisfied from IsAppRegisted then check for AffId
- '
- Set subMgr = new CSubMrg
-
- If subMgr is nothing Then
- '{
- lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- '
- ' If object creation fails, it could be because there is no database present. This does not denote an error condition
- '
- lRetVal = MCSUBDATA_SUCCESS
- Exit Function
- '}
- End If
-
- propAffId = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_AFFID_STR, lPropRetVal)
-
- '
- ' Backend property not found or it does not match, return false
- '
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Or not p_AffID = propAffId Then
- '{
- Exit Function
- '}
- End if
-
- IsPartnerAppActivated = True
- '}
- End Function
-
- ''
- ' Function IsAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, ByRef lRetVal)
- '
- ' Find whether the application identified by AppdId,
- ' AppCode and Backend has subscription information in the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [in] p_AppCode : Application Code
- ' [in] p_Backend : Backend
- ' [in] p_Trial : Trial
- ' [out] lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if application information is found in the database.
- ' 'False' if application information was not found in the database.
- '
- Function IsAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, ByRef lRetVal)
- '{
- Dim subMgr
- Dim lPropRetVal
- Dim propBackend
- Dim propTrial
-
- IsAppPresent = False
-
- Set subMgr = new CSubMrg
- If subMgr is nothing Then
- '{
- lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- If "" = p_AppId Or "" = p_AppCode Then
- '{
- lRetVal = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End if
-
- lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- '
- ' Negate lRetVal here since clients check for it first
- '
- lRetVal = MCSUBDATA_SUCCESS
- Exit Function
- '}
- End If
-
- propBackend = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_BACKEND_STR, lPropRetVal)
-
- '
- ' Backend property not found or it does not match, return false
- '
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
- '{
- Exit Function
- '}
- End if
-
- If not "" = p_Backend Then
- '{
- If not p_Backend = propBackend Then
- '{
- Exit Function
- '}
- End if
- '}
- End if
-
- '
- ' Trial property not found or it does not match, return false
- '
- propTrial = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_TRIAL_STR, lPropRetVal)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
- '{
- Exit Function
- '}
- End if
-
- If not "" = p_Trial Then
- '{
- If not p_Trial = propTrial Then
- '{
- Exit Function
- '}
- End if
- '}
- End if
-
- IsAppPresent = True
-
- '}
- End Function
-
-
- ''
- ' Function IsPartnerAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, p_AffId, ByRef lRetVal)
- '
- ' Find whether the application identified by AppdId,
- ' AppCode and Backend has subscription information in the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : The Application ID
- ' [in] p_AppCode : Application Code
- ' [in] p_Backend : Backend
- ' [in] p_Trial : Trial
- ' [in] p_AffId : Affiliate ID
- ' [out] lRetVal : An MCSUBDATA_* error code
- '
- ' Returns:
- ' 'True' if application information is found in the database.
- ' 'False' if application information was not found in the database.
- '
- Function IsPartnerAppPresent(p_AppId, p_AppCode, p_Backend, p_Trial, p_AffId, ByRef lRetVal)
- '{
- Dim subMgr
- Dim lPropRetVal
- Dim propBackend
- Dim propTrial
- Dim propAffId
-
- IsPartnerAppPresent = False
-
- Set subMgr = new CSubMrg
- If subMgr is nothing Then
- '{
- lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- If "" = p_AppId Or "" = p_AppCode Then
- '{
- lRetVal = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End if
-
- lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- '
- ' Negate lRetVal here since clients check for it first
- '
- lRetVal = MCSUBDATA_SUCCESS
- Exit Function
- '}
- End If
-
- propBackend = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_BACKEND_STR, lPropRetVal)
-
- '
- ' Backend property not found or it does not match, return false
- '
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
- '{
- Exit Function
- '}
- End if
-
- If not "" = p_Backend Then
- '{
- If not p_Backend = propBackend Then
- '{
- Exit Function
- '}
- End if
- '}
- End if
-
- '
- ' Trial property not found or it does not match, return false
- '
- propTrial = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_TRIAL_STR, lPropRetVal)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
- '{
- Exit Function
- '}
- End if
-
- If not "" = p_Trial Then
- '{
- If not p_Trial = propTrial Then
- '{
- Exit Function
- '}
- End if
- '}
- End if
-
- '
- ' AffId property not found or it does not match, return false
- '
- propAffId = subMgr.SubInfo.GetProperty(MCSUBINFO_PROP_AFFID_STR, lPropRetVal)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lPropRetVal Then
- '{
- Exit Function
- '}
- End if
-
- If not "" = p_AffId Then
- '{
- If not p_AffId = propAffId Then
- '{
- Exit Function
- '}
- End if
- '}
- End if
-
- IsPartnerAppPresent = True
-
- '}
- End Function
-
-
- ''
- ' Function GetUserRegistered(p_Backend, p_AccntID)
- '
- ' Finds out if the subscription database has at least one user id associated with Backend.
- '
- ' Pararmeters:
- ' [in] p_Backend : Backend
- ' [out] p_AccntID : The AccountID returned for that backend
- '
- ' Returns:
- ' An MCSUBDATA_* error code
- '
- Function GetUserRegistered(p_Backend, ByRef p_AccntID)
- '{
- Dim subMgr
- Dim bIsUserReg
-
- GetUserRegistered = False
-
- If "" = p_Backend Then
- '{
- GetUserRegistered = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End if
-
- Set subMgr = new CSubMrg
- If subMgr is nothing Then
- '{
- GetUserRegistered = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- GetUserRegistered = subMgr.SubManager.GetUserRegisteredForBackend(p_Backend, p_AccntID)
- '}
- End Function
-
- ''
- ' Function CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, p_AppInfo)
- '
- ' Write the subscription information for the application identified by AppId, AppCode into the subscription database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [in] p_SubInfo : A CSubscriptionData instance, with relevant properties for Subscription info set
- ' [in] p_AppInfo : A CAppData instance, with relevant properties for Appinfo set
- '
- ' Returns: An MCSUBDATA_* error code
- '
- '
- Function CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, p_AppInfo)
- '{
- Dim subMgr
- Dim lRetVal
- Dim listProp
- Dim iIdx
- Dim propValue
-
- If "" = p_AppId Or "" = p_AppCode Or p_SubInfo is nothing Then
- '{
- CreateNewApplication = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End If
-
- Set subMgr = new CSubMrg
- If subMgr is nothing Then
- '{
- CreateNewApplication = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- lRetVal = subMgr.CreateSubInfoObject(p_AppId, p_AppCode)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- CreateNewApplication = lRetVal
- Exit Function
- '}
- End If
-
- '
- ' Set all the properties and then commit. If some property has not been set, Commit will return
- ' an error. Escalate this to the client
- '
- listProp = p_SubInfo.Base.PropertyNameList
-
- If not IsArray(listProp) Then
- '{
- CreateNewApplication = MCSUBDATA_COULD_NOT_GET_PROP_LIST
- Exit Function
- '}
- End If
-
- For iIdx = LBound(listProp, 1) to UBound(listProp, 1) step 1
- '{
- If not "" = listProp(iIdx) Then
- '{
- propValue = p_SubInfo.Base.Property(listProp(iIdx))
- If not "" = propValue Then
- '{
- lRetVal = subMgr.SubInfo.SetProperty(listProp(iIdx), propValue)
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- CreateNewApplication = lRetVal
- Exit Function
- '}
- End If
- '}
- End If
- '}
- End If
- '}
- Next
-
- lRetVal = subMgr.SubInfo.Commit
-
- '
- ' Created the SubInfo object. Now create the Appinfo object.
- ' Only create it if we are successful adding subinfo data
- '
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- CreateNewApplication = lRetVal
- Exit Function
- '}
- End If
-
- If not p_AppInfo is nothing Then
- '{
- lRetVal = subMgr.CreateAppInfoObject(p_AppId, p_AppCode)
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- CreateNewApplication = lRetVal
- Exit Function
- '}
- End If
-
- listProp = p_AppInfo.Base.PropertyNameList
-
- If not IsArray(listProp) Then
- '{
- CreateNewApplication = MCSUBDATA_COULD_NOT_GET_PROP_LIST
- Exit Function
- '}
- End If
-
- For iIdx = LBound(listProp, 1) to UBound(listProp, 1) step 1
- '{
- If not "" = listProp(iIdx) Then
- '{
- propValue = p_AppInfo.Base.Property(listProp(iIdx))
- If not "" = propValue Then
- '{
- lRetVal = subMgr.AppInfo.SetProperty(listProp(iIdx), propValue)
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- CreateNewApplication = lRetVal
- Exit Function
- '}
- End If
- '}
- End If
- '}
- End If
- '}
- Next
-
- lRetVal = subMgr.AppInfo.Commit
- '}
- Else
- '{
- '
- ' If appInfo is nothing, we blindly remove the data
- '
- subMgr.SubManager.RemoveAppInfo(p_AppId)
-
- '}
- End If
-
- CreateNewApplication = lRetVal
- '}
- End Function
-
- ''
- ' Function AddSubInfo(p_AppId, p_AppCode, p_SubInfo, p_bForce)
- '
- ' Write the subscription information for the application identified by AppId, AppCode into the subscription database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [in] p_SubInfo : A CSubscriptionData instance, with all parameters set
- '
- ' Returns: An MCSUBDATA_* error code
- '
- '
- Function AddSubInfo(p_AppId, p_AppCode, p_SubInfo, p_bForce)
- '{
- Dim subMgr
- Dim lRetVal
-
- If "" = p_AppId Or "" = p_AppCode Or p_SubInfo is nothing Then
- '{
- AddSubInfo = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End If
-
- Set subMgr = new CSubMrg
- If subMgr is nothing Then
- '{
- AddSubInfo = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- If False = p_bForce Then
- '{
- If True = subMgr.SubManager.IsOldAppInstalled(p_AppId, lRetVal) Then
- '{
- AddSubInfo = lRetVal
- Exit Function
- '}
- Else
- '{
-
- ' Sameer (11/10/2003): If Force = False then we have to check the
- ' subscription database to see if there is data for AppId. We should not
- ' check for the combination of AppId, AppCode. Hence we should pass AppCode
- ' as "" so that MCSUBMGR will return information if there is any data for AppId.
-
- lRetVal = subMgr.GetSubInfoObject(p_AppId, "")
- If MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- AddSubInfo = lRetVal
- Exit Function
- '}
- End If
- '}
- End If
- '}
- End If
-
- AddSubInfo = CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, nothing)
- '}
- End Function
-
- ''
- ' Function AddSubInfoEx(p_AppId, p_AppCode, p_SubInfo, p_AppInfo, p_bForce)
- '
- ' Write the subscription information for the application identified by AppId, AppCode into the subscription database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [in] p_SubInfo : A CSubscriptionData instance, with all parameters set
- ' [in] p_AppInfo : Application Info object
- '
- ' Returns: An MCSUBDATA_* error code
- '
- ' Sameer(07/09/2004): This was added as a separate function so that the caller has the option to pass in
- ' the application info object. This will be used ONLY IFF p_bForce = True. As can be seen in the flow below
- ' if p_bForce = False then the application info object is not used.
- ' A used case scenario is for DELL registrations where there is an existing appinfo section with "no_die = 1".
- ' For a subsequent registration AddSubInfoEx is called with p_bForce = TRUE and the existing appinfo object. That
- ' we preserve the no_die flag for subsequent registrations also.
-
- '
- Function AddSubInfoEx(p_AppId, p_AppCode, p_SubInfo, p_AppInfo, p_bForce)
- '{
- Dim subMgr
- Dim lRetVal
-
- If "" = p_AppId Or "" = p_AppCode Or p_SubInfo is nothing Then
- '{
- AddSubInfoEx = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End If
-
- Set subMgr = new CSubMrg
- If subMgr is nothing Then
- '{
- AddSubInfoEx = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- If False = p_bForce Then
- '{
- If True = subMgr.SubManager.IsOldAppInstalled(p_AppId, lRetVal) Then
- '{
- AddSubInfoEx = lRetVal
- Exit Function
- '}
- Else
- '{
-
- ' Sameer (11/10/2003): If Force = False then we have to check the
- ' subscription database to see if there is data for AppId. We should not
- ' check for the combination of AppId, AppCode. Hence we should pass AppCode
- ' as "" so that MCSUBMGR will return information if there is any data for AppId.
-
- lRetVal = subMgr.GetSubInfoObject(p_AppId, "")
- If MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- AddSubInfoEx = lRetVal
- Exit Function
- '}
- End If
- '}
- End If
- '}
- End If
-
- AddSubInfoEx = CreateNewApplication(p_AppId, p_AppCode, p_SubInfo, p_AppInfo)
- '}
- End Function
-
- ''
- ' Function H_GetSubInfo(p_eType, p_AppId, p_AppCode, lRetVal)
- '
- ' Get the subscription information identified by AppId and AppCode from the database.
- '
- ' Pararmeters:
- ' [in] p_eType : Type of info get. See MCSUBINFO_ENUM_INFOTYPE*
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [out] p_obj : A CSubscriptionData/CAppData object with all known properties set.
- ' All unused properties are ""
- '
- ' Returns: A MCSUBDATA_* error code
- '
- Function H_GetSubInfo(p_eType, p_AppId, p_AppCode, ByRef p_obj)
- '{
- Dim subMgr
- Dim iIdx
- Dim listProp
- Dim objSubInfo
- Dim maxPropCount
- Dim lRetVal
-
- Set p_obj = nothing
- maxPropCount = 0
- lRetVal = MCSUBDATA_SUCCESS
-
- If "" = p_AppId Then
- '{
- H_GetSubInfo = MCSUBDATA_INVALID_PARAMETER
- Exit Function
- '}
- End If
-
- Set subMgr = new CSubMrg
- If subMgr is nothing Then
- '{
- H_GetSubInfo = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- Exit Function
- '}
- End if
-
- select case p_eType
- '{
- case MCSUBINFO_ENUM_INFOTYPE_SUBDATA
- lRetVal = subMgr.GetSubInfoObject(p_AppId, p_AppCode)
-
- case MCSUBINFO_ENUM_INFOTYPE_APPDATA
- lRetVal = subMgr.GetAppInfoObject(p_AppId)
-
- case Else
- lRetVal = MCSUBDATA_INVALID_PARAMETER
- '}
- End select
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- H_GetSubInfo = lRetVal
- Exit Function
- '}
- End If
-
- select case p_eType
- '{
- case MCSUBINFO_ENUM_INFOTYPE_SUBDATA
- lRetVal = subMgr.SubInfo.GetAllProperties(listProp)
- Set objSubInfo = new CSubscriptionData
- If objSubInfo is nothing Then
- '{
- lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- '}
- End If
- maxPropCount = MCSUBINFO_TOTAL_KNOWN_SUBDATA_PROP_COUNT
-
- case MCSUBINFO_ENUM_INFOTYPE_APPDATA
- lRetVal = subMgr.AppInfo.GetAllProperties(listProp)
- Set objSubInfo = new CAppData
- If objSubInfo is nothing Then
- '{
- lRetVal = MCSUBDATA_COULD_NOT_CREATE_OBJECT
- '}
- End If
- maxPropCount = MCSUBINFO_TOTAL_KNOWN_APPDATA_PROP_COUNT
-
- case Else
- lRetVal = MCSUBDATA_INVALID_PARAMETER
- '}
- End select
-
- If not MCSUBDATA_MCSUBOBJRET_SUCCESS = lRetVal Then
- '{
- H_GetSubInfo = lRetVal
- Exit Function
- '}
- End If
-
- '
- ' First make sure you allocate enough extra space
- '
- If (maxPropCount - UBound(listProp, 1)) < 0 Then
- '{
- objSubInfo.Base.PropertyCount = UBound(listProp, 1) - maxPropCount
- '}
- End If
-
- For iIdx = LBound(listProp, 1) to UBound(listProp, 1) Step 1
- '{
- objSubInfo.Base.Property(listProp(iIdx, 0)) = listProp(iIdx, 1)
- '}
- Next
-
- Set p_obj = objSubInfo
-
- H_GetSubInfo = lRetVal
- '}
- End Function
-
-
- ''
- ' Function GetSubInfo(p_AppId, p_AppCode, lRetVal)
- '
- ' Get the subscription information identified by AppId and AppCode from the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [out] p_obj : A CSubscriptionData object with all known properties set.
- ' All unused properties are ""
- '
- ' Returns: A MCSUBDATA_* error code
- '
- Function GetSubInfo(p_AppId, p_AppCode, ByRef p_obj)
- '{
- GetSubInfo = H_GetSubInfo(MCSUBINFO_ENUM_INFOTYPE_SUBDATA, p_AppId, p_AppCode, p_obj)
- '}
- End Function
-
- ''
- ' Function GetAppInfo(p_AppId, p_AppCode, lRetVal)
- '
- ' Get the subscription information identified by AppId and AppCode from the database.
- '
- ' Pararmeters:
- ' [in] p_AppId : AppID
- ' [in] p_AppCode : The App Code
- ' [out] p_obj : A CAppData object with all known properties set.
- ' All unused properties are ""
- '
- ' Returns: A MCSUBDATA_* error code
- '
- Function GetAppInfo(p_AppId, p_AppCode, ByRef p_obj)
- '{
- GetAppInfo = H_GetSubInfo(MCSUBINFO_ENUM_INFOTYPE_APPDATA, p_AppId, p_AppCode, p_obj)
- '}
- End Function
-
-
- Function Main()
- '{
- Dim objSubInfo
- Dim objAppInfo
- Dim lRetVal
-
- Set objSubInfo = new CSubscriptionData
- Set objAppInfo = new CAppData
-
- objSubInfo.AccountId = "2324235"
- objSubInfo.ExpiryDate = "20021212"
- objSubInfo.SyncUrl = "http://www.mcafee.com"
- objSubInfo.WebSite = "http://www.mcafee.com"
- objSubInfo.Backend = "aol"
- objSubInfo.affId = "345"
- objSubInfo.DBVersion = "1.0"
-
- objAppInfo.No_Die = "1"
-
- lRetVal = CreateNewApplication("VSO", "VSH8", objSubInfo, objAppInfo)
-
- If not MCSUBDATA_SUCCESS = lRetVal Then
- '{
- MsgBox "CreateNewApplication failed. ErrorCode: " & lRetVal
- Exit Function
- '}
- End If
-
- objSubInfo.AccountId = "12345"
-
- lRetVal = AddSubInfo("VSO", "VSH8", objSubInfo, True)
-
- If not MCSUBDATA_SUCCESS = lRetVal Then
- '{
- MsgBox "AddSubInfo for VSO failed. ErrorCode: " & lRetVal
- Exit Function
- '}
- End If
-
- objSubInfo.AccountId = "12345"
-
- lRetVal = AddSubInfo("MPF", "MPF2", objSubInfo, False)
-
- If not MCSUBDATA_SUCCESS = lRetVal Then
- '{
- MsgBox "AddSubInfo for MPF failed. ErrorCode: " & lRetVal
- Exit Function
- '}
- End If
-
- objSubInfo.AccountId = "9999999"
-
- lRetVal = AddSubInfo("MPS", "MPS2", objSubInfo, False)
-
- If not MCSUBDATA_SUCCESS = lRetVal Then
- '{
- MsgBox "AddSubInfo for MPS failed. ErrorCode: " & lRetVal
- Exit Function
- '}
- End If
-
- 'MsgBox "IsAppActivated(appid, appcode, backend) = " & IsAppActivated("MP S", "", "aol", lRetVal) & ", " & lRetVal
-
- 'MsgBox "IsPartnerAppActivated(appid, appcode, backend, affid) = " & IsPartnerAppActivated("MPS", "MPS2", "aol", "345", lRetVal) & ", " & lRetVal
-
- 'MsgBox "IsAppPresent(p_AppId, p_AppCode, p_Backend) = " & IsAppPresent("MPS", "MPS", "aol", lRetVal) & ", " & lRetVal
-
- Dim accntID
- accntID = "2323"
- 'MsgBox "IsUserRegistered(p_Backend, p_AccntID) = " & GetUserRegistered("aol", accntID, lRetVal) & ", " & accntID & ", " & lRetVal
-
- Dim retSubInfo
-
- lRetVal = GetSubInfo("VSO", "", retSubInfo)
-
- If retSubInfo is nothing Then
- '{
- MsgBox "Could not get subinfo. RetVal = " & lRetVal
- '}
- Else
- '{
- Dim listProp, idx
- Dim props, prop
- listProp = retSubInfo.Base.PropertyNameList
- props = ""
- for idx = LBound(listProp, 1) to UBound(listProp, 1)
- '{
- prop = retSubInfo.Base.Property(listProp(idx))
- If not "" = prop Then
- '{
- props = props & listProp(idx) & " = " & prop & Chr(10)
- '}
- End If
- '}
- Next
-
- MsgBox props
-
- '}
- End If
- '}
- End Function
-