📄 login.vb
字号:
'
' Copyright(C)2006,济南大学材料科学与工程学院
' All right reserved.
'
' 文件名称:Login.vb
' 文件标识:
' 摘 要:考生考试登陆
' 抽考试题
'
' 当前版本:1.0.0
' 作 者:梁 海
' 完成日期:2006-12-1
'
' 取代版本:
' 原作者 :
' 完成日期:
'
' 修改历史:
'
Public Class Login
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents tbSID As System.Windows.Forms.TextBox
Friend WithEvents btnLogin As System.Windows.Forms.Button
Friend WithEvents tbName As System.Windows.Forms.TextBox
Friend WithEvents lbSID As System.Windows.Forms.Label
Friend WithEvents lbSName As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Login))
Me.lbSID = New System.Windows.Forms.Label
Me.lbSName = New System.Windows.Forms.Label
Me.tbSID = New System.Windows.Forms.TextBox
Me.tbName = New System.Windows.Forms.TextBox
Me.btnLogin = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'lbSID
'
Me.lbSID.BackColor = System.Drawing.Color.White
Me.lbSID.Location = New System.Drawing.Point(312, 216)
Me.lbSID.Name = "lbSID"
Me.lbSID.Size = New System.Drawing.Size(66, 25)
Me.lbSID.TabIndex = 0
Me.lbSID.Text = "考 号:"
'
'lbSName
'
Me.lbSName.BackColor = System.Drawing.Color.White
Me.lbSName.Location = New System.Drawing.Point(312, 264)
Me.lbSName.Name = "lbSName"
Me.lbSName.Size = New System.Drawing.Size(66, 25)
Me.lbSName.TabIndex = 1
Me.lbSName.Text = "姓 名:"
'
'tbSID
'
Me.tbSID.Location = New System.Drawing.Point(392, 216)
Me.tbSID.Name = "tbSID"
Me.tbSID.Size = New System.Drawing.Size(212, 21)
Me.tbSID.TabIndex = 1
Me.tbSID.Text = ""
'
'tbName
'
Me.tbName.ImeMode = System.Windows.Forms.ImeMode.NoControl
Me.tbName.Location = New System.Drawing.Point(392, 264)
Me.tbName.Name = "tbName"
Me.tbName.Size = New System.Drawing.Size(212, 21)
Me.tbName.TabIndex = 2
Me.tbName.Text = ""
'
'btnLogin
'
Me.btnLogin.Location = New System.Drawing.Point(440, 296)
Me.btnLogin.Name = "btnLogin"
Me.btnLogin.Size = New System.Drawing.Size(90, 24)
Me.btnLogin.TabIndex = 3
Me.btnLogin.Text = "登 陆 "
'
'Login
'
Me.AcceptButton = Me.btnLogin
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
Me.ClientSize = New System.Drawing.Size(634, 338)
Me.Controls.Add(Me.btnLogin)
Me.Controls.Add(Me.tbName)
Me.Controls.Add(Me.tbSID)
Me.Controls.Add(Me.lbSName)
Me.Controls.Add(Me.lbSID)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "Login"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "考生登陆"
Me.ResumeLayout(False)
End Sub
#End Region
'登陆确定按扭点击事件
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
'考号或姓名为空时,弹出对话框
If Me.tbSID.Text = "" Or Me.tbName.Text = "" Then
MessageBox.Show("请正确填写考号和姓名!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return
End If
Dim oExam As New AutoCAD.Exam '考试WebServices调用类
Dim oStudentInfo As New AutoCAD.StudentInfo '考生信息数据结构
Dim blnExist As Boolean '考生是否存在
Dim frmConnect As New Conn '连接服务器窗体
'设置并打开连接服务器窗体
frmConnect.Text = "正在登陆,请稍候...."
frmConnect.Show()
'读取考生信息
blnExist = oExam.GetStudentInfo(Me.tbSID.Text, oStudentInfo)
'验证考生信息
If Not blnExist Then
'如果考号不存在
'关闭服务器连接窗体,并弹出错误提示
frmConnect.Close()
MessageBox.Show("Sorry!你的考试信息不存在!请与监考员联系!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return
End If
Dim oExamInfo As New AutoCAD.ExamInfo '考场安排信息
Dim IsExist As Boolean
'读取考场信息
IsExist = oExam.GetExamInfo(oStudentInfo.SID, oExamInfo)
'关闭连接服务器窗体
frmConnect.Close()
'验证考场信息
If Not IsExist Then
'考试安排不存在, 并弹出错误提示
MessageBox.Show("Sorry!系统尚没有你的考试安排!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Me.Close()
Return
End If
'验证考生是否已经参加考试
If oExamInfo.IsExamed Then
'如果已经参加考试
If MessageBox.Show("你已经参加考试!不能再次考试!" + Chr(10) + _
"请与监考员联系", "警告", _
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.Yes Then
'打开监考员验证窗体
Dim frmLoginError As New LoginError
frmLoginError.SID = oStudentInfo.SID
frmLoginError.SName = oStudentInfo.Name
frmloginError.IsExamed = True
frmLoginError.Show()
Me.Hide()
Return
Else
Me.Close()
Return
End If '已经参加考试处理IF
End If
'验证考生是否迟到
If oExamInfo.StartDateTime.AddMinutes(20) < Now() Then
'如果考生迟到20分钟,将不能登陆系统
Dim oDialog As New DialogResult
oDialog = MessageBox.Show("考试时间已过!你不能再登陆系统!" + Chr(10) + _
"请及时与监考员联系", "警告", _
MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
If oDialog = DialogResult.Yes Then
'打开监考员验证窗体
Dim frmLoginError As New LoginError
frmLoginError.SID = oStudentInfo.SID
frmLoginError.SName = oStudentInfo.Name
frmloginerror.STeam = oStudentInfo.Team
frmLoginError.IsLate = True
frmLoginError.Show()
Me.Hide()
Return
Else
Me.Close()
Return
End If '考生迟到处理IF
End If
'验证考试是否已经结束
If Now() > oExamInfo.EndDateTime Then
MessageBox.Show("考试已经结束!你不能再参加考试!", "警告", _
MessageBoxButtons.OK, MessageBoxIcon.Warning)
Me.Close()
Return
End If '验证考试是否结束IF
'提示考生信息,以便考生核对
If MessageBox.Show("考号: " + oStudentInfo.SID + Chr(10) + _
"姓名: " + oStudentInfo.Name + Chr(10) + _
"学院: " + oStudentInfo.Department + Chr(10) + _
"专业: " + oStudentInfo.Mayor + Chr(10) + _
"班级: " + oStudentInfo.Team + Chr(10) + _
"点击确定开始考试,点击取消返回", "考生信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) = DialogResult.OK Then
'点击确定,开始抽取试题
If Common.GetPaper(oStudentInfo.SID) Then
'抽题成功,打开考试窗体
Dim frmExam As New Exam
frmExam.SID = oStudentInfo.SID
frmExam.SName = oStudentInfo.Name
frmExam.STeam = oStudentInfo.Team
frmExam.Show()
Me.Hide()
Return
Else
MessageBox.Show("抽题出错!请与监考员联系!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return
End If
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -