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

📄 frmreserve.vb

📁 用.net写的,不知道怎么样,各位看看再说吧.
💻 VB
📖 第 1 页 / 共 5 页
字号:
                New EventHandler(AddressOf dgdList_DoubleClick)
            End If
            ts.GridColumnStyles.Add(aColumnTextColumn)
        Next
        ts.AlternatingBackColor = Color.LightGray
        ts.AllowSorting = False
        ts.MappingName = dtData.TableName
        dgdList.TableStyles.Clear()
        dgdList.TableStyles.Add(ts)
        Dim dv As DataView = dtData.DefaultView
        dv.AllowNew = False
        dv.AllowDelete = False
        'dv.AllowEdit = False
        '设置数据源
        dgdList.DataSource = dtData.DefaultView
        bmData = Me.BindingContext(DataSet11, "预定单")
        lblCount.Text = "记录数:" + dtData.Rows.Count.ToString()
    End Sub
    Public Overrides Sub SetTextBoxState(ByVal bState As Boolean)
        Me.GroupBox1.Enabled = Not bState
    End Sub
    Public Overrides Sub Clear()        Me.txbAddPrice.Text = "0"
        Me.txbBeforMoney.Text = "0"
        Me.txbDestineCompany.Text = ""
        Me.txbDestinePeople.Text = ""
        Me.txbDiscount.Text = "0"
        Me.txbMemberId.Text = "001"
        Me.txbNowPrice.Text = ""
        Me.txbNumber.Text = "1"
        Me.txbState.Text = "预定"
        Me.txbRoomCode.Text = ""
        Me.txbRemark.Text = ""
        Me.txbReasonDiscount.Text = ""
        Me.txbPhone.Text = ""
        Me.txbOriginPrice.Text = ""
        Me.txbOperator.Text = ""
        Me.txbOriginPrice.Text = ""
        Me.txbOperator.Text = ""
        Me.txbOperationPeople.Text = ""
        Me.cbbRoomType.Text = ""
        Me.ckbAddBed.Checked = False
        Me.tmArrive.Value = Date.Now
        Me.tmLeft.Value = Date.Now
        Me.txbState.ReadOnly = True
        Me.cbbRoomType.Text = "普通房"
        Dim strId As String = "YD00000000"
        Dim strId1 As String = ""
        Dim db As DataBase = New DataBase
        Dim dv As DataView = _
        db.RunSelectSQL("select max(预定单号) as id from 预定单")
        If dv(0)(0).ToString = "" Then
            '预定单中没信息
            dv = _
            db.RunSelectSQL("select max(预定单号) as id from 预定单历史")
            If dv(0)(0).ToString = "" Then
                '预定单历史没有信息
                strId = "YD00000001"
            Else
                strId1 = dv(0)(0).ToString
                strId1 = strId1.Substring(2)
                Dim id As Integer = (CInt(strId1) + 1).ToString
                strId = strId.Substring(0, _
               (strId1.Length - id.ToString.Length + 2)) + id.ToString
            End If
        Else
            strId1 = dv(0)(0).ToString
            strId1 = strId1.Substring(2)
            Dim id As Integer = (CInt(strId1) + 1).ToString
            strId = strId.Substring(0, _
            (strId1.Length - id.ToString.Length + 2)) + id.ToString
        End If
        db.Dispose()
        Me.txbListId.Text = strId
    End Sub    Public Overrides Sub SaveForAdd()
        If Me.txbRoomCode.Text.Trim.Length = 0 Then
            MessageBox.Show("选择的客房不是空房!")
            Return
        End If
        Dim dr As DataRow = DataSet11.Tables("预定单").NewRow()
        Try
            dr("预定单号") = txbListId.Text.Trim
            dr("客房类型") = cbbRoomType.SelectedValue.ToString.Trim
            dr("抵店时间") = tmArrive.Text.Trim
            dr("离店时间") = tmLeft.Text.Trim
            dr("联系电话") = txbPhone.Text.Trim
            dr("客房编号") = txbRoomCode.Text.Trim
            dr("客房价格") = txbOriginPrice.Text.Trim
            dr("入住价格") = txbNowPrice.Text.Trim
            dr("折扣") = txbDiscount.Text.Trim
            dr("折扣原因") = txbReasonDiscount.Text.Trim
            dr("入住人数") = txbNumber.Text.Trim
            dr("是否加床") = ckbAddBed.Checked
            dr("加床价格") = txbAddPrice.Text.Trim
            dr("预收款") = txbBeforMoney.Text.Trim
            dr("单据状态") = txbState.Text.Trim
            dr("预定人") = txbDestinePeople.Text.Trim
            dr("业务员") = txbOperationPeople.Text.Trim
            dr("操作员") = txbOperator.Text.Trim
            dr("会员编号") = txbMemberId.Text.Trim
            dr("预定公司") = txbDestineCompany.Text.Trim
            dr("备注") = txbRemark.Text.Trim
        Catch ex As Exception
            MessageBox.Show("数据格式不正确!")
            Exit Sub
        End Try
        Try
            '更新客房状态
            Dim db As DataBase = New DataBase
            Dim strSQL As String = "update 客房信息 set 状态='将到'"
            strSQL += " where 客房编号='" + txbRoomCode.Text.Trim + "'"
            db.RunDelOrInsSQL(strSQL)
            db.Dispose()
            DataSet11.Tables("预定单").Rows.Add(dr)
            If Me.DataSet11.HasChanges = True Then
                SqlDataAdapter1.Update(DataSet11)
            End If
        Catch ex As Exception
            MessageBox.Show("数据添加失败!")
        End Try
        LoadData()
        dgdList.DataSource = dtData.DefaultView
    End Sub    Public Overrides Sub DeleteData()
        Try
            '删除当前行的数据
            DataSet11.Tables("预定单"). _
            Rows(bmData.Position).Delete()
            Dim db As DataBase = New DataBase
            Dim strSQL As String = "update 客房信息 set 状态='空房'"
            strSQL += " where 客房编号='" + txbRoomCode.Text.Trim + "'"
            db.RunDelOrInsSQL(strSQL)
            db.Dispose()
            If Me.DataSet11.HasChanges = True Then
                '更新DataSet11
                SqlDataAdapter1.Update(DataSet11)
            End If
        Catch ex As Exception
            MessageBox.Show("数据删除失败!")
        End Try
    End Sub
    Public Overrides Sub SaveForUpdate()
        If Me.txbRoomCode.Text.Trim.Length = 0 Then
            MessageBox.Show("选择的客房不是空房!")
            Return
        End If
        Try
            '判断是否更改了预定的房间
            If txbRoomCode.Text.Trim <> strRoomCode Then
                '更新预订房间的状态
                Dim db As DataBase = New DataBase
                Dim strSQL As String = "update 客房信息 set 状态='空房'"
                strSQL += " where 客房编号='" + strRoomCode.Trim + "'"
                db.RunDelOrInsSQL(strSQL)
                strSQL = "update 客房信息 set 状态='将到'"
                strSQL += " where 客房编号='"
                strSQL += txbRoomCode.Text.Trim + "'"
                db.RunDelOrInsSQL(strSQL)
                db.Dispose()
            End If
            Dim row As Integer
            row = dgdList.CurrentCell.RowNumber
            dgdList.CurrentCell = _
            New DataGridCell((row + 1) Mod bmData.Count, 0)
            '判断是否有更新的数据
            If Me.DataSet11.HasChanges = True Then
                SqlDataAdapter1.Update(DataSet11)
            End If
        Catch ex As Exception
            MessageBox.Show("数据修改失败!")
        End Try
    End Sub
    Public Overrides Sub SetData()
        strRoomCode = txbRoomCode.Text.Trim
    End Sub
    Public Function GetInfo() As String
        '获得DataGrid当前被选中的行号
        Dim iRow As Integer = dgdList.CurrentRowIndex
        Dim sId As String
        '获取DataGrid当前被选中的行的内容
        sId = dtData.Rows(iRow)("预定单号").ToString()
        Return sId
    End Function
    Private Sub btnOpen_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnOpen.Click
        Dim db As DataBase = New DataBase
        Dim strSQL As String = "select 类型编号 from 客房类型 "
        strSQL += "where 类型名称='" + Me.cbbRoomType.Text + "'"
        Dim dv As DataView = db.RunSelectSQL(strSQL)
        db.Dispose()
        Dim dlgSelect As frmRoomState = New frmRoomState
        dlgSelect.bClose = True
        dlgSelect.strFilter = " 状态='空房' and 类型编号='"
        dlgSelect.strFilter += dv(0)(0).ToString() + "'"
        dlgSelect.btnSet.Enabled = False
        dlgSelect.ShowDialog()
        txbRoomCode.Text = dlgSelect.strRoomCode
    End Sub
    Private Sub cbbRoomType_SelectedValueChanged(

⌨️ 快捷键说明

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