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

📄 registerform.aspx.vb

📁 旅客信息管理、酒店客房管理、各种信息查询
💻 VB
字号:
'文件名:RegisterForm.aspx.vb
Imports System.Data.SqlClient
Partial Class RoomManage_RegisterForm
    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("A1") > 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 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 = Me.TextBox5.Text
        Response.Cookies.Add(My入住日期)
        Dim My离开日期 As New HttpCookie("My离开日期")
        My离开日期.Value = Me.TextBox6.Text
        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.DropDownList3.SelectedValue.ToString()
        Response.Cookies.Add(My住宿人数)
        Dim My客人性别 As New HttpCookie("My客人性别")
        My客人性别.Value = Me.DropDownList4.SelectedValue.ToString()
        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
    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 = System.Data.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()
        Me.TextBox3.Text = Me.GridView1.SelectedRow.Cells(4).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
        '设置入住编号
        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 = System.Data.ConnectionState.Open) Then
            MyConnection.Close()
        End If
        Me.TextBox1.Text = MyNewID
        '预置入住和离开日期
        Me.TextBox5.Text = DateTime.Now.Date.ToShortDateString()
        Me.TextBox6.Text = DateTime.Now.Date.ToShortDateString()
    End Sub
End Class

⌨️ 快捷键说明

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