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

📄 telephoneform.aspx.vb

📁 旅客信息管理、酒店客房管理、各种信息查询
💻 VB
字号:
'文件名:TelephoneForm.aspx.vb
Imports System.Data.SqlClient
Imports System.Data
Partial Class ConsumeManage_TelephoneForm
    Inherits System.Web.UI.Page
    Private Shared MyTelephoneTable As New DataTable()
    Private Shared MyID As Integer = 0
    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("B2") > 1) Then
            Server.Transfer("~/SystemManage/AllErrorHelp.aspx")
        End If
        If (Not IsPostBack) Then
            '创建无连接的数据表
            Dim MyKey(1) As DataColumn
            MyTelephoneTable = New DataTable("话费入账")
            Dim MyColumn As New DataColumn()
            MyColumn.DataType = System.Type.GetType("System.Int16")
            MyColumn.ColumnName = "自编号"
            MyTelephoneTable.Columns.Add(MyColumn)
            MyKey(0) = MyColumn
            MyTelephoneTable.PrimaryKey = MyKey
            MyTelephoneTable.Columns.Add("入住编号", System.Type.GetType("System.String"))
            MyTelephoneTable.Columns.Add("话费编号", System.Type.GetType("System.String"))
            MyTelephoneTable.Columns.Add("通话时间", System.Type.GetType("System.DateTime"))
            MyTelephoneTable.Columns.Add("类别", System.Type.GetType("System.String"))
            MyTelephoneTable.Columns.Add("金额", System.Type.GetType("System.Double"))
            MyTelephoneTable.Columns.Add("说明", System.Type.GetType("System.String"))
            MyTelephoneTable.Columns.Add("记账时间", System.Type.GetType("System.DateTime"))
            MyTelephoneTable.Columns.Add("操作人员", System.Type.GetType("System.String"))
            Me.TextBox1.Text = DateTime.Now.ToShortDateString()
        End If
        Me.Page.Title = "当前位置:消费管理->旅客话费登记"
        Me.GridView1.DataSource = MyTelephoneTable
        Me.Button3.OnClientClick = "return confirm('请检查旅客话费信息是否正确,一旦保存就无法修改,是否继续?')"
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        '向临时数据表中新增话费信息
        MyID = MyID + 1
        Dim MyRow As DataRow = MyTelephoneTable.NewRow()
        MyRow(0) = MyID
        MyRow("入住编号") = Me.DropDownList2.SelectedValue.ToString()
        MyRow("话费编号") = Me.TextBox4.Text
        MyRow("通话时间") = Me.TextBox1.Text
        MyRow("类别") = Me.DropDownList3.SelectedValue.ToString()
        MyRow("金额") = Me.TextBox2.Text
        MyRow("说明") = Me.TextBox3.Text
        MyRow("记账时间") = Me.TextBox6.Text
        MyRow("操作人员") = Me.TextBox5.Text
        MyTelephoneTable.Rows.Add(MyRow)
        Me.GridView1.DataBind()
    End Sub
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        '打印旅客话费信息
        Server.Transfer("~/ConsumeManage/TelephonePrint.aspx")
    End Sub
    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        '保存旅客话费信息
        Dim MySQLConnectionString As String = ConfigurationManager.ConnectionStrings("MyHotelDBConnectionString").ConnectionString
        Dim MyConnection As New SqlConnection(MySQLConnectionString)
        MyConnection.Open()
        Dim MyBulkCopy As New SqlBulkCopy(MyConnection)
        MyBulkCopy.DestinationTableName = "话费入账"
        MyBulkCopy.WriteToServer(MyTelephoneTable)
        MyTelephoneTable.Rows.Clear()
        If (MyConnection.State = ConnectionState.Open) Then
            MyConnection.Close()
        End If
        Button5_Click(Nothing, Nothing)
    End Sub
    Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
        '随机生成话费编号
        Me.TextBox4.Text = System.Guid.NewGuid().ToString().ToUpper()
        Me.TextBox5.Text = Session("MyUserName").ToString()
        Me.TextBox6.Text = DateTime.Now.ToShortDateString()
        MyTelephoneTable.Rows.Clear()
        Me.GridView1.DataBind()
        MyID = 0
    End Sub
    '设置要传递到打印页的数据表
    Public ReadOnly Property MyTable() As System.Data.DataTable
        Get
            Return MyTelephoneTable
        End Get
    End Property
    '设置要传递到打印页的入住房号
    Public ReadOnly Property My入住房号() As String
        Get
            Return Me.DropDownList1.SelectedValue.ToString()
        End Get
    End Property
    '设置要传递到打印页的客人姓名
    Public ReadOnly Property My客人姓名() As String
        Get
            Return Me.DropDownList2.SelectedItem.Text
        End Get
    End Property
End Class

⌨️ 快捷键说明

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