?? studentchangetaskform.vb
字號:
Public Class StudentChangeTaskForm
Private Sub StudentChangeTaskForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strUser As String = LoginForm.TextUser.Text
Dim strSQL As String = "select stask from student where suser='" + strUser + "'"
TextOldTask.Text = DBOperation.Search(strSQL).Rows(0)("stask")
End Sub
Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click
If TextNewTask.Text.Trim = "" Then
MsgBox("請正確輸入新課題的名稱!", MsgBoxStyle.Exclamation, "錯誤")
Exit Sub
End If
Dim response As Integer = MsgBox("確定選擇《" + TextNewTask.Text.Trim + "》作為新課題?", vbOKCancel + vbQuestion, "確認")
If response = 2 Then
Exit Sub
End If
Dim strUser As String = LoginForm.TextUser.Text
Dim strSQL As String = "select s.sid, s.sname, t.tid from student s, teacher t where s.tid=t.tid and s.suser='" + strUser + "'"
Dim UserTable As DataTable = DBOperation.Search(strSQL)
Dim strSendid As String = UserTable.Rows(0)("sid")
Dim strReceiveid As String = UserTable.Rows(0)("tid")
Dim strName As String = UserTable.Rows(0)("sname")
Dim strLid As String
Dim nid As Integer
strSQL = "select lid from leaveWord"
UserTable = DBOperation.Search(strSQL)
If UserTable.Rows.Count = 0 Then
strLid = "l001"
Else
strLid = UserTable.Rows(UserTable.Rows.Count - 1)("lid")
nid = Val(strLid.Substring(1)) + 1
If nid < 10 Then
strLid = "l00" + nid.ToString
ElseIf nid < 100 Then
strLid = "l0" + nid.ToString
Else
strLid = "l" + nid.ToString
End If
End If
Dim strContent As String = "學生:" + strName + "希望將原課題《" + TextOldTask.Text + "》改成《" + TextNewTask.Text.Trim + "》,請指示!(按下下方同意或拒絕按鈕)"
Dim contentByte() As Byte = System.Text.Encoding.Default.GetBytes(strContent)
strSQL = "insert into leaveWord values('" + strLid + "', '" + strSendid + "', '" + strReceiveid + "', '" + Now().ToString + "', '2', @lcontent)"
Dim strRow As String = "lcontent"
If DBOperation.Insert(strSQL, strRow, contentByte) Then
MsgBox("申請成功!請耐心等待老師的答復!", MsgBoxStyle.OkOnly, "改題申請")
Else
MsgBox("申請失敗!請重試!", MsgBoxStyle.Exclamation, "改題申請")
End If
TextNewTask.Text = ""
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 + -