📄 loginuser.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "LoginUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Description = "这个类代表了登录的用户"
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
Private mvarUserName As String
Private mvarLogTime As Date
Private mvarUserPassword As String
Private mvarUserType As LogType
Private mvarLogFail As Boolean
Public Property Let UserType(ByVal vData As LogType)
mvarUserType = vData
End Property
Public Property Get UserType() As LogType
UserType = mvarUserType
End Property
Public Property Let UserPassword(ByVal vData As String)
mvarUserPassword = vData
End Property
Public Property Get UserPassword() As String
UserPassword = mvarUserPassword
End Property
Public Property Let LogTime(ByVal vData As Date)
mvarLogTime = vData
End Property
Public Property Get LogTime() As Date
LogTime = mvarLogTime
End Property
Public Property Let UserName(ByVal vData As String)
mvarUserName = vData
End Property
Public Property Get UserName() As String
Attribute UserName.VB_UserMemId = 0
UserName = mvarUserName
End Property
Public Property Let LogFail(ByVal vData As Boolean)
mvarLogFail = vData
End Property
Public Property Get LogFail() As Boolean
LogFail = mvarLogFail
End Property
Public Function Log(ByVal uName As String, ByVal uPass As String, ByVal uType As LogType) As Boolean
Dim SQLstring As String
If uName = "" Then
LogFail = True
Log = LogFail
Exit Function
End If
If uPass = "" Then
LogFail = True
Log = LogFail
Exit Function
End If
If uType <> student And uType <> administrator Then
LogFail = True
Log = LogFail
Exit Function
End If
Select Case uType
Case student
DataEnv.rsStuTable.Open
DataEnv.rsStuTable.Filter = "studentName = '" & uName & "' And studentID = '" & uPass & "'"
If DataEnv.rsStuTable.RecordCount > 0 Then
LogFail = False
End If
DataEnv.rsStuTable.Filter = ""
DataEnv.rsStuTable.Close
Case administrator
DataEnv.rsAdmTable.Open
DataEnv.rsAdmTable.Filter = "AdministratorName = '" & uName & "' And AdministratorPassword = '" & uPass & "'"
If DataEnv.rsAdmTable.RecordCount > 0 Then
LogFail = False
End If
DataEnv.rsAdmTable.Filter = ""
DataEnv.rsAdmTable.Close
End Select
UserName = uName
UserPassword = uPass
UserType = uType
End Function '考生或管理员登录
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -