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

📄 frmp.vb

📁 需要在.net环境下运行需要安装框架
💻 VB
字号:
Public Class FRMP
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写处置以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意:以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents nudGID As System.Windows.Forms.NumericUpDown
    Friend WithEvents nudHID As System.Windows.Forms.NumericUpDown
    Friend WithEvents btnBook As System.Windows.Forms.Button
    Friend WithEvents btnUnBook As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.nudGID = New System.Windows.Forms.NumericUpDown()
        Me.nudHID = New System.Windows.Forms.NumericUpDown()
        Me.btnBook = New System.Windows.Forms.Button()
        Me.btnUnBook = New System.Windows.Forms.Button()
        CType(Me.nudGID, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.nudHID, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(6, 26)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(48, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "车位号"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(6, 58)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(48, 16)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "房号"
        '
        'nudGID
        '
        Me.nudGID.Location = New System.Drawing.Point(106, 24)
        Me.nudGID.Name = "nudGID"
        Me.nudGID.Size = New System.Drawing.Size(144, 21)
        Me.nudGID.TabIndex = 4
        '
        'nudHID
        '
        Me.nudHID.Location = New System.Drawing.Point(106, 56)
        Me.nudHID.Name = "nudHID"
        Me.nudHID.Size = New System.Drawing.Size(144, 21)
        Me.nudHID.TabIndex = 5
        '
        'btnBook
        '
        Me.btnBook.Location = New System.Drawing.Point(24, 104)
        Me.btnBook.Name = "btnBook"
        Me.btnBook.Size = New System.Drawing.Size(64, 24)
        Me.btnBook.TabIndex = 8
        Me.btnBook.Text = "订车位"
        '
        'btnUnBook
        '
        Me.btnUnBook.Location = New System.Drawing.Point(168, 104)
        Me.btnUnBook.Name = "btnUnBook"
        Me.btnUnBook.Size = New System.Drawing.Size(64, 24)
        Me.btnUnBook.TabIndex = 9
        Me.btnUnBook.Text = "退车位"
        '
        'FRMP
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(256, 141)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnUnBook, Me.btnBook, Me.nudHID, Me.nudGID, Me.Label2, Me.Label1})
        Me.Name = "FRMP"
        Me.Text = "FRMP"
        CType(Me.nudGID, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.nudHID, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnBook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBook.Click
        If nudHID.Text = "" Or nudGID.Text = "" Then
            MsgBox("请输入必要的信息!", MsgBoxStyle.Exclamation, "OK")
            Exit Sub
        End If
        Dim gPrice As Integer
        Dim sqlStr As String = "select gPrice from garage where gID=" & nudGID.Text & "  and gBook='否'"
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        If Not dbopera1.checkValid() Then
            MsgBox("该车位或者不存在,或者已经被使用了!", MsgBoxStyle.Exclamation, "OK")
            Exit Sub
        Else
            gPrice = dbopera1.getSum()
        End If
        Dim iM1 As Integer = Date.Today.Day
        Dim iM2 As Integer = Date.Today.DaysInMonth(Date.Today.Year, Date.Today.Month)
        Dim hoMoney As Integer
        sqlStr = "select hoMoney from houseOwner where hID=" & nudHID.Text
        Dim dbopera3 As DbOpera = New DbOpera(sqlStr) '取出户主的欠款
        hoMoney = dbopera3.getSum()
        hoMoney = hoMoney + Int(gPrice * iM1 / iM2)
        sqlStr = "update houseOwner set hoMoney=" & hoMoney.ToString() & "  where hID=" & nudHID.Text
        Dim dbopera4 As DbOpera = New DbOpera(sqlStr) '更新户主的欠款
        dbopera4.opera()
        sqlStr = "update garage set gBook='是',hID=" & nudHID.Text & " where gID=" & nudGID.Text
        Dim dbopera2 As DbOpera = New DbOpera(sqlStr) '更新车位的使用信息
        dbopera2.opera()
        MsgBox("成功!", MsgBoxStyle.Exclamation, "OK")
    End Sub

    Private Sub btnUnBook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnBook.Click
        '计算车位钱
        Dim hoMoney As Integer
        Dim gPrice As Integer
        Dim sqlStr As String = "select hoMoney from houseOwner where hID=" & nudHID.Text
        Dim dbopera1 As DbOpera = New DbOpera(sqlStr)
        hoMoney = dbopera1.getSum()
        sqlStr = "select gPrice from garage where gID=" & nudGID.Text & " and hID=" & nudHID.Text
        Dim dbopera2 As DbOpera = New DbOpera(sqlStr)
        If Not dbopera2.checkValid() Then
            MsgBox("该车位或者不存在或者不是你所使用!", MsgBoxStyle.Exclamation, "OK")
            Exit Sub
        Else
            gPrice = dbopera2.getSum()
        End If
        Dim iM1 As Integer = Date.Today.Day
        Dim iM2 As Integer = Date.Today.DaysInMonth(Date.Today.Year, Date.Today.Month)
        gPrice = (gPrice * iM1 / iM2)
        hoMoney = hoMoney - gPrice
        sqlStr = "update garage set gBook='否',hID=0 where gID=" & nudGID.Text
        Dim dbopera3 As DbOpera = New DbOpera(sqlStr) '更改车位的信息
        dbopera3.opera()
        sqlStr = "update houseOwner set hoMoney=" & hoMoney.ToString() & "  where hID=" & nudHID.Text
        Dim dbopera4 As DbOpera = New DbOpera(sqlStr) '更新户主的欠款
        dbopera4.opera()
        MsgBox("本月的车位费归入用户余额。" & gPrice.ToString(), MsgBoxStyle.Exclamation, "OK")
    End Sub
End Class

⌨️ 快捷键说明

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