⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsuser.vb

📁 使用说明 1.在使用源程序前
💻 VB
字号:
Public Class ClsUser
    Private _UserName As String
    Private _Password As String
    Private _ModDepartment As String
    Private _ModEmployees As String
    Private _ModCheckIn As String
    Private _ModEvaluation As String
    Private _ModSalary As String
    Private _RealName As String
    Private _Memo As String

    Property UserName() As String
        Get
            Return _UserName
        End Get
        Set(ByVal value As String)
            _UserName = value
        End Set
    End Property
    Property Password() As String
        Get
            Return _Password
        End Get
        Set(ByVal value As String)
            _Password = value
        End Set
    End Property

    Property ModDepartment() As String
        Get
            Return _ModDepartment
        End Get
        Set(ByVal value As String)
            _ModDepartment = value
        End Set
    End Property
    Property ModEmployees() As String
        Get
            Return _ModEmployees
        End Get
        Set(ByVal value As String)
            _ModEmployees = value
        End Set
    End Property
    Property ModCheckIn() As String
        Get
            Return _ModCheckIn
        End Get
        Set(ByVal value As String)
            _ModCheckIn = value
        End Set
    End Property

    Property ModEvaluation() As String
        Get
            Return _ModEvaluation
        End Get
        Set(ByVal value As String)
            _ModEvaluation = value
        End Set
    End Property

    Property ModSarlary() As String
        Get
            Return _ModSalary
        End Get
        Set(ByVal value As String)
            _ModSalary = value
        End Set
    End Property


    Property RealName() As String
        Get
            Return _RealName

        End Get
        Set(ByVal value As String)
            _RealName = value
        End Set
    End Property

    Property Memo() As String
        Get
            Return _Memo
        End Get
        Set(ByVal value As String)
            _Memo = value
        End Set
    End Property
    Sub New(ByVal Name As String, ByVal PWD As String)
        _UserName = Name
        _Password = PWD
    End Sub

    Function LoginConfirm() As Boolean
        Dim SQLString As String
        Dim MSG As String
        SQLString = "SELECT * FROM tbUser WHERE UserName='" & _UserName & "' AND Password='" & _Password & "'"
        'SQL查询语句
        Dim UserTable As DataTable = ClsOperation.DBOperate(SQLString, MSG)
        If UserTable.Rows.Count = 0 Then    '判断用户是否存在
            MsgBox("输入用户名或密码有误,请重试", MsgBoxStyle.Exclamation, "信息框")
            Return False
        Else
            '判断用户密码是否正确 
            _RealName = UserTable.Rows(0)("RealName")
            _ModDepartment = UserTable.Rows(0)("ModDepartment")
            _ModEmployees = UserTable.Rows(0)("ModEmployees")
            _ModCheckIn = UserTable.Rows(0)("ModCheckIn")
            _ModEvaluation = UserTable.Rows(0)("ModEvaluation")
            _ModSalary = UserTable.Rows(0)("ModSalary")
            Return True
        End If
    End Function




    Sub DelUser(ByVal DeleteUserName As String)
        Dim SQLString As String
        Dim MSG As String
        SQLString = "DELETE FROM tbUser WHERE UserName ='" & DeleteUserName & "'"
        ClsOperation.DBOperate(SQLString, MSG)
    End Sub

    Function AddUser(ByVal User As ClsUser) As Boolean
        Dim SQLString As String
        Dim MSG As String
        SQLString = "SELECT * FROM tbUser WHERE UserName='" & User.UserName & "' AND Password='" & User.Password & "'"
        Dim UserTable As DataTable = ClsOperation.DBOperate(SQLString, MSG)
        If UserTable.Rows.Count >= 1 Then    '判断用户是否存在
            MsgBox("输入用户名已存在,请重试", MsgBoxStyle.Exclamation, "信息框")
            Return False
        Else
            SQLString = "INSERT INTO tbUser VALUES('" & User.UserName & "','" & User.Password & "','" & User.RealName & "','" & User.ModDepartment & "','" & User.ModCheckIn & "','" & User.ModEmployees & "','" & User.ModEvaluation & "','" & User.ModSarlary & "','" & User.Memo & "')"

            ClsOperation.DBOperate(SQLString, MSG)
            Return True
        End If
    End Function

    Shared Function AttachCode() As String '随机生成五位附加验证码A~Z
        Dim TempCode As String = ""
        Dim randomvalue As Integer
        Dim I As Integer
        Randomize()
        For I = 1 To 5
            randomvalue = CInt(Int((90 - 65 + 1) * Rnd() + 65))
            TempCode = TempCode + Chr(randomvalue)
        Next
        Return TempCode
    End Function
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -