Dim UserName As String = e.Form.Controls("UserName").Value
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
cmd.ConnectionName = "database"
If UserName = "" Then
Messagebox.show("请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
cmd.CommandText = "Select * From {Users} Where [Name] = '" & UserName & "'"
dt = cmd.ExecuteReader
If dt.DataRows.Count = 0 Then
Messagebox.show("此用户不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
dr = dt.DataRows(0)
If MD5Encrypt(e.Form.Controls("PassWord").Value) = dr("Password") Then
_UserName = UserName
_UserGroup = dr("Group")
'② 记录最后一次成功登陆Name_确定_Click
Dim yhm As WinForm.ComboBox = e.Form.Controls("UserName")
Dim mm As WinForm.TextBox = e.Form.Controls("PassWord")
SaveConfigValue("Name" & ComputerId,yhm.value) '② 记录最后一次成功登陆Name_确定_Click
e.Form.Close
Else
Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
''fxz 自定义用户与权限管理之一
'If _UserGroup = "经理" Then
'DataTables("工作日志").LoadFilter = ""
'Else
'DataTables("工作日志").LoadFilter = "创建者 = '" & _UserName & "'"
'End If
'DataTables("工作日志").Load()
'
''fxz 自定义用户与权限管理之一
'If _UserGroup = "经理" Then
'DataTables("室内设计项目").LoadFilter = ""
'Else
'DataTables("室内设计项目").LoadFilter = "项目参与人 like '%" & _UserName & "%'"
'End If
'DataTables("室内设计项目").Load()
'
'fxz 自定义用户与权限管理之一 培训管理窗口--这个窗口没有了,可删
'If _UserGroup = "经理" Or _UserGroup = "文员" Or _UserGroup = "项目管理办公室" Then
'DataTables("培训管理").LoadFilter = ""
'Else
''DataTables("培训管理").LoadFilter = "参与部门 = '" & _UserGroup & "' or 参与部门 like '%," & _UserGroup & "' or 参与部门 like '" & _UserGroup & ",%'"
'DataTables("培训管理").LoadFilter = "参与部门 like '%" & _UserGroup & "%'"
'End If
'DataTables("培训管理").Load()
'
If SystemMenu Then
Syscmd.Project.OpenUserMenu()
End If
''菜单权限表,只需下面2段代码
For Each rt As RibbonMenu.Tab In RibbonTabs
rt.Visible = True
rt.Enabled = True
For Each rg As RibbonMenu.Group In rt.Groups
rg.Visible = True
rg.Enabled = True
For Each itm As RibbonMenu.RibbonItem In rg.Items
itm.Visible = True
itm.Enabled = True
Next
Next
Next
For Each i As object In QAT.Items
i.visible = True
i.Enabled = True
Next
For Each i As object In ConfigBar.Items
i.visible = True
i.Enabled = True
Next
'For Each dr1 As DataRow In DataTables("菜单权限表").Select("用户分组 = '" & _UserGroup & "' and 用户名 = '" & _UserName & "'")
For Each dr1 As DataRow In DataTables("菜单权限表").Select("用户名 = '" & _UserName & "'")
If dr1("菜单分区")= "功能区" Then
If dr1.IsNull("分组名") Then
RibbonTabs(dr1("菜单名")).Visible = Not dr1("菜单不可见")
RibbonTabs(dr1("菜单名")).Enabled = Not dr1("菜单不可用")
ElseIf dr1.IsNull("按钮名") Then
RibbonTabs(dr1("菜单名")).Groups(dr1("分组名")).Visible = Not dr1("分组不可见")
RibbonTabs(dr1("菜单名")).Groups(dr1("分组名")).Enabled = Not dr1("分组不可用")
Else
RibbonTabs(dr1("菜单名")).Groups(dr1("分组名")).Items(dr1("按钮名")).Visible = Not dr1("按钮不可见")
RibbonTabs(dr1("菜单名")).Groups(dr1("分组名")).Items(dr1("按钮名")).Enabled = Not dr1("按钮不可用")
End If
End If
Next