Public Class User

    Private myUsername As String
    Private myPassword As String
    Public Event DBError(ByVal message As String)

    Public Property Username() As String
        Get
            Return myUsername
        End Get
        Set(ByVal value As String)
            myUsername = value
        End Set
    End Property

    Public Property Password() As String
        Get
            Return myPassword
        End Get
        Set(ByVal value As String)
            myPassword = value
        End Set
    End Property

    Public Function Exists(ByVal usernm As String) As Boolean
        If UsersTableAdapter.Exists(usernm) > 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    Public Function Item(ByVal usernm As String)
        Dim tblTemp As DataTable
        tblTemp = UsersTableAdapter.Find(usernm)
        Dim drwTemp As DataRow
        drwTemp = tblTemp.Rows.Find(usernm)
        Me.Username = drwTemp("Username")
        Me.Password = drwTemp("Password")
    End Function

    Public Function CheckLogin(ByVal usernm As String, ByVal pass As String) As Boolean
        If UsersTableAdapter.CheckLogin(usernm, pass) > 0 Then
            Return True
        Else
            Return False
        End If
    End Function
End Class
