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

📄 frombooktoregisterform.aspx.vb

📁 旅客信息管理、酒店客房管理、各种信息查询
💻 VB
字号:
'文件名:FromBookToRegisterForm.aspx.vb
Imports System.Data.SqlClient
Imports System.Data
Partial Class RoomManage_FromBookToRegisterForm
    Inherits System.Web.UI.Page
    Public Shared My预约编号 As String = ""
    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("A5") > 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 GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
        '设置入住编号
        Dim MySQLConnectionString As String = ConfigurationManager.ConnectionStrings("MyHotelDBConnectionString").ConnectionString
        Dim MyConnection As New SqlConnection(MySQLConnectionString)
        MyConnection.Open()
        Dim MyCommand As SqlCommand = MyConnection.CreateCommand()
        MyCommand.CommandText = "Select max(入住编号) 最大编号 From 客房入住单"
        Dim MyResult As Object = MyCommand.ExecuteScalar()
        Dim MyID As Int64 = 1
        If (MyResult IsNot System.DBNull.Value) Then
            Dim MyMaxID As String = MyResult.ToString().Trim()
            MyMaxID = MyMaxID.Substring(2, MyMaxID.Length - 2)
            MyID = Convert.ToInt64(MyMaxID) + 1
        End If
        Dim MyLength As Integer = MyID.ToString().Length
        Dim MyNewID As String = ""
        Select Case (MyLength)
            Case 1
                MyNewID = "RZ0000000" + MyID.ToString()
            Case 2
                MyNewID = "RZ000000" + MyID.ToString()
            Case 3
                MyNewID = "RZ00000" + MyID.ToString()
            Case 4
                MyNewID = "RZ0000" + MyID.ToString()
            Case 5
                MyNewID = "RZ000" + MyID.ToString()
            Case 6
                MyNewID = "RZ00" + MyID.ToString()
            Case 7
                MyNewID = "RZ0" + MyID.ToString()
        End Select
        If (MyConnection.State = ConnectionState.Open) Then
            MyConnection.Close()
        End If
        Me.TextBox1.Text = MyNewID
        My预约编号 = Me.GridView1.SelectedRow.Cells(1).Text.ToString()
        Me.TextBox2.Text = Me.GridView1.SelectedRow.Cells(2).Text.ToString()
        Me.TextBox4.Text = Me.GridView1.SelectedRow.Cells(3).Text.ToString()
        Me.TextBox5.Text = Me.GridView1.SelectedRow.Cells(4).Text.ToString()
        Me.TextBox6.Text = Me.GridView1.SelectedRow.Cells(5).Text.ToString()
        Me.TextBox7.Text = Me.GridView1.SelectedRow.Cells(6).Text.ToString()
        Me.TextBox13.Text = Me.GridView1.SelectedRow.Cells(9).Text.ToString()
        Me.TextBox15.Text = Me.GridView1.SelectedRow.Cells(11).Text.ToString()
        Me.TextBox8.Text = Me.GridView1.SelectedRow.Cells(7).Text.ToString()
        Me.TextBox11.Text = Me.GridView1.SelectedRow.Cells(8).Text.ToString()
    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.TextBox1.Text + "' WHERE 自编号='" + My预约编号 + "'"
            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 Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        '打印入住旅客登记信息
        Dim My入住编号 As New HttpCookie("My入住编号")
        My入住编号.Value = Me.TextBox1.Text
        Response.Cookies.Add(My入住编号)
        Dim My入住房号 As New HttpCookie("My入住房号")
        My入住房号.Value = Me.TextBox2.Text
        Response.Cookies.Add(My入住房号)
        Dim My折扣价格 As New HttpCookie("My折扣价格")
        My折扣价格.Value = Me.TextBox3.Text
        Response.Cookies.Add(My折扣价格)
        Dim My预收押金 As New HttpCookie("My预收押金")
        My预收押金.Value = Me.TextBox4.Text
        Response.Cookies.Add(My预收押金)
        Dim My入住日期 As New HttpCookie("My入住日期")
        My入住日期.Value = DateTime.Parse(Me.TextBox5.Text).ToShortDateString()
        Response.Cookies.Add(My入住日期)
        Dim My离开日期 As New HttpCookie("My离开日期")
        My离开日期.Value = DateTime.Parse(Me.TextBox6.Text).ToShortDateString()
        Response.Cookies.Add(My离开日期)
        Dim My客人姓名 As New HttpCookie("My客人姓名")
        My客人姓名.Value = Me.TextBox7.Text
        Response.Cookies.Add(My客人姓名)
        Dim My证件名称 As New HttpCookie("My证件名称")
        My证件名称.Value = Me.DropDownList2.SelectedValue.ToString()
        Response.Cookies.Add(My证件名称)
        Dim My证件号码 As New HttpCookie("My证件号码")
        My证件号码.Value = Me.TextBox9.Text
        Response.Cookies.Add(My证件号码)
        Dim My证件地址 As New HttpCookie("My证件地址")
        My证件地址.Value = Me.TextBox10.Text
        Response.Cookies.Add(My证件地址)
        Dim My住宿人数 As New HttpCookie("My住宿人数")
        My住宿人数.Value = Me.TextBox8.Text
        Response.Cookies.Add(My住宿人数)
        Dim My客人性别 As New HttpCookie("My客人性别")
        My客人性别.Value = Me.TextBox11.Text
        Response.Cookies.Add(My客人性别)
        Dim My联系电话 As New HttpCookie("My联系电话")
        My联系电话.Value = Me.TextBox13.Text
        Response.Cookies.Add(My联系电话)
        Dim My操作人员 As New HttpCookie("My操作人员")
        My操作人员.Value = Me.TextBox14.Text
        Response.Cookies.Add(My操作人员)
        Dim My登记说明 As New HttpCookie("My登记说明")
        My登记说明.Value = Me.TextBox15.Text
        Response.Cookies.Add(My登记说明)
        Server.Transfer("~/RoomManage/RegisterPrint.aspx")
    End Sub
End Class

⌨️ 快捷键说明

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