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

📄 teacheredugradeform.vb

📁 管理毕业设计的管理系统 VB+SQL2000....
💻 VB
字号:
Public Class TeacherEduGradeForm

    Private umode As Integer = UserMode.NobodyMode
    Private Const percentT As Double = 0.5
    Private Const percentP As Double = 0.3
    Private Const percentD As Double = 0.2

    Public Sub SetUserMode(ByVal value As Integer)
        umode = value
    End Sub

    Private Sub UpdateInfo(ByVal table As DataTable, ByVal index As Integer)
        TextGoalT.Text = table.Rows(index)("sgoalT")
        TextGoalP.Text = table.Rows(index)("sgoalP")
        TextGoalD.Text = table.Rows(index)("sgoalD")
        TextGoal.Text = table.Rows(index)("sgoal")
    End Sub

    Private Sub TeacherEduGradeForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If umode = UserMode.StudentMode Then
            GroupBoxL.Visible = False
            ButtonOK.Visible = False
            ButtonCancel.Text = "确定"

            Dim strUser As String = LoginForm.TextUser.Text
            Dim strSQL As String = "select * from student where suser='" + strUser + "'"
            Dim UserTable As DataTable = DBOperation.Search(strSQL)
            UpdateInfo(UserTable, 0)
        Else
            Dim strSQL As String
            If umode = UserMode.TeacherMode Then
                TextGoalT.Enabled = True
                Dim strUser As String = LoginForm.TextUser.Text
                strSQL = "select * from student s, teacher t where s.tid=t.tid and t.tuser='" + strUser + "'"
            Else
                TextGoalP.Enabled = True
                TextGoalD.Enabled = True
                strSQL = "select * from student order by suser"
            End If

            ListStudentName.Items.Clear()
            Dim UserTable As DataTable = DBOperation.Search(strSQL)
            Dim UserRow As DataRow
            For Each UserRow In UserTable.Rows
                ListStudentName.Items.Add(UserRow("sname"))
            Next

            '指导老师没有指导任何学生
            If ListStudentName.Items.Count = 0 Then
                MsgBox("没有合适的学生信息!", MsgBoxStyle.Exclamation, "信息框")
                Me.Close()
                Exit Sub
            End If
            ListStudentName.SelectedIndex = 0
        End If
    End Sub

    Private Sub ListStudentName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListStudentName.SelectedIndexChanged
        Dim strListName As String = ListStudentName.SelectedItem().ToString
        Dim strSQL As String = "select * from student where sname='" + strListName + "'"
        Dim UserTable As DataTable = DBOperation.Search(strSQL)
        UpdateInfo(UserTable, 0)
    End Sub

    Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click
        Dim response As Integer = MsgBox("确定评分?", vbOKCancel + vbQuestion, "确认")
        If response = 2 Then
            Exit Sub
        End If

        Dim goalT As Double = TextGoalT.Text
        Dim goalP As Double = TextGoalP.Text
        Dim goalD As Double = TextGoalD.Text
        Dim goal As Double = goalT * percentT + goalP * percentP + goalD * percentD
        TextGoal.Text = goal

        Dim strListName As String = ListStudentName.SelectedItem().ToString
        Dim strSQL As String = "update student set sgoalT=" + goalT.ToString + ", sgoalP=" + goalP.ToString + ", sgoalD=" + goalD.ToString + ", sgoal=" + goal.ToString + " where sname='" + strListName + "'"
        If DBOperation.Update(strSQL) Then
            MsgBox("评分成功!", MsgBoxStyle.OkOnly, "评分")
        Else
            MsgBox("评分失败!", MsgBoxStyle.Exclamation, "评分")
        End If
    End Sub

    Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCancel.Click
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

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