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

📄 dbuser.vb

📁 Visual Basic 2005数据库通用模块开发与系统移植 物业管理信息系统
💻 VB
字号:
Public Class DBUser
    Private _UserName As String
    Private _Password As String
    Private _ModHouse As String
    Private _ModFee As String
    Private _ModRepair 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 ModHouse() As String
        Get
            Return _ModHouse
        End Get
        Set(ByVal value As String)
            _ModHouse = value
        End Set
    End Property
    Property ModFee() As String
        Get
            Return _ModFee
        End Get
        Set(ByVal value As String)
            _ModFee = value
        End Set
    End Property
    Property ModRepair() As String
        Get
            Return _ModRepair
        End Get
        Set(ByVal value As String)
            _ModRepair = 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 = DBOperation.DBOperate(SQLString, MSG)
        If UserTable.Rows.Count = 0 Then    '判断用户是否存在
            MsgBox("输入用户名或密码有误,请重试", MsgBoxStyle.Exclamation, "信息框")
            Return False
        Else
            '判断用户密码是否正确 
            _RealName = UserTable.Rows(0)("RealName")
            _ModHouse = UserTable.Rows(0)("ModHouse")
            _ModFee = UserTable.Rows(0)("ModFee")
            _ModRepair = UserTable.Rows(0)("ModRepair")
            Return True
        End If
    End Function


    Function PasswordModify(ByVal NewPassword As String) As Boolean
        Dim SQLString As String
        Dim MSG As String
        SQLString = "UPDATE tbUser SET [Password] ='" & NewPassword & "' WHERE UserName='" & _UserName & "'"
        DBOperation.DBOperate(SQLString, MSG)
    End Function

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

    Function AddUser(ByVal User As DBUser) 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 = DBOperation.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.ModHouse & "','" & User.ModFee & "','" & User.ModRepair & "','" & User.Memo & "')"
         
            DBOperation.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 + -