VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private Const m_cNAME As String = "clsClass"

Private m_oTableHelperClasses As New clsFOTAADOTableHelper

Public m_nClassID As Long
Public m_sClassName As String
Public m_sTHACO As String
Public m_sSaves As String
Public m_sLevels As String
Public m_bMageSpells As Boolean
Public m_bPriestSpells As Boolean
Public m_sProficiencies As String
Public m_nCritOn As Long

Public Function Load(oDB As ADODB.Connection, nClassID As Long)

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".Load"
    Call WriteProcStart(sRoutineName) ' sClassName)

    
    Call m_oTableHelperClasses.LoadRecords("WHERE nClassID = " & nClassID)

    m_nClassID = m_oTableHelperClasses.GetValue("nClassID")
    m_sClassName = m_oTableHelperClasses.GetValue("sClassName")
    m_sTHACO = m_oTableHelperClasses.GetValue("sTHACO")
    m_sSaves = m_oTableHelperClasses.GetValue("sSaves")
    m_sLevels = m_oTableHelperClasses.GetValue("sLevels")
    m_bMageSpells = m_oTableHelperClasses.GetValue("bMageSpells")
    m_bPriestSpells = m_oTableHelperClasses.GetValue("bPriestSpells")
    m_sProficiencies = m_oTableHelperClasses.GetValue("sProficiencies")
    m_nCritOn = m_oTableHelperClasses.GetValue("nCritOn")


    Call WriteProcStop(sRoutineName) ' "OBJECT")
    'Exit the sub... on an error we will jump over this function
    Exit Function
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount

End Function

Public Sub Save(dbDND As ADODB.Connection)

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".Save"
    Call WriteProcStart(sRoutineName) ' "OBJECT")


    m_oTableHelperClasses.SetValue("sClassName") = m_sClassName
    m_oTableHelperClasses.SetValue("sTHACO") = m_sTHACO
    m_oTableHelperClasses.SetValue("sSaves") = m_sSaves
    m_oTableHelperClasses.SetValue("sLevels") = m_sLevels
    m_oTableHelperClasses.SetValue("bMageSpells") = m_bMageSpells
    m_oTableHelperClasses.SetValue("bPriestSpells") = m_bPriestSpells
    m_oTableHelperClasses.SetValue("sProficiencies") = m_sProficiencies
    m_oTableHelperClasses.SetValue("nCritOn") = m_nCritOn
    m_nClassID = m_oTableHelperClasses.Save()


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Sub
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount

End Sub

Private Sub Class_Initialize()

    On Error GoTo ErrorHandler
    Dim sRoutineName As String
    sRoutineName = m_cNAME & ".Class_Initialize"
    Call WriteProcStart(sRoutineName)


    Call m_oTableHelperClasses.LoadSchema(g_oDB, "Classes")


    Call WriteProcStop(sRoutineName)
    'Exit the sub... on an error we will jump over this function
    Exit Sub
ErrorHandler:
    Call LogErrorToFile(sRoutineName & "." & Err.Description): Call g_oErrors.HandleErrorWithSource(Err, sRoutineName): Call g_oErrors.DisplayErrorCount

End Sub
