VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Position"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Const m_modName As String = "FMStocks_DB.Position"
Private m_dbh As DBHelper

Private Sub Class_Initialize()
    'must call CreateObject or COM+ will
    'not call IObjectConstructor inferface that DBHelper needs
    Set m_dbh = CreateObject("FMStocks_DB.DBHelper")
End Sub
Private Sub Class_Terminate()
    Set m_dbh = Nothing
End Sub
Public Function ListForAdjustment(ByVal AccountID As Long, ByVal Ticker As String) As ADODB.Recordset
    On Error GoTo errorHandler
    Set ListForAdjustment = m_dbh.RunSPReturnRS_RW("Position_ListForAdjustment", Array( _
        mp("@AccountID", adInteger, 4, AccountID), _
        mp("@Ticker", adVarChar, 15, Ticker)))
    
    Exit Function
    
errorHandler:
    
    RaiseError m_modName, "ListForAdjustment(" & AccountID & "," & Ticker & ")"
End Function


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


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


