📄 resource.vb
字号:
Me.Button3.Text = "添置"
'
'Button4
'
Me.Button4.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.Button4.Location = New System.Drawing.Point(200, 16)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(56, 24)
Me.Button4.TabIndex = 3
Me.Button4.Text = "丢弃"
'
'Button5
'
Me.Button5.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.Button5.Location = New System.Drawing.Point(136, 16)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(56, 24)
Me.Button5.TabIndex = 4
Me.Button5.Text = "修好"
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(24, 80)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(72, 21)
Me.Label5.TabIndex = 5
Me.Label5.Text = "容纳人数"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'NumericUpDown3
'
Me.NumericUpDown3.Location = New System.Drawing.Point(120, 80)
Me.NumericUpDown3.Maximum = New Decimal(New Integer() {20, 0, 0, 0})
Me.NumericUpDown3.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
Me.NumericUpDown3.Name = "NumericUpDown3"
Me.NumericUpDown3.Size = New System.Drawing.Size(144, 21)
Me.NumericUpDown3.TabIndex = 6
Me.NumericUpDown3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
Me.NumericUpDown3.Value = New Decimal(New Integer() {1, 0, 0, 0})
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(24, 120)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(80, 21)
Me.Label7.TabIndex = 8
Me.Label7.Text = "所在房间号"
Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(120, 120)
Me.TextBox3.MaxLength = 2
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(144, 21)
Me.TextBox3.TabIndex = 9
Me.TextBox3.Text = ""
'
'Button6
'
Me.Button6.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.Button6.Location = New System.Drawing.Point(72, 16)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(56, 24)
Me.Button6.TabIndex = 11
Me.Button6.Text = "修理"
'
'GroupBox4
'
Me.GroupBox4.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button5, Me.Button6, Me.Button4, Me.Button3})
Me.GroupBox4.Location = New System.Drawing.Point(48, 216)
Me.GroupBox4.Name = "GroupBox4"
Me.GroupBox4.Size = New System.Drawing.Size(264, 48)
Me.GroupBox4.TabIndex = 12
Me.GroupBox4.TabStop = False
'
'GroupBox5
'
Me.GroupBox5.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label7, Me.TextBox3, Me.Label5, Me.NumericUpDown3, Me.TextBox2, Me.Label3})
Me.GroupBox5.Location = New System.Drawing.Point(24, 24)
Me.GroupBox5.Name = "GroupBox5"
Me.GroupBox5.Size = New System.Drawing.Size(312, 160)
Me.GroupBox5.TabIndex = 13
Me.GroupBox5.TabStop = False
'
'Form3
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(386, 359)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TabControl1})
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "Form3"
Me.Text = "资源浏览和管理"
Me.GroupBox1.ResumeLayout(False)
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.NumericUpDown2, System.ComponentModel.ISupportInitialize).EndInit()
Me.TabControl1.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
Me.TabPage2.ResumeLayout(False)
Me.GroupBox3.ResumeLayout(False)
CType(Me.NumericUpDown3, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox4.ResumeLayout(False)
Me.GroupBox5.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form3_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim sqlstr As String
sqlstr = "SELECT * FROm TableInfo "
Dim myDS As New DataSet()
myDS.Clear()
Me.DataGrid1.ReadOnly = True
myDS = GetDataFromDB(sqlstr)
Me.DataGrid1.DataSource = myDS.Tables(0).DefaultView
Me.ComboBox1.Enabled = Me.RadioButton1.Checked
Me.ComboBox2.Enabled = Me.RadioButton3.Checked
Me.TextBox1.Enabled = Me.RadioButton1.Checked
Me.NumericUpDown1.Enabled = Me.RadioButton2.Checked
Me.NumericUpDown2.Enabled = Me.RadioButton2.Checked
If pepdom = 2 Then
Me.TabPage2.Enabled = False
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Me.ComboBox1.Enabled = Me.RadioButton1.Checked
Me.TextBox1.Enabled = Me.RadioButton1.Checked
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
Me.NumericUpDown1.Enabled = Me.RadioButton2.Checked
Me.NumericUpDown2.Enabled = Me.RadioButton2.Checked
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
Me.ComboBox2.Enabled = Me.RadioButton3.Checked
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
Dim sqlstr As String
Dim str As String
Dim sel As Integer
Dim min As Integer
Dim max As Integer
If Me.RadioButton1.Checked = True Then
sel = Val(Me.TextBox1.Text)
If sel <> 0 Then
If Me.ComboBox1.SelectedIndex = 0 Then
sqlstr = "SELECT * FROM TableInfo WHERE tablenum='" & sel & "'"
End If
If Me.ComboBox1.SelectedIndex = 1 Then
sqlstr = "SELECT * FROM TableInfo WHERE roomnum='" & sel & "'"
End If
Else
MsgBox("请输入需要查找的" & Me.ComboBox1.SelectedItem, _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "没有查询参数")
Exit Sub
End If
End If
If Me.RadioButton2.Checked = True Then
min = Me.NumericUpDown1.Value
max = Me.NumericUpDown2.Value
If max < min Then
MsgBox("查询语句逻辑出错。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "查询语句错误")
Exit Sub
Else
sqlstr = "SELECT *FROm TableInfo WHERE conperson>= " & _
"'" & min & "' AND conperson <= '" & max & "'"
End If
End If
If Me.RadioButton3.Checked Then
str = Trim(Me.ComboBox2.SelectedItem)
sqlstr = "SELECT * FROM TableInfo WHERE status='" & str & "'"
End If
Dim myDS As New DataSet()
myDS.Clear()
Me.DataGrid1.ReadOnly = True
myDS = GetDataFromDB(sqlstr)
Me.DataGrid1.DataSource = myDS.Tables(0).DefaultView
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button3.Click
Dim tbnum As Integer = CInt(Val(Me.TextBox2.Text))
Dim rmnum As Integer = CInt(Val(Me.TextBox3.Text))
Dim cprsn As Integer = Me.NumericUpDown3.Value
Dim sqlstr As String
sqlstr = "INSERT INTO TableInfo (tablenum,conperson,status,roomnum) " & _
"VALUES ('" & tbnum & "','" & cprsn & "','空闲','" & rmnum & "')"
If UpdateData(sqlstr) = True Then
MsgBox("添加新资源成功。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "添加成功")
Form3_Load(Nothing, Nothing)
Else
MsgBox("添加新资源失败。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "添加失败")
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button5.Click
Dim tbnum As Integer = CInt(Val(Me.TextBox2.Text))
Dim sqlstr As String
Dim myDS As New DataSet()
myDS.Clear()
sqlstr = "SELECT * FROM TableInfo WHERE tablenum='" & tbnum & "'"
myDS = GetDataFromDB(sqlstr)
If myDS.Tables(0).Rows.Count = 0 Then
MsgBox("找不到该桌号。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "查找失败")
Exit Sub
Else
MsgBox(myDS.Tables(0).Rows(0).Item("status").ToString)
If Trim(myDS.Tables(0).Rows(0).Item("status").ToString) = "修理中" Then
sqlstr = "UPDATE TableInfo SET status='空闲' WHERE tablenum='" & tbnum & "'"
If UpdateData(sqlstr) = True Then
MsgBox("该桌号修理成功,可以重新交付使用。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "修理成功")
Form3_Load(Nothing, Nothing)
Else
MsgBox("更新数据失败,该桌号尚不能交付使用。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "数据更新失败")
End If
Else
MsgBox("该桌号不需要修理。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无需修理")
Exit Sub
End If
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button4.Click
Dim tbnum As Integer = CInt(Val(Me.TextBox2.Text))
Dim sqlstr As String
Dim myDS As New DataSet()
myDS.Clear()
sqlstr = "SELECT * FROM TableInfo WHERE tablenum='" & tbnum & "'"
myDS = GetDataFromDB(sqlstr)
If myDS.Tables(0).Rows.Count = 0 Then
MsgBox("找不到该桌号。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "查找失败")
Exit Sub
Else
If Trim(myDS.Tables(0).Rows(0).Item("status").ToString) _
= "使用中" Or Trim(myDS.Tables(0).Rows(0).Item("status").ToString) _
= "被预定" Then
MsgBox("该桌号正在使用,请等待一会再行废弃使用。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "废弃失败")
Exit Sub
Else
sqlstr = "DELETE FROM TableInfo WHERE tablenum='" & tbnum & "'"
If UpdateData(sqlstr) = True Then
MsgBox("该餐桌已成功被废弃,将不能再重新交付使用。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "更新成功")
Form3_Load(Nothing, Nothing)
Else
MsgBox("数据删除失败,不能进行数据更新。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "更新失败")
End If
End If
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button6.Click
Dim tbnum As Integer = CInt(Val(Me.TextBox2.Text))
Dim sqlstr As String
Dim myDS As New DataSet()
myDS.Clear()
sqlstr = "SELECT * FROM TableInfo WHERE tablenum='" & tbnum & "'"
myDS = GetDataFromDB(sqlstr)
If myDS.Tables(0).Rows.Count = 0 Then
MsgBox("找不到该桌号。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "查找失败")
Exit Sub
Else
MsgBox(myDS.Tables(0).Rows(0).Item("status").ToString)
If Trim(myDS.Tables(0).Rows(0).Item("status").ToString) _
= "使用中" Or Trim(myDS.Tables(0).Rows(0).Item("status").ToString) _
= "被预定" Then
MsgBox("该桌号正在使用,请稍后再交付修理。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "正在使用中")
Exit Sub
ElseIf Trim(myDS.Tables(0).Rows(0).Item("status").ToString) = "空闲" Then
sqlstr = "UPDATE TableInfo SET status='修理中' WHERE tablenum=" & _
"'" & tbnum & "'"
If UpdateData(sqlstr) = True Then
MsgBox("该桌号交付修理成功。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "交付修理")
Form3_Load(Nothing, Nothing)
Else
MsgBox("更新数据失败,该桌号尚不能交付修理。", MsgBoxStyle.OKOnly _
+ MsgBoxStyle.Exclamation, "数据更新失败")
End If
Else
MsgBox("该餐桌号正在修理。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "修理中")
Exit Sub
End If
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -