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

📄 frm_patinfo.vb

📁 application file which contains the notes on Ado.net
💻 VB
📖 第 1 页 / 共 4 页
字号:
        End If
    End Function
    Function deletefield()
        Dim del As String = "DELETE FROM Patients WHERE patcode ='" & TextBox4.Text & "'"
        MyConnection.Open()
        MyCommand = New OleDbCommand(del, MyConnection)
        MyCommand.ExecuteNonQUery()
        MyCommand.dispose()
        MyCommand = New OleDbCommand("DELETE FROM patalerts WHERE patcode ='" & TextBox4.Text & "'", MyConnection)
        MyCommand.ExecuteNonQuery()
        MyCommand.dispose()
        MyCommand = New OleDbCommand("DELETE FROM appointments WHERE patcode ='" & TextBox4.Text & "'", MyConnection)
        MyCommand.ExecuteNonQuery()
        MyCommand.dispose()
        MyCommand = New OleDbCommand("DELETE FROM Admissions WHERE patcode = '" & TextBox4.Text & "'", MyConnection)
        MyCommand.ExecuteNonQuery()
        MyCommand.dispose()
        MyCommand = New OleDbCommand("DELETE FROM Accounts WHERE patcode'" & TextBox4.Text & "'", MyConnection)
        MyCommand.ExecuteNonQuery()
        MyCommand.dispose()
        MyCommand = New OleDbCommand("DELETE FROM drusissued WHERE patcode = '" & TextBox4.Text & "' ", MyConnection)
        MyCommand.ExecuteNonQuery()
        MyCommand.dispose()
        MyCommand = New OleDbCommand("DELETE FROM pres WHERE patcode = '" & TextBox4.Text & "' ", MyConnection)
        MyCommand.ExecuteNonQuery()
        MyConnection.Close()
        MyCommand.dispose()
    End Function
    Function buttondis()
        Button1.Enabled = False
        Button2.Enabled = False
        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = False
    End Function
    Function buttonena()
        Button1.Enabled = True
        Button2.Enabled = True
        Button3.Enabled = True
        Button4.Enabled = True
        Button5.Enabled = True
    End Function
    Function updatemsg()
        MsgBox("Patient " + TextBox4.Text + " Has Been Updated", MsgBoxStyle.Information, "PrisLogix's PIS")
    End Function
    Function deletemsg()
        MsgBox("Patient " + TextBox4.Text + " Has Been Deleted", MsgBoxStyle.Information, "PrisLogix's PIS")
    End Function
    Function getward()
        MyConnection.Open()
        MyCommand = New OleDbCommand("SELECT * FROM Ward", MyConnection)
        MyReader = MyCommand.ExecuteReader()
        While MyReader.Read
            ComboBox4.Items.Add(MyReader("wardid"))
        End While
        MyConnection.Close()
        MyReader.Close()
        MyCommand.dispose()
    End Function
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Getting the values from the textboxes
        Button4.Visible = True
        Button2.Enabled = False
        Button3.Enabled = False
        Button1.Visible = False
        Button5.Visible = True
        Button4.Enabled = True
        enablefields()
        getid()
        TextBox4.Text = getpatcode()
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Button1.Visible = True
        Button4.Visible = False
        Button2.Enabled = True
        Button3.Enabled = True
        Dim patcode = TextBox4.Text
        Dim gender = ComboBox1.Text
        Dim firstname = TextBox5.Text
        Dim add = TextBox7.Text
        Dim lastname = TextBox10.Text
        Dim telephone = TextBox8.Text
        Dim age = TextBox6.Text
        Dim nationality = TextBox9.Text
        Dim status = ComboBox2.Text
        Dim ername = TextBox3.Text
        Dim eradd = TextBox2.Text
        Dim ertel = TextBox1.Text
        Dim birth = TextBox11.Text
        Dim blood = ComboBox3.Text
        Dim wid = ComboBox4.Text
        Dim last = TextBox10.Text
        Dim spon = ComboBox6.Text
        Dim innum = TextBox14.Text
        Dim comm = TextBox15.Text
        Dim comins = TextBox16.Text
        'the insert command which is used to insert the data into the table
        '("INSERT INTO Login(Name,Pass) VALUES ('" & TextBox1.Text & "' , '" & TextBox2.Text & " ') ", MyConnection)
        Dim iCmd = "INSERT INTO Patients(patcode,patname,bday,address,gender,age,telno,status, er_patname, er_address, er_telno, nationality,blood,wardid,lastname,sponser,inno,companyname,comin) VALUES('" & patcode & "','" & firstname & "', '" & birth & "', '" & add & "', '" & gender & "', '" & age & "', '" & telephone & "', '" & status & "', '" & ername & "', '" & eradd & "', '" & ertel & "' , '" & nationality & "' ,'" & blood & "','" & wid & "', '" & last & "','" & ComboBox6.Text & "','" & innum & "','" & comm & "','" & comins & "' ) "
        'adding the patient into the archives table
        Dim iCmd2 = "INSERT INTO Archives(patcode,patname,bday,address,gender,age,telno,status, er_patname, er_address, er_telno, nationality,blood,wardid,lastname,sponser,inno,companyname,comin) VALUES('" & patcode & "','" & firstname & "', '" & birth & "', '" & add & "', '" & gender & "', '" & age & "', '" & telephone & "', '" & status & "', '" & ername & "', '" & eradd & "', '" & ertel & "' , '" & nationality & "' ,'" & blood & "','" & wid & "', '" & last & "','" & ComboBox6.Text & "','" & innum & "','" & comm & "','" & comins & "' ) "

        If check() = True Then
            MsgBox("Please fill in the particular field", MsgBoxStyle.OKOnly, "PrisLogix's PIS")
            Button1.Visible = False
            Button4.Visible = True
            Button2.Enabled = False
            Button3.Enabled = False
            Button5.Visible = True
        Else
            MyConnection.Open()
            MyCommand = New OleDbCommand(iCmd, MyConnection)
            Try
                MyCommand.ExecuteNonQuery()
            Catch c As Exception
                MsgBox(c.ToString)
            End Try
            'DataGrid1.Refresh()
            MyCommand.dispose()
            MyCommand = New OleDbCommand(iCmd2, MyConnection)
            Try
                MyCommand.ExecuteNonQuery()
            Catch c As Exception
                MsgBox(c.ToString)
            End Try
            MyConnection.Close()
            MyCommand.Dispose()
            MsgBox("New Patient Has been Added", MsgBoxStyle.OKOnly, "PrisLogix's PIS")
            clear()
            disablefields()
            saveclinicothers()
        End If
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        formref = New frm_srh
        formref.show()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If fieldcodecheck() = True Then
            MsgBox("Please Enter the Patient code if you would like to edit an patient", MsgBoxStyle.Information, "PrisLogix's PIS")
        Else
            Button1.Enabled = False
            Button4.Enabled = False
            Button3.Enabled = False
            Button5.Visible = True
            Button11.Enabled = True
            Button11.Visible = True
            Button2.Visible = False
            Dim something As String = TextBox4.Text
            fillform()
            enablefields()
        End If
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        clear()
        Button5.Visible = False
        Button3.Enabled = True
        Button1.Visible = True
        Button1.Enabled = True
        Button2.Enabled = True
        Button4.Visible = False
        Button11.Visible = False
        Button11.Enabled = False
        disablefields()
    End Sub
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        ref2 = New frm_app
        ref2.mdiparent = Me.MdiParent
        ref2.show()
    End Sub
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        ref3 = New frm_alert
        ref3.mdiparent = Me.MdiParent
        ref3.show()
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label16.Text = time.Now.ToLongTimeString
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        ref4 = New frm_ad
        Try
            ref4.show()
        Catch c As Exception
            MsgBox(c.ToString)
        End Try
    End Sub
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Me.Close()
    End Sub
    Private Sub Button11_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button11.Click
        updatepatient()
        disablefields()
        clear()
        updatemsg()
        fresh()
        Button2.Visible = True
        Button11.Visible = False
        Button11.Enabled = False
    End Sub
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        If fieldcodecheck() = True Then
            MsgBox("Please Enter the Patient code if you would like to Delete an patient", MsgBoxStyle.Information, "PrisLogix's PIS")
        Else
            buttondis()
            fillform()
            Button13.Enabled = True
            Button12.Enabled = False
        End If
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        deletefield()
        buttonena()
        'MsgBox("Would you like to delete this patient record?", MsgBoxStyle.Question.YesNo, "PrisLogix's PIS")
        Button13.Enabled = False
        Button12.Enabled = True
        clear()
        deletemsg()
    End Sub
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        If idcheck() = True Then
            MsgBox("Please Enter the Patient ID", MsgBoxStyle.Information, "PrisLogix's PIS")
        Else
            'clear()
            disablefields()
            fillform()
        End If
    End Sub
    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        clear()
    End Sub
#End Region


#Region "GLOW CODE"


    Private Sub MouseEnterEvent(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles Button1.MouseEnter, Button2.MouseEnter, Button3.MouseEnter, Button4.MouseEnter, Button5.MouseEnter, Button6.MouseEnter, Button7.MouseEnter, Button8.MouseEnter, Button9.MouseEnter, Button10.MouseEnter, Button11.MouseEnter, Button12.MouseEnter, Button13.MouseEnter, Button14.MouseEnter, Button15.MouseEnter

        ' A simple event handler that fires when the user's mouse arrow rolls 
        ' over any of the buttons.  It passes the button's identity to the Glow sub.

        Dim ctrl As Control = CType(sender, Control)
        Glow(ctrl, True)

    End Sub

    Private Sub MouseLeaveEvent(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles Button1.MouseLeave, Button2.MouseLeave, Button3.MouseLeave, Button4.MouseLeave, Button5.MouseLeave, Button6.MouseLeave, Button7.MouseLeave, Button8.MouseLeave, Button9.MouseLeave, Button10.MouseLeave, Button11.MouseLeave, Button12.MouseLeave, Button13.MouseLeave, Button14.MouseLeave, Button15.MouseLeave

        ' A simple event handler that fires when the user's mouse arrow leaves the
        ' area of any of the buttons.  It passes the button's identity to the Glow sub.

        Dim ctrl As Control = CType(sender, Control)
        Glow(ctrl, False)

    End Sub

    Private Sub Glow(ByVal ctrl As Control, ByVal Hovering As Boolean)

        Dim Sb_R, Sb_G, Sb_B As Int16 '           <--- RGB values for the starting backcolor
        Dim Sf_R, Sf_G, Sf_B As Int16 '           <--- RGB values for the starting forecolor
        Dim Eb_R, Eb_G, Eb_B As Int16 '           <--- RGB values for the ending backcolor
        Dim Ef_R, Ef_G, Ef_B As Int16 '           <--- RGB values for the ending forecolor

        Select Case Hovering  ' True for MouseEnter, False for MouseLeave
            Case True
                Sb_R = SystemColors.Control.R           ' Assign the variables the 
                Sb_G = SystemColors.Control.G           ' appropriate values based
                Sb_B = SystemColors.Control.B           ' on system-defined colors
                '                                         for control and control
                Sf_R = SystemColors.ControlText.R       ' text.
                Sf_G = SystemColors.ControlText.G
                Sf_B = SystemColors.ControlText.B

                Eb_R = SystemColors.ActiveCaption.R     ' Assign the variables the
                Eb_G = SystemColors.ActiveCaption.G     ' appropriate values based
                Eb_B = SystemColors.ActiveCaption.B     ' on system-defined colors
                '                                         for the title bar and the
                Ef_R = SystemColors.ActiveCaptionText.R ' title bar's text.
                Ef_G = SystemColors.ActiveCaptionText.G
                Ef_B = SystemColors.ActiveCaptionText.B
            Case False
                Sb_R = SystemColors.ActiveCaption.R     ' Assign the variables the
                Sb_G = SystemColors.ActiveCaption.G     ' appropriate values based
                Sb_B = SystemColors.ActiveCaption.B     ' on system-defined colors
                '                                         for the title bar and the
                Sf_R = SystemColors.ActiveCaptionText.R ' title bar's text.
                Sf_G = SystemColors.ActiveCaptionText.G
                Sf_B = SystemColors.ActiveCaptionText.B

                Eb_R = SystemColors.Control.R           ' Assign the variables the 
                Eb_G = SystemColors.Control.G           ' appropriate values based
                Eb_B = SystemColors.Control.B           ' on system-defined colors
                '                                         for control and control
                Ef_R = SystemColors.ControlText.R       ' text.
                Ef_G = SystemColors.ControlText.G
                Ef_B = SystemColors.ControlText.B
        End Select

        Dim b_RIncrement As Int16 = Round(((Eb_R - Sb_R) / 16), 0)      ' Find the increments that
        Dim b_GIncrement As Int16 = Round(((Eb_G - Sb_G) / 16), 0)      ' the RGB values will take;
        Dim b_BIncrement As Int16 = Round(((Eb_B - Sb_B) / 16), 0)      ' 1/16th of the difference
        '                                                                 between the start and end
        Dim f_RIncrement As Int16 = Round(((Ef_R - Sf_R) / 16), 0)      ' values, rounded to the 
        Dim f_GIncrement As Int16 = Round(((Ef_G - Sf_G) / 16), 0)      ' nearest integer.
        Dim f_BIncrement As Int16 = Round(((Ef_B - Sf_B) / 16), 0)

        Dim bR As Int16 = Sb_R ' \
        Dim bG As Int16 = Sb_G '  }--  the RGB values for the backcolor as it changes.
        Dim bB As Int16 = Sb_B ' /

        Dim fR As Int16 = Sf_R ' \
        Dim fG As Int16 = Sf_G '  }--  the RGB values for the forecolor as it changes.
        Dim fB As Int16 = Sf_B ' /

        Dim count As Int16
        For count = 0 To 14
            bR += b_RIncrement          ' Add the appropriate increments to the 
            bG += b_GIncrement          ' RGB values.  The result is a nifty
            bB += b_BIncrement          ' "cross-fade" effect.
            fR += f_RIncrement
            fG += f_GIncrement
            fB += f_BIncrement

            ctrl.BackColor = Color.FromArgb(bR, bG, bB)   ' Repaint the button using the
            ctrl.ForeColor = Color.FromArgb(fR, fG, fB)   ' current RGB values, and refresh
            ctrl.Refresh()                                ' the button.

            Threading.Thread.Sleep(30 - (count * 2))      ' Wait a certain number of milliseconds,
            '                                               which is a factor of the current count.
            '                                               I tweaked these numbers to get a decent
            '                                               effect; feel free to adjust these 
            '                                               numbers to achieve an effect you like.
        Next
        Select Case Hovering
            Case True
                ctrl.BackColor = SystemColors.InactiveCaption          ' Finish the effect by painting 
                ctrl.ForeColor = SystemColors.InactiveCaptionText      ' the control with it's final
            Case False                                              ' look, depending on whether
                ctrl.BackColor = SystemColors.Control               ' we're fading in or out.
                ctrl.ForeColor = SystemColors.ControlText
        End Select
    End Sub



#End Region








End Class

⌨️ 快捷键说明

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