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

Const m_modName As String = "FMSStore_DB.Product"
'Declare the DBHelper Object--see class initialization
Private m_dbh As DBHelper


Private Sub Class_Initialize()
    Set m_dbh = New FMStocks_DB.DBHelper
End Sub

Private Sub Class_Terminate()
    Set m_dbh = Nothing
End Sub

Public Function FindByDescription(ByVal description As String) As ADODB.Recordset
    On Error GoTo errorHandler
    
    Set FindByDescription = m_dbh.RunSPReturnRS("Product_FindByDescription", _
        Array(mp("@Description", adVarChar, 255, description)))
    
    Exit Function
    
errorHandler:
    
    RaiseError m_modName, "FindByDescription"
End Function

Public Function GetBySKU(ByVal SKU As Long) As ADODB.Recordset
    On Error GoTo errorHandler
    
    Set GetBySKU = m_dbh.RunSPReturnRS("Product_GetBySKU", _
        Array(mp("@SKU", adInteger, 4, SKU)))
        
    Exit Function
    
errorHandler:
    
    RaiseError m_modName, "GetBySKU"
End Function

Public Function List() As ADODB.Recordset
    On Error GoTo errorHandler
    
    Set List = m_dbh.RunSPReturnRS("Product_List")
        
    Exit Function
    
errorHandler:
    
    RaiseError m_modName, "List"
End Function

