📄 frmmain.vb
字号:
menuEngageOrder_Click(Nothing, Nothing)
Case "酒宴服务"
If modOrder = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuEngageSvc_Click(Nothing, Nothing)
Case "外卖订单"
If modSend = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuExpandOrder_Click(Nothing, Nothing)
Case "送货服务"
If modSend = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuTransSvc_Click(Nothing, Nothing)
Case "员工管理"
If modEmployee = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuClerk_Click(Nothing, Nothing)
End Select
End If
End Sub
Private Sub menuEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuEmail.Click
System.Diagnostics.Process.Start("mailto:huangzhichao01@tsinghua.org.cn")
End Sub
Private Sub menuHelpContent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuHelpContent.Click
MsgBox("对不起,没有相关帮助内容,请参阅本书附录一自己制作帮助文件。", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "暂无帮助内容")
End Sub
Private Sub menuSupport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuSupport.Click
System.Diagnostics.Process.Start("http://www.chinaspx.com")
End Sub
Private Sub frmMain_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
menuExit.PerformClick()
e.Cancel = True
End Sub
Private Sub menuAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuAbout.Click
Dim frmAbout As New frmAboutMe
frmAbout.ShowDialog(Me)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ResolveLogonInfo()
Authority()
StatusBar()
Me.StatusTimer.Enabled = True
Me.StatusBarPanel3.Text = UserName
End Sub
Public Function Authority()
If pepdom = 0 Or 1 Then
menuSystem.Enabled = True
Else
menuSystem.Enabled = False
End If
menuMMenu.Enabled = CBool(pepdom)
menuResources.Enabled = CBool(pepdom)
menuCustomerManager.Enabled = CBool(pepdom)
menuDBBackup.Enabled = Not CBool(pepdom)
menuDBShrink.Enabled = Not CBool(pepdom)
menuDBRestr.Enabled = Not CBool(pepdom)
menuForeSvc.Enabled = modServer
menuOrderSvc.Enabled = modOrder
menuExpandSvc.Enabled = modSend
menuEmployee.Enabled = modEmployee
menuChkBill.Enabled = modBill
menuMMenu.Enabled = modServer
End Function
Private Sub menuUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuUser.Click
Dim frmUsers As New frmUserManager
If Not OpenOnce(frmUsers) Then
frmUsers.MdiParent = Me
frmUsers.Show()
End If
End Sub
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
If modServer = False Then
If e.Node.Text = "前台营业管理" Then
MsgBox("对不起,你没有这个权限管理该模块。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无权限访问")
e.Node.Collapse()
Exit Sub
End If
End If
If modOrder = False Then
If e.Node.Text = "预定酒宴服务" Then
MsgBox("对不起,你没有这个权限管理该模块。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无权限访问")
e.Node.Collapse()
Exit Sub
End If
End If
If modSend = False Then
If e.Node.Text = "扩展外卖服务" Then
MsgBox("对不起,你没有这个权限管理该模块。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无权限访问")
e.Node.Collapse()
Exit Sub
End If
End If
If modEmployee = False Then
If e.Node.Text = "员工管理" Then
MsgBox("对不起,你没有这个权限管理该模块。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无权限访问")
e.Node.Collapse()
Exit Sub
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
If Me.Button1.ImageIndex = 1 Then
Me.Button1.ImageIndex = 2
Me.PanelTimer.Enabled = False
Else
Me.Button1.ImageIndex = 1
Me.PanelTimer.Enabled = True
End If
End Sub
Private Sub StatusTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusTimer.Tick
Dim WeekdayName As String
Me.StatusBarPanel4.Text = Now.ToLongTimeString
Select Case Now.DayOfWeek
Case DayOfWeek.Sunday
WeekdayName = "星期天"
Case DayOfWeek.Monday
WeekdayName = "星期一"
Case DayOfWeek.Tuesday
WeekdayName = "星期二"
Case DayOfWeek.Wednesday
WeekdayName = "星期三"
Case DayOfWeek.Thursday
WeekdayName = "星期四"
Case DayOfWeek.Friday
WeekdayName = "星期五"
Case DayOfWeek.Saturday
WeekdayName = "星期六"
End Select
Me.StatusBarPanel4.ToolTipText = _
Now.ToLongDateString & " , " & WeekdayName
If Me.MdiChildren.GetLength(0) = 0 Then
Me.menuClsAll.Enabled = False
Else
Me.menuClsAll.Enabled = True
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PanelTimer.Tick
Dim CursorPos As System.Drawing.Point
CursorPos = Cursor.Position
Dim disX As Integer
disX = CursorPos.X - Me.Panel1.Left
If Math.Abs(disX) < Me.Panel1.Width + 10 Then
If Me.Panel1.Width < 220 Then
Me.Panel1.Width += 20
End If
Else
If Me.Panel1.Width > 15 Then
Me.Panel1.Width -= 20
End If
End If
End Sub
Private Sub menuDie_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles menuDie.Click
Me.LayoutMdi(MdiLayout.Cascade)
End Sub
Private Sub menuHorizon_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles menuHorizon.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private Sub menuVertify_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles menuVertify.Click
Me.LayoutMdi(MdiLayout.TileVertical)
End Sub
Private Sub menuClsAll_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles menuClsAll.Click
Dim frmChild As Form
For Each frmChild In Me.MdiChildren
frmChild.Close()
Next
End Sub
Private Sub menuMMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuMMenu.Click
Dim frmMenus As New frmMenuManager
If OpenOnce(frmMenus) = False Then
frmMenus.MdiParent = Me
frmMenus.Show()
End If
End Sub
Private Sub menuDBShrink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuDBShrink.Click
If AccessToDatabase.ShrinkDataBase(True) Then
MsgBox("漂亮,您成功的压缩了数据库,并截断了数据库日志文件。", MsgBoxStyle.OKOnly + MsgBoxStyle.Information, "压缩数据库成功")
Else
MsgBox("怎么回事呢,居然没能压缩数据库?", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "压缩数据库失败")
End If
End Sub
Private Sub menuDBBckup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuDBBackup.Click
Dim SaveDataBaseFileDialog As New SaveFileDialog
Dim mFilePath As String = String.Empty
With SaveDataBaseFileDialog
.Title = "Backup DataBase File"
.RestoreDirectory = True
.CreatePrompt = True
.Filter = "DataBase Suported files(*.mdf,*.mdb)|*.mdf||*mdb"
.ShowDialog()
mFilePath = .FileName
End With
If mFilePath = String.Empty Then
Return
End If
If AccessToDatabase.BackupDataBase(mFilePath) Then
MsgBox("干得真漂亮,数据库备份完成。", MsgBoxStyle.OKOnly + MsgBoxStyle.Information, "备份数据库成功")
Else
MsgBox("", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "备份数据库失败")
End If
End Sub
Private Sub menuDBRestr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuDBRestr.Click
Dim OpenDataBaseFileDialog As New OpenFileDialog
Dim mFilePath As String = String.Empty
With OpenDataBaseFileDialog
.Title = "Backup DataBase File"
.RestoreDirectory = True
.CheckFileExists = True
.Filter = "DataBase Suported files(*.mdf,*.mdb)|*.mdf|mdb files(*.mdb)|*mdb"
.ShowDialog()
mFilePath = .FileName
End With
If mFilePath = String.Empty Then
Return
End If
If AccessToDatabase.RestoreDataBase(mFilePath) Then
MsgBox("好,您成功的从备份的数据库还原了。", MsgBoxStyle.OKOnly + MsgBoxStyle.Information, "还原数据库成功")
Else
MsgBox("嗯,再好好想想,怎么没能还原哪。", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "还原数据库失败")
End If
End Sub
Private Sub menuResources_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuResources.Click
Dim frmResources As New frmResourceManage
If OpenOnce(frmResources) = False Then
frmResources.MdiParent = Me
frmResources.Show()
End If
End Sub
Private Sub menuCustomerManager_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuCustomerManager.Click
Dim frmCustomer As New frmCustomerManager
If OpenOnce(frmCustomer) = False Then
frmCustomer.MdiParent = Me
frmCustomer.Show()
End If
End Sub
End Class
End Namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -