VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Payment"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'**********************************************************************************************
'* Copyright (c) 2001-2017 Liquid Technologies Limited. All rights reserved.
'* See www.liquid-technologies.com for product details.
'*
'* Please see products End User License Agreement for distribution permissions.
'*
'* WARNING: THIS FILE IS GENERATED
'* Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten
'*
'* Generation  :  by Liquid XML Data Binder 15.0.1.7161
'* Using Schema: D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\SimpleHierarchy\Schema\SimpleHierarchy.xsd
'**********************************************************************************************
Private m_ElementName As String
Private m_validElement As String
Private mvarVISA As SimpleHiarchyLib.VISA   
Private WithEvents mvarVouchers As SimpleHiarchyLib.VouchersCol 
Private mvarCash As LtXmlComLib15.Element       
' ##HAND_CODED_BLOCK_START ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional Variable Declarations...

' ##HAND_CODED_BLOCK_END ID="Additional Variable Declarations"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

Implements LtXmlComLib15.XmlObjectBase
Implements LtXmlComLib15.XmlGeneratedClass

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''' Properties '''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Public Property Get ElementName() As String
    ElementName = m_elementName
End Property

' Summary:
'       Represents an optional Element in the XML document
'       
' Remarks:
'        
'       This property is represented as an Element in the XML. 
'       It is optional, initially it is null. 
'       Only one Element within this class may be set at a time, setting this property when another element is already set will raise an exception. setting this property to null will allow another element to be selected 
Public Property Get VISA As SimpleHiarchyLib.VISA 
    Set VISA = mvarVISA  
End Property
Public Property Set VISA(ByVal value As SimpleHiarchyLib.VISA)
    ' Ensure only on element is populated at a time
    ClearChoice "VISA" ' remove selection
    if value is Nothing then
        Set mvarVISA = Nothing
    else
        CastToXmlObjectBase(value).PrivateSetElementName "VISA"
'       LtXmlComLib15.XmlObjectBaseHelper.Throw_IfElementNameDiffers value, "VISA"
        Set mvarVISA = value
    End If
End Property
        
' Summary:
'       A collection of Voucherss
'       
' Remarks:
'        
'       This property is represented as an Element in the XML. 
'       This collection may contain 1 to Many objects. 
'       Only one Element within this class may be set at a time. This collection (as a whole is counted as an element) may contain 0 or 1 to Many entries. Emptying the collection allows a different element to be the selected one. If there is already a selected element, and an item is added to this collection then an exception will be raised 
Public Property Get Vouchers As SimpleHiarchyLib.VouchersCol 
    Set Vouchers = mvarVouchers
End Property
        ' gets called when the collection changes (allows us to determine if this choice is selected or not)
Private Sub mvarVouchers_OnCollectionChange()
    ' The class represents a choice, so prevent more than one element from being selected
    if m_validElement <> "Vouchers" then
        ClearChoice iif(mvarVouchers.Count = 0,"","Vouchers") ' remove selection
    end if
    LtXmlComLib15.XmlObjectBaseHelper.Choice_CollectionChanged "Vouchers", mvarVouchers.Count, m_validElement
End Sub
        
' Summary:
'       Represents an optional untyped element in the XML document
'       
' Remarks:
'        
'       It is optional, initially it is null. 
'       Only one Element within this class may be set at a time, setting this property when another element is already set will raise an exception. setting this property to null will allow another element to be selected 
Public Property Get Cash As LtXmlComLib15.Element 
    Set Cash = mvarCash  
End Property
Public Property Set Cash(ByVal value As LtXmlComLib15.Element)
    ClearChoice "Cash" ' remove selection
    LtXmlComLib15.XmlObjectBaseHelper.Throw_IfPropertyIsNull value, "Cash"
    LtXmlComLib15.XmlObjectBaseHelper.TestNamespace value.Namespace, "##any", ""
    Set mvarCash = value 
End Property
    
Public Property Get ChoiceSelectedElement As String 
    ChoiceSelectedElement = m_validElement
End Property
friend Property Let ChoiceSelectedElement (ByVal value As String)
    m_validElement = value
End Property


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''' Standard Methods '''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Public Sub ToXmlFile(ByVal FileName As String, Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib15.XmlFormatting = LtXmlComLib15.XmlFormatting_Indented, Optional encoding As LtXmlComLib15.XmlEncoding = LtXmlComLib15.XmlEncoding_UTF8, Optional EOL As LtXmlComLib15.EOLType = LtXmlComLib15.EOLType.EOLType_CRLF, Optional context As LtXmlComLib15.XmlSerializationContext = Nothing)
    RegisterProduct
    LtXmlComLib15.XmlObjectBaseHelper.ToXmlFile Me, FileName, includeDocHeader, formatting, encoding, EOL, context
End Sub
Public Function ToXml(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib15.XmlFormatting = LtXmlComLib15.XmlFormatting_Indented, Optional EOL As LtXmlComLib15.EOLType = LtXmlComLib15.EOLType.EOLType_LF, Optional context As LtXmlComLib15.XmlSerializationContext = Nothing) As String
    RegisterProduct
    ToXml = LtXmlComLib15.XmlObjectBaseHelper.ToXml(Me, includeDocHeader, formatting, EOL, context)
End Function
Public Function ToXmlStream(Optional includeDocHeader As Boolean = True, Optional formatting As LtXmlComLib15.XmlFormatting = LtXmlComLib15.XmlFormatting_Indented, Optional encoding As LtXmlComLib15.XmlEncoding = LtXmlComLib15.XmlEncoding_UTF8, Optional EOL As LtXmlComLib15.EOLType = LtXmlComLib15.EOLType.EOLType_LF, Optional context As LtXmlComLib15.XmlSerializationContext = Nothing) As Variant
    RegisterProduct
    ToXmlStream = LtXmlComLib15.XmlObjectBaseHelper.ToXmlStream(Me, includeDocHeader, formatting, encoding, EOL, context)
End Function
Public Sub FromXml(ByVal xmlIn As String, Optional context As LtXmlComLib15.XmlSerializationContext = Nothing)
    RegisterProduct
    LtXmlComLib15.XmlObjectBaseHelper.FromXml Me, xmlIn, context
End Sub
Public Sub FromXmlFile(ByVal FileName As String, Optional context As LtXmlComLib15.XmlSerializationContext = Nothing)
    RegisterProduct
    LtXmlComLib15.XmlObjectBaseHelper.FromXmlFile Me, FileName, context
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''' Private Methods  ''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Summary:
'       Constructor for Payment
' Remarks:
'       The class is created with all the mandatory fields populated with the
'       default data.  
'       All Collection object are created. 
'           However any 1-n relationships (these are represented as collections) are
'       empty. To comply with the schema these must be populated before the xml
'       obtained from ToXml is valid against the schema D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\SimpleHierarchy\Schema\SimpleHierarchy.xsd 
Private Sub Class_Initialize()
    m_elementName = "Payment"
    XmlGeneratedClass_Init
End Sub

' Summary:
'       Selects the given element as the selected choice
Private Sub ClearChoice(ByVal SelectedElement as String)
    Set mvarVISA           = Nothing
    if not mvarVouchers is nothing then
        if "Vouchers" <> SelectedElement then
            mvarVouchers.Clear
        end if
    end if
    Set mvarCash           = Nothing

    m_validElement = selectedElement
End Sub


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''' Implementation of XmlObjectBase '''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub XmlObjectBase_PrivateSetElementName(ByVal vNewValue As String)
    m_ElementName = vNewValue
End Sub

Private Property Get XmlObjectBase_ElementName() As String
    XmlObjectBase_ElementName = m_ElementName
End Property

Private Property Get XmlObjectBase_TargetNamespace() As String
    XmlObjectBase_TargetNamespace = ""
End Property

Private Function XmlObjectBase_IsSuitableSubstitution(ByVal InterfaceName As String) As Boolean
    XmlObjectBase_IsSuitableSubstitution = false
    if InterfaceName = "Payment" _
        then XmlObjectBase_IsSuitableSubstitution = true
End Function

Private Property Get XmlObjectBase_Namespace() As String
    XmlObjectBase_Namespace = ""
End Property

Private Function XmlObjectBase_FromXmlInt(ByVal XMLParent As MSXML2.IXMLDOMElement, ByVal XMLChild As MSXML2.IXMLDOMElement, ByVal context As LtXmlComLib15.XmlSerializationContext, ByVal isOptionalChoice As Boolean) As MSXML2.IXMLDOMElement
    Set XmlObjectBase_FromXmlInt = XmlGeneratedClassHelper.FromXml(Me, XMLParent, XMLChild, context, isOptionalChoice)
End Function
Private Sub XmlObjectBase_ToXmlInt(ByVal xmlOut As LtXmlComLib15.XmlTextWriter, ByVal bRegisterNamespaces As Boolean, ByVal NamespaceUri As String, ByVal context As LtXmlComLib15.XmlSerializationContext, ByVal isOptionalChoice As Boolean)
    XmlGeneratedClassHelper.ToXml Me, xmlOut, bRegisterNamespaces, NamespaceUri, context, isOptionalChoice
End Sub
Private Sub XmlObjectBase_AttributesToXmlInt(ByVal xmlOut As LtXmlComLib15.XmlTextWriter, ByVal context As LtXmlComLib15.XmlSerializationContext)
    XmlGeneratedClassHelper.AttributesToXml Me, xmlOut, context
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''' Implementation of XmlGeneratedClass '''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Summary:
'       Initializes the class
' Remarks:
'       The Creates all the mandatory fields (populated with the default data) 
'       All Collection object are created.
'       However any 1-n relationships (these are represented as collections) are
'       empty. To comply with the schema these must be populated before the xml
'       obtained from ToXml is valid against the schema D:\Development2017\Liquid\Tools\DataBindingSamples\Samples\SimpleHierarchy\Schema\SimpleHierarchy.xsd.
Private Sub XmlGeneratedClass_Init()
    Set mvarVISA = Nothing
    Set mvarVouchers = CF.CreateClassCollection(ClsName_VouchersCol, "Vouchers", "", 1, -1)
    Set mvarCash = Nothing
    
    m_validElement = ""



    ' Force Init ClassInfo
    Dim classInfo As LtXmlComLib15.ClassInfo
    Set classInfo = XmlGeneratedClass_ClassInfo

' ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional Init Settings...

' ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

End Sub 

Private Property Get XmlGeneratedClass_ClassInfo() As LtXmlComLib15.ClassInfo
    If g_ClsDataPayment Is Nothing Then
        Set g_ClsDataPayment = New LtXmlComLib15.ClassInfo
        
        g_ClsDataPayment.GroupType = LtXmlComLib15.XmlGroupType.Choice
        g_ClsDataPayment.ElementType = LtXmlComLib15.XmlElementType.Element
        g_ClsDataPayment.ElementName = "Payment"
        g_ClsDataPayment.ElementNamespaceURI = ""
        g_ClsDataPayment.FromXmlFailIfAttributeUnknown = true
        g_ClsDataPayment.IsClassDerived = false
        g_ClsDataPayment.PrimitiveDataType = LtXmlComLib15.XmlDataType.type_none
        g_ClsDataPayment.PrimitiveFormatOverride = ""
        g_ClsDataPayment.OutputPrimitiveClassAsTextProperty = False
        Set g_ClsDataPayment.ClassFactory = General.CF
        
        g_ClsDataPayment.AddElmChoiceClsOpt "VISA", "", "VISA", LtXmlComLib15.XmlElementType.Element, ClsName_VISA
        g_ClsDataPayment.AddElmChoiceClsCol "Vouchers", "", "Vouchers", LtXmlComLib15.XmlElementType.Element
        g_ClsDataPayment.AddElmChoiceUntpdOpt "Cash", "", "Cash", "##any", ""
    End If
    Set XmlGeneratedClass_ClassInfo = g_ClsDataPayment
End Property

' ##HAND_CODED_BLOCK_START ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS

' Add Additional Methods/Properties Here...

' ##HAND_CODED_BLOCK_END ID="Additional Methods/Properties"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS