📄 frmyhgl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmYHGL
Caption = "用户管理"
ClientHeight = 5976
ClientLeft = 48
ClientTop = 336
ClientWidth = 8412
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5976
ScaleWidth = 8412
WindowState = 2 'Maximized
Begin VB.Frame Frame1
Caption = "详细资料"
Height = 2175
Left = 1200
TabIndex = 1
Top = 120
Width = 5775
Begin VB.CommandButton Command4
Caption = "保存"
Height = 315
Left = 3120
TabIndex = 14
Top = 720
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "修改"
Height = 315
Left = 4440
TabIndex = 13
Top = 240
Width = 1215
End
Begin VB.Frame Frame2
Caption = "权限设置"
Height = 855
Left = 120
TabIndex = 8
Top = 1200
Width = 5475
Begin VB.CheckBox Check4
Caption = "用户管理"
Height = 195
Left = 4200
TabIndex = 12
Top = 360
Width = 1035
End
Begin VB.CheckBox Check3
Caption = "业务管理"
Height = 195
Left = 2880
TabIndex = 11
Top = 360
Width = 1035
End
Begin VB.CheckBox Check2
Caption = "订单管理"
Height = 195
Left = 1560
TabIndex = 10
Top = 360
Width = 1035
End
Begin VB.CheckBox Check1
Caption = "酒店管理"
Height = 195
Left = 240
TabIndex = 9
Top = 360
Width = 1035
End
End
Begin VB.CommandButton Command3
Caption = "删除"
Height = 315
Left = 4440
TabIndex = 5
Top = 720
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 315
Left = 3120
TabIndex = 4
Top = 240
Width = 1215
End
Begin VB.TextBox Text2
Height = 315
IMEMode = 3 'DISABLE
Left = 1140
PasswordChar = "*"
TabIndex = 3
Top = 660
Width = 1815
End
Begin VB.TextBox Text1
Height = 270
Left = 1140
TabIndex = 2
Top = 300
Width = 1815
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "密码"
Height = 180
Left = 600
TabIndex = 7
Top = 780
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户名称"
Height = 180
Left = 240
TabIndex = 6
Top = 360
Width = 720
End
End
Begin MSAdodcLib.Adodc Adodc1
Align = 2 'Align Bottom
Height = 336
Left = 0
Top = 5640
Visible = 0 'False
Width = 8412
_ExtentX = 14838
_ExtentY = 593
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Align = 2 'Align Bottom
Height = 3192
Left = 0
TabIndex = 0
Top = 2448
Width = 8412
_ExtentX = 14838
_ExtentY = 5630
_Version = 393216
HeadLines = 1.4
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "用户列表"
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
MarqueeStyle = 3
AllowFocus = 0 'False
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Attribute VB_Name = "frmYHGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim exiting As Boolean
Private Sub Command1_Click()
If editing = False Then
editing = True
Text1.Text = ""
Text2.Text = ""
Check1.Value = False
Check2.Value = False
Check3.Value = False
Check4.Value = False
Command1.Caption = "放弃"
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = True
Else
If MsgBox("确定取消添加新记录?", vbQuestion + vbYesNo, "取消?") = vbYes Then
editing = False
Call DataGrid1_Click
End If
End If
End Sub
Private Sub Command2_Click()
If editing = False Then
editing = True
Command2.Caption = "放弃"
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = False
Command4.Enabled = True
Else
If MsgBox("确定取消修改当前记录?", vbQuestion + vbYesNo, "取消?") = vbYes Then
editing = False
Adodc1.Recordset.CancelBatch adAffectAllChapters
Call DataGrid1_Click
End If
End If
End Sub
Private Sub Command3_Click()
If MsgBox("确定删除当前记录?", vbQuestion + vbYesNo, "删除?") = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveLast
End If
End If
Call DataGrid1_Click
End If
End Sub
Private Sub Command4_Click()
Dim str As String
If Text1.Text = "" Then
MsgBox "请输入用户名!"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "请输入用户密码!"
Text2.SetFocus
Exit Sub
End If
If Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 Then
MsgBox "您没有为当前用户添加任何权限!", vbInformation + vbOKOnly, "用户管理"
Exit Sub
Else
str = "当前用户拥有的权限有:"
If Check1.Value = 1 Then
str = str & "酒店管理,"
End If
If Check2.Value = 1 Then
str = str & "订单管理,"
End If
If Check3.Value = 1 Then
str = str & "业务管理,"
End If
If Check4.Value = 1 Then
str = str & "用户管理,"
End If
str = str & "设定正确吗?"
If MsgBox(str, vbInformation + vbYesNo, "确定?") = vbNo Then
Exit Sub
End If
End If
If Command1.Enabled = True Then
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find "用户名称 = '" & Text1.Text & "'"
If Not Adodc1.Recordset.EOF Then
MsgBox "该用户名称已经存在!将取消添加。"
editing = False
Call DataGrid1_Click
Exit Sub
End If
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset(1) = Text1.Text
Adodc1.Recordset(2) = Text2.Text
Adodc1.Recordset(3) = Check1.Value
Adodc1.Recordset(4) = Check2.Value
Adodc1.Recordset(5) = Check3.Value
Adodc1.Recordset(6) = Check4.Value
Adodc1.Recordset.UpdateBatch adAffectAllChapters
Else
Adodc1.Recordset(1) = Text1.Text
Adodc1.Recordset(2) = Text2.Text
Adodc1.Recordset(3) = Check1.Value
Adodc1.Recordset(4) = Check2.Value
Adodc1.Recordset(5) = Check3.Value
Adodc1.Recordset(6) = Check4.Value
Adodc1.Recordset.UpdateBatch adAffectAllChapters
End If
editing = False
Call DataGrid1_Click
End Sub
Private Sub DataGrid1_Click()
If editing = False Then
Command1.Caption = "添加"
Command1.Enabled = True
If Adodc1.Recordset.RecordCount <> 0 Then
Command2.Caption = "修改"
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = False
Text1.Text = Adodc1.Recordset(1)
Text2.Text = Adodc1.Recordset(2)
Check1.Value = Adodc1.Recordset(3)
Check2.Value = Adodc1.Recordset(4)
Check3.Value = Adodc1.Recordset(5)
Check4.Value = Adodc1.Recordset(6)
Else
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
End If
End If
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = constr
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "用户表"
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
DataGrid1.ReBind
editing = False
Call DataGrid1_Click
End Sub
Private Sub Form_Resize()
If Me.WindowState = 1 Then
Exit Sub
End If
With Frame1
.Left = (Me.Width - Frame1.Width) / 2
.Top = 120
End With
DataGrid1.Height = Me.Height - Frame1.Height - Adodc1.Height - 200
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -