📄 sys_set.vb
字号:
Public Class SystemSet
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.CheckState = CheckState.Checked Then
Me.ComboBox1.Enabled = True
Me.ComboBox2.Enabled = True
Else
Me.ComboBox1.Enabled = False
Me.ComboBox2.Enabled = False
End If
End Sub
Private Sub SystemSet_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If MainForm.Start_Obv.Text = "Start" Then '这里防止用户在正在监护的过程中误操作
Me.GroupBox3.Enabled = True
Me.GroupBox4.Enabled = True
Me.GroupBox6.Enabled = True
Else
Me.GroupBox3.Enabled = False
Me.GroupBox4.Enabled = False
Me.GroupBox6.Enabled = False
End If
Dim MyStr As String = Login.MySqlDataBaseConnectionString
Dim MyCon As New Odbc.OdbcConnection(MyStr)
MyCon.Open()
'以下为用户设置部分读入数据库
'以下为医院信心部分读入数据库
Try
Me.yonghuxingming.Text = Login.UserID.Text
Dim MySQL As String = "select User_ID from [User] where User_Name='" + Me.yonghuxingming.Text + "'"
Dim MyComm As Odbc.OdbcCommand = MyCon.CreateCommand
MyComm.CommandText = MySQL
Dim i As String = MyComm.ExecuteScalar
Me.yonghuid.Text = i
MySQL = "select User_Type from [User] where User_Name='" + Me.yonghuxingming.Text + "'"
MyComm = MyCon.CreateCommand
MyComm.CommandText = MySQL
Dim j As String = MyComm.ExecuteScalar
Me.ComboBox_Type.Text = j
Dim myhos As New Preg_FileDataSet.HospitalDataTable()
MySQL = "Select * From [Hospital]"
Dim MyDataAda As New Odbc.OdbcDataAdapter(MySQL, MyCon)
MyDataAda.Fill(myhos)
yiyuanming.Text = myhos.Rows.Item(0).Item(0)
yiyuandizhi.Text = myhos.Rows.Item(0).Item(1)
yiyuanwangzhan.Text = myhos.Rows.Item(0).Item(2)
yiyuanemail.Text = myhos.Rows.Item(0).Item(3)
yiyuandianhua.Text = myhos.Rows.Item(0).Item(4)
shuoming.Text = myhos.Rows.Item(0).Item(5)
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Try
End Try
If MyCon.State = ConnectionState.Open Then
MyCon.Close()
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text = "Modify Password" Then
Button1.Text = "Apply"
jiumima.Text = ""
xinmima.Text = ""
queren.Text = ""
jiumima.Enabled = True
xinmima.Enabled = True
queren.Enabled = True
jiumima.Focus()
Else
Dim MyStr As String = Login.MySqlDataBaseConnectionString
Dim MyCon As New Odbc.OdbcConnection(MyStr)
MyCon.Open()
Dim MySQL1 As String
Dim MyComm As Odbc.OdbcCommand = MyCon.CreateCommand
MySQL1 = "Select count(*) from [User] where User_Name='" & Login.UserID.Text & "' and User_Psw='" & Login.PassWord.Text & "'"
MyComm.CommandText = MySQL1
Dim i As Integer = MyComm.ExecuteScalar()
If i = 0 Then
MessageBox.Show("Please input the correct old password!")
jiumima.Focus()
Else
If xinmima.Text = "" Then
MessageBox.Show("Null password is not acceptable!", "Password modifying", MessageBoxButtons.OK, MessageBoxIcon.Error)
xinmima.Focus() '检查密码是否为空
Exit Sub
End If
If xinmima.Text <> queren.Text Then
MessageBox.Show("The two passwords you have input must be the same!")
xinmima.Focus()
Else
Dim a As MsgBoxResult = (MessageBox.Show("Are you sure you want to change the password?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
If a = MsgBoxResult.No Then
jiumima.Enabled = False
xinmima.Enabled = False
queren.Enabled = False
jiumima.Text = ""
xinmima.Text = ""
queren.Text = ""
Button1.Text = "Modify Password"
Else
Try
MySQL1 = "update [User] set User_Psw='" & xinmima.Text & "' where User_ID=" & Convert.ToInt32(Me.yonghuid.Text)
MyComm.CommandText = MySQL1
Dim j As Integer = MyComm.ExecuteNonQuery()
If j = 1 Then
MessageBox.Show("Password updated successfully!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
jiumima.Text = ""
xinmima.Text = ""
queren.Text = ""
jiumima.Enabled = False
xinmima.Enabled = False
queren.Enabled = False
Button1.Text = "Modify Password"
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End If
End If
If MyCon.State = ConnectionState.Open Then
MyCon.Close()
End If
End If
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button2.Text = "Modify User Name" Then
Button2.Text = "Apply"
yonghuxingming.Text = "Please input here!"
yonghuxingming.Enabled = True
yonghuxingming.Focus()
Else
Dim MyStr As String = Login.MySqlDataBaseConnectionString
Dim MyCon As New Odbc.OdbcConnection(MyStr)
MyCon.Open()
Dim MySQL1 As String = "update [User] set User_Name='" & Me.yonghuxingming.Text & "' where User_ID=" & Convert.ToInt32(Me.yonghuid.Text)
Dim MyComm As Odbc.OdbcCommand = MyCon.CreateCommand
MyComm.CommandText = MySQL1
If yonghuxingming.Text = "" Then
MessageBox.Show("Null user name is not acceptale!", "User Name", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Dim a As MsgBoxResult = (MessageBox.Show("Are you sure you want to change the user name?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
If a = MsgBoxResult.No Then
yonghuxingming.Text = Login.UserID.Text
yonghuxingming.Enabled = False
Button2.Text = "Modify User Name"
Else
Try
Dim j As Integer = MyComm.ExecuteNonQuery()
If j = 1 Then
MessageBox.Show("User name updated successfully!", "Change", MessageBoxButtons.OK, MessageBoxIcon.Information)
yonghuxingming.Enabled = False
Login.UserID.Text = Me.yonghuxingming.Text
Button2.Text = "Modify User Name"
End If
If MyCon.State = ConnectionState.Open Then
MyCon.Close()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -