📄 frmresourcemanage.vb
字号:
Me.btnReUser.Location = New System.Drawing.Point(160, 24)
Me.btnReUser.Name = "btnReUser"
Me.btnReUser.Size = New System.Drawing.Size(64, 24)
Me.btnReUser.TabIndex = 4
Me.btnReUser.Text = "修缮付用"
'
'btnRepair
'
Me.btnRepair.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.btnRepair.Location = New System.Drawing.Point(88, 24)
Me.btnRepair.Name = "btnRepair"
Me.btnRepair.Size = New System.Drawing.Size(64, 24)
Me.btnRepair.TabIndex = 11
Me.btnRepair.Text = "交付修缮"
'
'btnDesert
'
Me.btnDesert.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.btnDesert.Location = New System.Drawing.Point(232, 24)
Me.btnDesert.Name = "btnDesert"
Me.btnDesert.Size = New System.Drawing.Size(64, 24)
Me.btnDesert.TabIndex = 3
Me.btnDesert.Text = "损坏废弃"
'
'btnAdd
'
Me.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.btnAdd.Location = New System.Drawing.Point(16, 24)
Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(64, 24)
Me.btnAdd.TabIndex = 2
Me.btnAdd.Text = "添置付用"
'
'frmResourceManage
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(376, 342)
Me.Controls.Add(Me.gpFrame)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "frmResourceManage"
Me.Text = "资源管理"
Me.gpFrame.ResumeLayout(False)
Me.gpTable.ResumeLayout(False)
CType(Me.CommdateNumber, System.ComponentModel.ISupportInitialize).EndInit()
Me.gpControl.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private _TableNum As Integer
Private _Persons As Integer
Private _Status As RoomAndTableControl.UseStatus
Private _RoomName As String
Private sqlstr As String = String.Empty
Private Sub btnAdd_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs _
) Handles btnAdd.Click
_TableNum = CInt(Val(txtTableNumber.Text.Trim))
_Persons = CommdateNumber.Value
_Status = RoomAndTableControl.UseStatus.已空闲
_RoomName = txtRoomName.Text.Trim
If _TableNum <= 0 Then
Throw New ArgumentOutOfRangeException
End If
If _RoomName = String.Empty Then
Throw New ArgumentNullException("")
End If
sqlstr = "INSERT INTO TableInfo (tablenum,persons," & _
"status,roomname) VALUES ( '" & _TableNum & "'," _
& _Persons & ",'" & _Status.ToString & "','" & _RoomName & "')"
If AccessToDatabase.UpdateData(sqlstr) = True Then
MsgBox("哇,祝贺您,您已成功添加该桌号。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Information, "添加资源成功")
Else
MsgBox("很遗憾哦,该桌号已经存在了。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "添加资源失败")
End If
End Sub
Private Sub btnRepair_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRepair.Click
Dim tempDS As New DataSet
Dim mStatus As String
_TableNum = CInt(Val(txtTableNumber.Text.Trim))
_Status = RoomAndTableControl.UseStatus.修缮中
If _TableNum <= 0 Then
Throw New ArgumentOutOfRangeException
End If
sqlstr = "SELECT status FROM TableInfo WHERE tablenum='" & _TableNum & "'"
tempDS.Clear()
tempDS = AccessToDatabase.GetDataFromDB(sqlstr)
If tempDS.Tables(0).Rows.Count = 0 Then
MsgBox("咦?没有找到该桌号耶。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "交付修缮失败")
Exit Sub
End If
mStatus = CStr(tempDS.Tables(0).Rows(0)("status")).Trim
If mStatus <> "已空闲" Then
MsgBox("呀,该桌正" & mStatus & ",目前还不能交付修缮耶。", _
MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly, "交付修缮失败")
Exit Sub
End If
sqlstr = "UPDATE TableInfo SET status='" & _Status.ToString _
& "' WHERE tablenum='" & _TableNum & "'"
If AccessToDatabase.UpdateData(sqlstr) = True Then
MsgBox("嗯," & _TableNum & "桌已经成功交付修缮了。", _
MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "交付修缮成功")
End If
End Sub
Private Sub btnDesert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDesert.Click
Dim tempDS As New DataSet
Dim mStatus As String
_TableNum = CInt(Val(txtTableNumber.Text.Trim))
If _TableNum <= 0 Then
Throw New ArgumentOutOfRangeException
End If
sqlstr = "SELECT status FROM TableInfo WHERE tablenum='" & _TableNum & "'"
tempDS.Clear()
tempDS = AccessToDatabase.GetDataFromDB(sqlstr)
If tempDS.Tables(0).Rows.Count = 0 Then
MsgBox("咦?没有找到该桌号耶。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "损坏废弃失败")
Exit Sub
End If
mStatus = CStr(tempDS.Tables(0).Rows(0)("status")).Trim
If (mStatus = "已预定") Or (mStatus = "进餐中") Then
MsgBox("呀,该桌正" & mStatus & ",目前还不能废弃使用耶。", _
MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly, "废弃使用失败")
Exit Sub
End If
sqlstr = "DELETE TableInfo WHERE tablenum='" & _TableNum & "'"
If AccessToDatabase.UpdateData(sqlstr) = True Then
MsgBox("嗯," & _TableNum & "桌已经成功废弃使用了。", _
MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "废弃使用成功")
End If
End Sub
Private Sub btnReUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReUser.Click
Dim tempDS As New DataSet
Dim mStatus As String
_TableNum = CInt(Val(txtTableNumber.Text.Trim))
_Status = RoomAndTableControl.UseStatus.已空闲
If _TableNum <= 0 Then
Throw New ArgumentOutOfRangeException
End If
sqlstr = "SELECT status FROM TableInfo WHERE tablenum='" & _TableNum & "'"
tempDS.Clear()
tempDS = AccessToDatabase.GetDataFromDB(sqlstr)
If tempDS.Tables(0).Rows.Count = 0 Then
MsgBox("咦?没有找到该桌号耶。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "修缮付用失败")
Exit Sub
End If
mStatus = CStr(tempDS.Tables(0).Rows(0)("status")).Trim
If (mStatus <> "修缮中") Then
MsgBox("呀,该桌正" & mStatus & ",目前还不能付用耶。", _
MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly, "修缮付用失败")
Exit Sub
End If
sqlstr = "UPDATE TableInfo SET status='" & _Status.ToString _
& "' WHERE tablenum='" & _TableNum & "'"
If AccessToDatabase.UpdateData(sqlstr) = True Then
MsgBox("嗯," & _TableNum & "桌已经成功修缮付用了。", _
MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "修缮成功")
End If
End Sub
End Class
End Namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -