📄 frmareaman.frm
字号:
VERSION 5.00
Begin VB.Form FrmAreaMan
BorderStyle = 1 'Fixed Single
Caption = "地域信息管理"
ClientHeight = 2820
ClientLeft = 45
ClientTop = 345
ClientWidth = 5520
Icon = "FrmAreaMan.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2820
ScaleWidth = 5520
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_Add
Caption = "添 加"
Default = -1 'True
Height = 400
Left = 2280
MouseIcon = "FrmAreaMan.frx":0442
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 9
Top = 1200
Width = 1300
End
Begin VB.CommandButton Cmd_Modi
Caption = "修 改"
Height = 400
Left = 3840
MouseIcon = "FrmAreaMan.frx":074C
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 8
Top = 1200
Width = 1300
End
Begin VB.CommandButton Cmd_Del
Caption = "删 除"
Height = 400
Left = 2280
MouseIcon = "FrmAreaMan.frx":0A56
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 7
Top = 1920
Width = 1300
End
Begin VB.CommandButton Cmd_Close
Cancel = -1 'True
Caption = "关 闭"
Height = 400
Left = 3840
MouseIcon = "FrmAreaMan.frx":0D60
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 6
Top = 1920
Width = 1300
End
Begin VB.Frame Frame1
Height = 735
Left = 240
TabIndex = 1
Top = 120
Width = 5055
Begin VB.OptionButton Option3
Caption = "国外"
Height = 375
Left = 3675
TabIndex = 2
Top = 240
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "本市"
Height = 375
Left = 1320
TabIndex = 4
Top = 240
Value = -1 'True
Width = 1215
End
Begin VB.OptionButton Option2
Caption = "外埠"
Height = 375
Left = 2520
TabIndex = 3
Top = 240
Width = 1215
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H0000FFFF&
BackStyle = 0 'Transparent
Caption = "地域类型:"
Height = 180
Left = 120
TabIndex = 5
Top = 330
Width = 810
End
End
Begin VB.ListBox List1
Height = 1680
Left = 240
TabIndex = 0
Top = 960
Width = 1695
End
End
Attribute VB_Name = "FrmAreaMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public CurAreaId As Long
Public CurType As Integer
Private Sub Loadarea()
Dim i As Integer
List1.Clear
MyArea.Load_Area
'本市地域
If Option1.Value = True Then
Do While d1(i) <> ""
List1.AddItem d1(i) '把本市地域添加到List1列表框中
i = i + 1
Loop
End If
'外埠地域
If Option2.Value = True Then
Do While d2(i) <> ""
List1.AddItem d2(i) '把外埠地域添加到List1列表框中
i = i + 1
Loop
End If
'国外地域
If Option3.Value = True Then
Do While d3(i) <> ""
List1.AddItem d3(i) '把国外地域添加到List1列表框中
i = i + 1
Loop
End If
End Sub
Private Function DeleteCheck(ByVal TmpId As Long) As Integer
Dim TmpName As String
'旅游娱乐厅资源地域数据检查
TmpName = MyPlace.AreaInPlace(CurAreaId)
If TmpName <> "" Then
DeleteCheck = -1
MsgBox "当前地域信息在娱乐厅 - " + TmpName + " - 中使用,为保证数据的完整性,不允许删除此地域。"
Exit Function
End If
'旅游宾馆资源地域数据检查
TmpName = MyHotel.AreaInHotel(CurAreaId)
If TmpName <> "" Then
DeleteCheck = -1
MsgBox "当前地域信息在宾馆 - " + TmpName + " - 中使用,为保证数据的完整性,不允许删除此地域。"
Exit Function
End If
'旅游用餐资源地域数据检查
TmpName = MyRes.AreaInRes(CurAreaId)
If TmpName <> "" Then
DeleteCheck = -1
MsgBox "当前地域信息在餐厅 - " + TmpName + " - 中使用,为保证数据的完整性,不允许删除此地域。"
Exit Function
End If
'旅游娱乐资源地域数据检查
TmpName = MyAmuse.AreaInAmuse(CurAreaId)
If TmpName <> "" Then
DeleteCheck = -1
MsgBox "当前地域信息在娱乐厅 - " + TmpName + " - 中使用,为保证数据的完整性,不允许删除此地域。"
Exit Function
End If
'旅游线路地域数据检查
TmpName = MyLine.AreaInLine(CurAreaId)
If TmpName <> "" Then
DeleteCheck = -1
MsgBox "当前地域信息 -在线路- " + TmpName + " - 中使用,为保证数据的完整性,不允许删除此地域。"
Exit Function
End If
'通过检查,可以删除当前地域
DeleteCheck = 0
End Function
Private Sub Cmd_Add_Click()
'添加本市地域
If Option1.Value = True Then
FrmAreaEdit.CurType = 1
FrmAreaEdit.lblAreaType = "本市"
End If
'添加外埠地域
If Option2.Value = True Then
FrmAreaEdit.CurType = 2
FrmAreaEdit.lblAreaType = "外埠"
End If
'添加国外地域
If Option3.Value = True Then
FrmAreaEdit.CurType = 3
FrmAreaEdit.lblAreaType = "国外"
End If
'将变量Modify设置设置为False,表示插入新数据
FrmAreaEdit.Modify = False
FrmAreaEdit.OriAreaName = ""
FrmAreaEdit.OriId = 0
'启动编辑地域信息的对话框
FrmAreaEdit.Show 1
'添加完成后,重新装入地域数据
Loadarea
End Sub
Private Sub Cmd_Close_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
'判断是否选择了要删除的地域
If List1.ListIndex < 0 Then
MsgBox "请选择要删除的地域"
Exit Sub
End If
'调用DeleteCheck()函数,判断选择的地域是否可以删除
If DeleteCheck(CurAreaId) = -1 Then
Exit Sub
End If
'询问是否可以删除地域
If MsgBox("是否删除当前地域?", vbYesNo, "请确认") = vbYes Then
MyArea.Delete (CurAreaId)
Loadarea
End If
End Sub
Private Sub Cmd_Modi_Click()
'判断是否选择了要修改的地域
If List1.ListIndex < 0 Then
MsgBox "请选择要修改的地域"
Exit Sub
End If
'修改本市地域
If Option1.Value = True Then
FrmAreaEdit.CurType = 1
FrmAreaEdit.lblAreaType = "本市"
End If
'修改外埠地域
If Option2.Value = True Then
FrmAreaEdit.CurType = 2
FrmAreaEdit.lblAreaType = "外埠"
End If
'修改国外地域
If Option3.Value = True Then
FrmAreaEdit.CurType = 3
FrmAreaEdit.lblAreaType = "国外"
End If
'将变量Modify设置设置为False,表示插入新数据
FrmAreaEdit.Modify = True
'设置全局变量
FrmAreaEdit.OriAreaName = List1.Text
FrmAreaEdit.txtAreaName = List1.Text
FrmAreaEdit.OriId = CurAreaId
'启动编辑地域信息的窗体
FrmAreaEdit.Show 1
'修改后重新装入地域数据
Loadarea
End Sub
Private Sub Form_Load()
'将当前地域类型设置为“本市”
Option1.Value = True
'装入数据
Loadarea
End Sub
Private Sub List1_click()
If List1.ListIndex < 0 Then
Exit Sub
End If
CurAreaId = MyArea.GetId(MakeStr(List1.Text))
End Sub
Private Sub Option1_Click()
Loadarea
End Sub
Private Sub Option2_Click()
Loadarea
End Sub
Private Sub Option3_Click()
Loadarea
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -