⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookform.aspx.vb

📁 旅客信息管理、酒店客房管理、各种信息查询
💻 VB
字号:
'文件名:BookForm.aspx.vb
Imports System.Data.SqlClient
Imports System.Data
Partial Class RoomManage_BookForm
    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("A4") > 1) Then
            Server.Transfer("~/SystemManage/AllErrorHelp.aspx")
        End If
        Me.Page.Title = "当前位置:客房管理->旅客预订登记"
        If (Session("MyUserName") IsNot Nothing) Then
            '设置操作用户
            Me.TextBox14.Text = Session("MyUserName").ToString()
        End If
        Me.Button2.OnClientClick = "return confirm('请检查旅客预约登记信息是否正确,一旦保存就无法修改,是否继续?')"
    End Sub
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        '保存入住旅客登记信息
        If (Me.TextBox14.Text.Length > 1) Then
            '向客房预约单数据表增加记录
            Me.SqlDataSource2.Insert()
            '修改酒店房间数据表中的入住人数
            Dim MySQLConnectionString As String = ConfigurationManager.ConnectionStrings("MyHotelDBConnectionString").ConnectionString
            Dim MySQL As String = "Update 酒店房间 Set 已住人数=已住人数+" + Me.DropDownList3.SelectedValue.ToString() + " WHERE 房号='" + Me.TextBox2.Text + "'"
            Dim MyConnection As New SqlConnection(MySQLConnectionString)
            MyConnection.Open()
            Dim MyCommand As SqlCommand = MyConnection.CreateCommand()
            MyCommand.CommandText = MySQL
            MyCommand.ExecuteNonQuery()
            If (MyConnection.State = ConnectionState.Open) Then
                MyConnection.Close()
            End If
            Me.GridView1.DataBind()
        End If
    End Sub
    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
        '设置住宿人数列表项
        Me.TextBox2.Text = Me.GridView1.SelectedRow.Cells(1).Text.ToString()
        Dim My可住人数 As Integer = Convert.ToInt16(Me.GridView1.SelectedRow.Cells(5).Text.ToString())
        Dim My已住人数 As Integer = Convert.ToInt16(Me.GridView1.SelectedRow.Cells(6).Text.ToString())
        Dim My未住人数 As Integer = My可住人数 - My已住人数
        Me.DropDownList3.Items.Clear()
        For i As Integer = 1 To My未住人数
            Me.DropDownList3.Items.Add(i.ToString())
        Next
        '预置入住和离开日期
        Me.TextBox5.Text = DateTime.Now.Date.ToShortDateString()
        Me.TextBox6.Text = DateTime.Now.Date.ToShortDateString()
    End Sub
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint预约房号() As String
        Get
            Return Me.TextBox2.Text
        End Get
    End Property
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint预收押金() As String
        Get
            Return Me.TextBox4.Text
        End Get
    End Property
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint入住日期() As String
        Get
            Return Me.TextBox5.Text
        End Get
    End Property
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint离开日期() As String
        Get
            Return Me.TextBox6.Text
        End Get
    End Property
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint客人姓名() As String
        Get
            Return Me.TextBox7.Text
        End Get
    End Property
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint住宿人数() As String
        Get
            Return Me.DropDownList3.SelectedValue.ToString()
        End Get
    End Property
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint客人性别() As String
        Get
            Return Me.DropDownList4.SelectedValue.ToString()
        End Get
    End Property

    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint联系电话() As String
        Get
            Return Me.TextBox13.Text
        End Get
    End Property
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrint预约说明() As String
        Get
            Return Me.TextBox15.Text
        End Get
    End Property
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        '打印旅客客房预订信息
        Server.Transfer("~/RoomManage/BookPrint.aspx")
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -