Option Explicit

' Module Name: clsUser.cls
' This module was created with 'COM-Gen 2000' R1
' ©1999 Q&D Software Development
' http://www.q-d.com
'=========================================================================
' This module was created using a copy of COM-Gen 2000
' licensed to a single user.  Although the code generated by this
' licensed copy of COM-Gen 2000 can be used anywhere,
' the COM-Gen 2000 program itself may only be used on a single
' machine, by a single user, according to the License you purchased.
'=========================================================================

Public mbLoading As Boolean
Private mvarUser_id As Variant
Private mvarUser_id_ReadBuf As Variant
Private mvarUser_type_cd As Variant
Private mvarUser_type_cd_ReadBuf As Variant
Private mvarUser_login_name As Variant
Private mvarUser_login_name_ReadBuf As Variant
Private mvarUser_login_password As Variant
Private mvarUser_login_password_ReadBuf As Variant
Private mvarUser_created_by As Variant
Private mvarUser_created_by_ReadBuf As Variant
Private mvarUser_created_dt As Variant
Private mvarUser_created_dt_ReadBuf As Variant
Private mvarUser_updated_by As Variant
Private mvarUser_updated_by_ReadBuf As Variant
Private mvarUser_updated_dt As Variant
Private mvarUser_updated_dt_ReadBuf As Variant

'=========================================================================
' Procedure Name: Property Let User_id ()
' Purpose: Assigns a value to the User_id property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Let User_id(ByVal vData As Variant)
On Error GoTo User_idErr

    If IsNull(vData) Then
        Err.Raise 94, "frmFields.User_id", "Invalid use of Null"
    ElseIf Not IsNumeric(vData) Then
        Err.Raise 13, "frmFields.User_id", "Type Mismatch"
    End If
    mvarUser_id = vData
    If mbLoading Then
        mvarUser_id_ReadBuf = vData
    End If

    Exit Property

User_idErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_id)", Err.Description

End Property

'=========================================================================
' Procedure Name: Property Get User_id ()
' Purpose: Reads the value of the User_id property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Get User_id() As Variant
On Error GoTo User_idErr

    User_id = mvarUser_id

    Exit Property

User_idErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_id)", Err.Description

End Property


'=========================================================================
' Procedure Name: Property Let User_type_cd ()
' Purpose: Assigns a value to the User_type_cd property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Let User_type_cd(ByVal vData As Variant)
On Error GoTo User_type_cdErr

    If IsNull(vData) Then
        Err.Raise 94, "frmFields.User_type_cd", "Invalid use of Null"
    ElseIf Not IsNumeric(vData) Then
        Err.Raise 13, "frmFields.User_type_cd", "Type Mismatch"
    End If
    mvarUser_type_cd = vData
    If mbLoading Then
        mvarUser_type_cd_ReadBuf = vData
    End If

    Exit Property

User_type_cdErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_type_cd)", Err.Description

End Property

'=========================================================================
' Procedure Name: Property Get User_type_cd ()
' Purpose: Reads the value of the User_type_cd property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Get User_type_cd() As Variant
On Error GoTo User_type_cdErr

    User_type_cd = mvarUser_type_cd

    Exit Property

User_type_cdErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_type_cd)", Err.Description

End Property


'=========================================================================
' Procedure Name: Property Let User_login_name ()
' Purpose: Assigns a value to the User_login_name property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Let User_login_name(ByVal vData As Variant)
On Error GoTo User_login_nameErr

    If IsNull(vData) Then
        Err.Raise 94, "frmFields.User_login_name", "Invalid use of Null"
    End If
    mvarUser_login_name = vData
    If mbLoading Then
        mvarUser_login_name_ReadBuf = vData
    End If

    Exit Property

User_login_nameErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_login_name)", Err.Description

End Property

'=========================================================================
' Procedure Name: Property Get User_login_name ()
' Purpose: Reads the value of the User_login_name property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Get User_login_name() As Variant
On Error GoTo User_login_nameErr

    User_login_name = mvarUser_login_name

    Exit Property

User_login_nameErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_login_name)", Err.Description

End Property


'=========================================================================
' Procedure Name: Property Let User_login_password ()
' Purpose: Assigns a value to the User_login_password property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Let User_login_password(ByVal vData As Variant)
On Error GoTo User_login_passwordErr

    If IsNull(vData) Then
        Err.Raise 94, "frmFields.User_login_password", "Invalid use of Null"
    End If
    mvarUser_login_password = vData
    If mbLoading Then
        mvarUser_login_password_ReadBuf = vData
    End If

    Exit Property

User_login_passwordErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_login_password)", Err.Description

End Property

'=========================================================================
' Procedure Name: Property Get User_login_password ()
' Purpose: Reads the value of the User_login_password property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Get User_login_password() As Variant
On Error GoTo User_login_passwordErr

    User_login_password = mvarUser_login_password

    Exit Property

User_login_passwordErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_login_password)", Err.Description

End Property


'=========================================================================
' Procedure Name: Property Let User_created_by ()
' Purpose: Assigns a value to the User_created_by property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Let User_created_by(ByVal vData As Variant)
On Error GoTo User_created_byErr

    If IsNull(vData) Then
        Err.Raise 94, "frmFields.User_created_by", "Invalid use of Null"
    End If
    mvarUser_created_by = vData
    If mbLoading Then
        mvarUser_created_by_ReadBuf = vData
    End If

    Exit Property

User_created_byErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_created_by)", Err.Description

End Property

'=========================================================================
' Procedure Name: Property Get User_created_by ()
' Purpose: Reads the value of the User_created_by property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Get User_created_by() As Variant
On Error GoTo User_created_byErr

    User_created_by = mvarUser_created_by

    Exit Property

User_created_byErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_created_by)", Err.Description

End Property


'=========================================================================
' Procedure Name: Property Let User_created_dt ()
' Purpose: Assigns a value to the User_created_dt property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Let User_created_dt(ByVal vData As Variant)
On Error GoTo User_created_dtErr

    If IsNull(vData) Then
        Err.Raise 94, "frmFields.User_created_dt", "Invalid use of Null"
    ElseIf Not IsDate(vData) Then
        Err.Raise 13, "frmFields.User_created_dt", "Type Mismatch"
    End If
    mvarUser_created_dt = vData
    If mbLoading Then
        mvarUser_created_dt_ReadBuf = vData
    End If

    Exit Property

User_created_dtErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_created_dt)", Err.Description

End Property

'=========================================================================
' Procedure Name: Property Get User_created_dt ()
' Purpose: Reads the value of the User_created_dt property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Get User_created_dt() As Variant
On Error GoTo User_created_dtErr

    User_created_dt = mvarUser_created_dt

    Exit Property

User_created_dtErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_created_dt)", Err.Description

End Property


'=========================================================================
' Procedure Name: Property Let User_updated_by ()
' Purpose: Assigns a value to the User_updated_by property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Let User_updated_by(ByVal vData As Variant)
On Error GoTo User_updated_byErr

    If IsNull(vData) Then
        Err.Raise 94, "frmFields.User_updated_by", "Invalid use of Null"
    End If
    mvarUser_updated_by = vData
    If mbLoading Then
        mvarUser_updated_by_ReadBuf = vData
    End If

    Exit Property

User_updated_byErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_updated_by)", Err.Description

End Property

'=========================================================================
' Procedure Name: Property Get User_updated_by ()
' Purpose: Reads the value of the User_updated_by property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Get User_updated_by() As Variant
On Error GoTo User_updated_byErr

    User_updated_by = mvarUser_updated_by

    Exit Property

User_updated_byErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_updated_by)", Err.Description

End Property


'=========================================================================
' Procedure Name: Property Let User_updated_dt ()
' Purpose: Assigns a value to the User_updated_dt property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Let User_updated_dt(ByVal vData As Variant)
On Error GoTo User_updated_dtErr

    If IsNull(vData) Then
        Err.Raise 94, "frmFields.User_updated_dt", "Invalid use of Null"
    ElseIf Not IsDate(vData) Then
        Err.Raise 13, "frmFields.User_updated_dt", "Type Mismatch"
    End If
    mvarUser_updated_dt = vData
    If mbLoading Then
        mvarUser_updated_dt_ReadBuf = vData
    End If

    Exit Property

User_updated_dtErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_updated_dt)", Err.Description

End Property

'=========================================================================
' Procedure Name: Property Get User_updated_dt ()
' Purpose: Reads the value of the User_updated_dt property of the
'          clsUser object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
'=========================================================================
Public Property Get User_updated_dt() As Variant
On Error GoTo User_updated_dtErr

    User_updated_dt = mvarUser_updated_dt

    Exit Property

User_updated_dtErr:
    RaiseError Err.Number, Err.Source & " (clsUser.User_updated_dt)", Err.Description

End Property

'=========================================================================
' Procedure Name: Update()
' Purpose: Updates the record in the user table
'          which corresponds to the current clsUser
'          object.
' Created 8/26/99 7:37:27 AM by 'COM-Gen 2000'
' Revision History:
'
' [Developer Notes from 'COM-Gen 2000']
'      This method uses the Primary Key fields you chose for the
'      user table to uniquely identify the record to be
'      updated by this method.  The Primary Key fields you chose are:
'
'      user_id
'
'      This method is used to update a record in the
'      user table. To call this method from an ASP page:
'
'          Set loUser = Server.CreateObject(".clsUser")
'          Set loUserColl = Server.CreateObject(".clsUserColl")
'
'          loUserColl.Refresh
'          For Each loUser In loUserColl
'              loUser.User_type_cd = 
'              loUser.User_login_name = 
'              loUser.User_login_password = 
'              loUser.User_created_by = 
'              loUser.User_created_dt = 
'              loUser.User_updated_by = 
'              loUser.User_updated_dt = 
'              If Not loUser.Update() Then
'                  'Insert code to execute if update fails
'              End If
'          Next
'
'      To call this method from VB:
'
'          Dim loUser As New [Your Library Name.]clsUser
'          Dim loUserColl As New [Your Library Name.]clsUserColl
'
'          loUserColl.Refresh
'
'          For Each loUser In loUserColl
'              loUser.User_type_cd = 
'              loUser.User_login_name = 
'              loUser.User_login_password = 
'              loUser.User_created_by = 
'              loUser.User_created_dt = 
'              loUser.User_updated_by = 
'              loUser.User_updated_dt = 
'              If Not loUser.Update() Then
'                  'Insert code to execute if update fails
'              End If
'          Next
'
'=========================================================================
Public Function Update() As Boolean
On Error GoTo UpdateErr
Dim lsSQL As String
Dim loConn As New clsCG2KConn



    lsSQL = "UPDATE user SET "
    If User_type_cd <> "" Then
        lsSQL = lsSQL & "user_type_cd = " & User_type_cd & ", "
    End If
    If User_login_name <> "" Then
        lsSQL = lsSQL & "user_login_name = '" & Replace(User_login_name, "'", "''") & "'" & ", "
    End If
    If User_login_password <> "" Then
        lsSQL = lsSQL & "user_login_password = '" & Replace(User_login_password, "'", "''") & "'" & ", "
    End If
    If User_created_by <> "" Then
        lsSQL = lsSQL & "user_created_by = '" & Replace(User_created_by, "'", "''") & "'" & ", "
    End If
    If User_created_dt <> "" Then
        lsSQL = lsSQL & "user_created_dt = #" & User_created_dt & "#" & ", "
    End If
    If User_updated_by <> "" Then
        lsSQL = lsSQL & "user_updated_by = '" & Replace(User_updated_by, "'", "''") & "'" & ", "
    End If
    If User_updated_dt <> "" Then
        lsSQL = lsSQL & "user_updated_dt = #" & User_updated_dt & "#" & ", "
    End If
    lsSQL = Left(lsSQL, Len(lsSQL) - 2) & " "
    lsSQL = lsSQL & " WHERE 1 = 1 "
    lsSQL = lsSQL & "AND user_id = " & mvarUser_id_ReadBuf & " "

    Update = loConn.ExecActionSQL(lsSQL)

    Exit Function

UpdateErr:
    RaiseError Err.Number, Err.Source & " (clsUser.Update)", Err.Description

End Function