📄 changeform.aspx.vb
字号:
'文件名:ChangeForm.aspx.vb
Imports System.Data.SqlClient
Imports System.Data
Partial Class RoomManage_ChangeForm
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim MyForbidString As String = Session("MyForbid").ToString()
If (MyForbidString.IndexOf("A2") > 1) Then
Server.Transfer("~/SystemManage/AllErrorHelp.aspx")
End If
Me.Page.Title = "当前位置:客房管理->旅客换房登记"
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
'换房
Dim My住宿人数 As Integer = Convert.ToInt16(Me.GridView1.SelectedRow.Cells(4).Text.ToString())
Dim My未住人数 As Integer = Convert.ToInt16(Me.GridView2.SelectedRow.Cells(5).Text.ToString()) - Convert.ToInt16(Me.GridView2.SelectedRow.Cells(6).Text.ToString())
If (My住宿人数 > My未住人数) Then
Return
End If
Dim My入住编号 As String = Me.GridView1.SelectedRow.Cells(1).Text.ToString()
Dim My原房号 As String = Me.GridView1.SelectedRow.Cells(2).Text.ToString()
Dim My新房号 As String = Me.GridView2.SelectedRow.Cells(1).Text.ToString()
Dim MySQLConnectionString As String = ConfigurationManager.ConnectionStrings("MyHotelDBConnectionString").ConnectionString
Dim MyConnection As New SqlConnection(MySQLConnectionString)
MyConnection.Open()
Dim MyCommand As SqlCommand = MyConnection.CreateCommand()
Dim MySQL As String = "Update 酒店房间 Set 已住人数=已住人数+" + My住宿人数.ToString() + " WHERE 房号='" + My新房号 + "';"
MySQL += "Update 酒店房间 Set 已住人数=已住人数-" + My住宿人数.ToString() + " WHERE 房号='" + My原房号 + "';"
MySQL += "Update 客房入住单 Set 入住房号='" + My新房号 + "' WHERE 入住编号='" + My入住编号 + "';"
Me.Page.Title = MySQL
MyCommand.CommandText = MySQL
MyCommand.ExecuteNonQuery()
If (MyConnection.State = ConnectionState.Open) Then
MyConnection.Close()
End If
Me.GridView1.DataBind()
Me.GridView2.DataBind()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -