📄 frmknowlegeman.vb
字号:
If Not tv_chapter.SelectedNode Is Nothing Then
If CurChp.ChapterName = tv_chapter.SelectedNode.Text Then
Exit Sub
End If
MyChp.GetInfo(MakeStr(tv_chapter.SelectedNode.Text), CurSubjt.SubjectID)
CurChp.Equal(MyChp)
tv_knowleg.Nodes.Clear()
CurKnow.Initials()
lbl_knowleg.Text = ""
CurKnow.LoadNodesByChp(tv_knowleg, CurChp.ChapterID)
txt_chapter.Text = MyChp.ChapterName
End If
lbl_chapter.Text = CurChp.ChapterName
End Sub
Private Sub cmd_chapteradd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_chapteradd.Click
If CurSubjt.SubjectID <= 0 Then
MsgBox("课程名称不能为空,请先选择课程", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
Exit Sub
End If
If Trim(txt_chapter.Text) = "" Then
MsgBox("章节名称不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_chapter.Focus()
Exit Sub
End If
If MyChp.IsInDB(MakeStr(txt_chapter.Text), CurSubjt.SubjectID) Then
MsgBox("章节名称[" & txt_chapter.Text & "]已经存在", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_chapter.Text = ""
txt_chapter.Focus()
Exit Sub
End If
MyChp.ChapterID = MyChp.GetNewID()
MyChp.ChapterName = MakeStr(txt_chapter.Text)
MyChp.SubjectID = CurSubjt.SubjectID
If MyChp.InsertDB() Then
CurChp.Equal(MyChp)
lbl_chapter.Text = CurChp.ChapterName
tv_knowleg.Nodes.Clear()
CurKnow.Initials()
txt_chapter.Text = CurChp.ChapterName
lbl_knowleg.Text = ""
txt_knowleg.Text = ""
tv_chapter.SelectedNode = InsertTreeNode(tv_chapter, CurChp.ChapterName)
tv_chapter.SelectedNode.ImageIndex = 1
tv_chapter.SelectedNode.SelectedImageIndex = 1
Else
Exit Sub
End If
End Sub
Private Sub cmd_chaptermodify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_chaptermodify.Click
If CurChp.ChapterID <= 0 Then
MsgBox("请选择章节", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_chapter.Text = ""
Exit Sub
End If
If Trim(txt_chapter.Text) = "" Then
MsgBox("章节名称不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_chapter.Focus()
Exit Sub
End If
If CurChp.ChapterID <= 0 Then
txt_chapter.Text = ""
Exit Sub
End If
If Trim(txt_chapter.Text) = CurChp.ChapterName Then
MsgBox("成功更新", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
Exit Sub
End If
If MyChp.IsInDB(MakeStr(txt_chapter.Text), CurSubjt.SubjectID) Then
MsgBox("章节名称[" & MyChp.ChapterName & "]已经存在", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_chapter.Text = ""
txt_chapter.Focus()
Exit Sub
End If
MyChp.ChapterID = CurChp.ChapterID
MyChp.ChapterName = MakeStr(txt_chapter.Text)
MyChp.SubjectID = CurSubjt.SubjectID
If MyChp.Modify() Then
CurChp.ChapterName = MyChp.ChapterName
tv_chapter.SelectedNode.Text = CurChp.ChapterName
lbl_chapter.Text = CurChp.ChapterName
txt_chapter.Text = CurChp.ChapterName
Else
MyChp.ChapterName = CurChp.ChapterName
txt_chapter.Text = CurChp.ChapterName
Exit Sub
End If
End Sub
Private Sub cmd_chapterdelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_chapterdelete.Click
If CurChp.ChapterID <= 0 Then
Exit Sub
End If
If MyChp.HaveKnowChild(CurChp.ChapterID) Then
If MsgBox("您是否真的要删除章节[" & MyChp.ChapterName & "] 它有知识点,试题等孩子节点,如果您真的删除后信息无法恢复,请您谨慎处理", _
MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0") = MsgBoxResult.Yes Then
MyChp.ChapterID = CurChp.ChapterID
Dim tmpdbset As DataSet
Dim tmpdrow As DataRow
tmpdbset = MyObjt.GetObjDetailByChp(MyChp.ChapterID)
If Not tmpdbset Is Nothing Then
For Each tmpdrow In tmpdbset.Tables(0).Rows
MyobjKD.DeleteByObj(tmpdrow.Item("ObjectID"))
Next
End If
MyObjt.DeleteObjByChp(MyChp.ChapterID)
If MyChp.Delete() Then
Dim tnode As TreeNode
tnode = tv_chapter.SelectedNode
tv_chapter.Nodes.Remove(tnode)
tv_knowleg.Nodes.Clear()
CurChp.Initials()
MyChp.Initials()
lbl_knowleg.Text = ""
lbl_chapter.Text = ""
txt_knowleg.Text = ""
txt_chapter.Text = ""
CurKnow.Initials()
End If
Else
Exit Sub
End If
Else
If MsgBox("是否删除章节名称[" & CurChp.ChapterName & "]", MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0") = MsgBoxResult.Yes Then
MyChp.ChapterID = CurChp.ChapterID
If MyChp.Delete() Then
Dim tnode As TreeNode
tnode = tv_chapter.SelectedNode
tv_chapter.Nodes.Remove(tnode)
tv_knowleg.Nodes.Clear()
CurChp.Initials()
MyChp.Initials()
lbl_knowleg.Text = ""
lbl_chapter.Text = ""
txt_knowleg.Text = ""
txt_chapter.Text = ""
CurKnow.Initials()
End If
End If
End If
End Sub
Private Sub tv_knowleg_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tv_knowleg.MouseDown
tv_knowleg.SelectedNode = tv_knowleg.GetNodeAt(e.X, e.Y)
If Not tv_knowleg.SelectedNode Is Nothing Then
If CurKnow.KnowlegName = tv_knowleg.SelectedNode.Text Then
Exit Sub
End If
MyKnow.GetInfo(MakeStr(tv_knowleg.SelectedNode.Text), CurChp.ChapterID)
CurKnow.Equal(MyKnow)
txt_knowleg.Text = MyKnow.KnowlegName
End If
lbl_knowleg.Text = CurKnow.KnowlegName
End Sub
Private Sub cmd_knowadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_knowadd.Click
If CurChp.ChapterID <= 0 Then
MsgBox("章节不能为空请先选择", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
Exit Sub
End If
If Trim(txt_knowleg.Text) = "" Then
MsgBox("知识点名称不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_knowleg.Focus()
Exit Sub
End If
If MyKnow.IsInDB(MakeStr(txt_knowleg.Text), CurChp.ChapterID) Then
MsgBox("知识点名称[" & txt_knowleg.Text & "]已经存在", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_knowleg.Text = ""
txt_knowleg.Focus()
Exit Sub
End If
MyKnow.KnowlegID = MyKnow.GetNewID()
MyKnow.KnowlegName = MakeStr(txt_knowleg.Text)
MyKnow.ChapterID = CurChp.ChapterID
If MyKnow.InsertDB() Then
CurKnow.Equal(MyKnow)
lbl_knowleg.Text = CurKnow.KnowlegName
txt_knowleg.Text = lbl_knowleg.Text
tv_knowleg.SelectedNode = InsertTreeNode(tv_knowleg, CurKnow.KnowlegName)
tv_knowleg.SelectedNode.ImageIndex = 2
tv_knowleg.SelectedNode.SelectedImageIndex = 2
Else
Exit Sub
End If
End Sub
Private Sub cmd_knowmodify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_knowmodify.Click
If CurKnow.KnowlegID <= 0 Then
MsgBox("请选择知识点", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_knowleg.Text = ""
Exit Sub
End If
If Trim(txt_knowleg.Text) = "" Then
MsgBox("知识点名称不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_knowleg.Focus()
Exit Sub
End If
If CurKnow.KnowlegID <= 0 Then
txt_knowleg.Text = ""
Exit Sub
End If
If Trim(txt_knowleg.Text) = CurKnow.KnowlegName Then
MsgBox("成功更新", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
Exit Sub
End If
If MyKnow.IsInDB(MakeStr(txt_knowleg.Text), CurChp.ChapterID) Then
MsgBox("知识点名称[" & MyKnow.KnowlegName & "]已经存在", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
txt_knowleg.Text = ""
txt_knowleg.Focus()
Exit Sub
End If
MyKnow.KnowlegID = CurKnow.KnowlegID
MyKnow.KnowlegName = MakeStr(txt_knowleg.Text)
MyKnow.ChapterID = CurChp.ChapterID
If MyKnow.Modify() Then
CurKnow.KnowlegName = MyKnow.KnowlegName
tv_knowleg.SelectedNode.Text = CurKnow.KnowlegName
lbl_knowleg.Text = CurKnow.KnowlegName
txt_knowleg.Text = CurKnow.KnowlegName
Else
MyKnow.KnowlegName = CurKnow.KnowlegName
txt_knowleg.Text = CurKnow.KnowlegName
Exit Sub
End If
End Sub
Private Sub cmd_knowdelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_knowdelete.Click
If CurKnow.KnowlegID <= 0 Then
Exit Sub
End If
If MyKnow.HaveChild(CurKnow.KnowlegID) Then
If MsgBox("您是否真的要删除知识点[" & CurKnow.KnowlegName & "],试题存在此知识点,如果您真的删除后信息无法恢复,请您谨慎处理", _
MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0") = MsgBoxResult.Yes Then
MyKnow.KnowlegID = CurKnow.KnowlegID
MyobjKD.DeleteByKnow(CurKnow.KnowlegID)
If MyKnow.DeleteKnow() Then
Dim tnode As TreeNode
tnode = tv_knowleg.SelectedNode
tv_knowleg.Nodes.Remove(tnode)
txt_knowleg.Text = ""
lbl_knowleg.Text = ""
CurKnow.Initials()
End If
Else
Exit Sub
End If
Else
If MsgBox("是否删除知识点[" & CurKnow.KnowlegName & "]", MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0") = MsgBoxResult.Yes Then
MyKnow.KnowlegID = CurKnow.KnowlegID
If MyKnow.DeleteKnow() Then
Dim tnode As TreeNode
tnode = tv_knowleg.SelectedNode
tv_knowleg.Nodes.Remove(tnode)
txt_knowleg.Text = ""
lbl_knowleg.Text = ""
CurKnow.Initials()
End If
End If
End If
End Sub
Private Sub cmd_chapteradd_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmd_chapteradd.MouseLeave, _
cmd_chapterdelete.MouseLeave, cmd_chaptermodify.MouseLeave, cmd_knowadd.MouseLeave, cmd_knowdelete.MouseLeave, _
cmd_knowmodify.MouseLeave, cmd_subadd.MouseLeave, cmd_subdelete.MouseLeave, cmd_submodify.MouseLeave
sender.backcolor = System.Drawing.SystemColors.Control
End Sub
Private Sub cmd_chapteradd_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cmd_chapteradd.MouseMove, _
cmd_chapterdelete.MouseMove, cmd_chaptermodify.MouseMove, cmd_knowadd.MouseMove, cmd_knowdelete.MouseMove, cmd_knowmodify.MouseMove, _
cmd_subadd.MouseMove, cmd_subdelete.MouseMove, cmd_submodify.MouseMove
sender.backcolor = System.Drawing.SystemColors.ControlLight
End Sub
Private Sub frmknowlegeman_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
CurSubjt.Initials()
CurChp.Initials()
CurKnow.Initials()
MySubjt.Initials()
MyChp.Initials()
MyKnow.Initials()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -