Private Sub asPopup3_Click(Cancel As Boolean)
Dim fo2 As CTranslucentForm
Set fo2 = New CTranslucentForm
fo2.hWnd = teacher.hWnd
fo2.Alpha = 93 / 100 * 255
teacher.Show 1
End Sub
Private Sub asPopup5_Click(Cancel As Boolean)
'检查教室人数与考试人数的对比
Set ks1 = cnn.Execute("select count(*) from 日程设定")
Set ks2 = cnn.Execute("select sum(容纳人数) from 教室")
Set ks3 = cnn.Execute("select sum(考试人数) from 课程")
If ks3.Fields(0) > ks1.Fields(0) * ks2.Fields(0) Then
MsgBox "总考试人数大于教室所容纳的人数,请检查!", vbInformation, "提示"
Exit Sub
End If
'检查可用教师人数是否大于或等于监考人数
Set ks1 = cnn.Execute("select count(*) from 教师")
Set ks2 = cnn.Execute("select sum(监考人数) from 教室")
If ks2.Fields(0) > ks1.Fields(0) Then
MsgBox "教师可用人数小于教室监考人数需求,请检查!", vbInformation, "提示"
Exit Sub
End If
'检查课程的考试数目是否超出考试安排时间
Set ks1 = cnn.Execute("select count(*) from 日程设定")
Set ks2 = cnn.Execute("SELECT DISTINCT 系名 from 课程")
Do While Not ks2.EOF
For i = 1 To 4
Set ks3 = cnn.Execute("select count(*) from 课程 where 系名='" & ks2.Fields(0) & "' and 年级='" & i & "'")
If ks3.Fields(0) > ks1.Fields(0) Then
MsgBox ks2.Fields(0) & i & "年级的考试科目大出了日程安排数目,请检查!", vbInformation, "提示"
Exit Sub
End If
Next
ks2.MoveNext
Loop
Set ks1 = cnn.Execute("select * from 日程设定")
Set ks2 = cnn.Execute("select * from 教师")
Do While Not ks2.EOF
Do While Not ks1.EOF
Set ks3 = cnn.Execute("insert into 安排 values('" & ks2.Fields(0) & "','" & ks1.Fields(0) & "','" & ks1.Fields(1) & "','0')")
ks1.MoveNext
Loop
Set ks1 = cnn.Execute("select * from 日程设定") '因为采用了SQL语句方式,无法将指针指向第一位,所以必须在次读取数据库
ks2.MoveNext
Loop
asPopup1.Enabled = False
asPopup2.Enabled = False
asPopup3.Enabled = False
End Sub
Private Sub asPopup6_Click(Cancel As Boolean)
PBar1.Value = 0
Timer1.Interval = 100
asPopup6.Enabled = False
End Sub
Private Sub sc() '这里是生成的主代码
''''''''''''''''''''''''
MsgBox "未授权作品,在源码中有对此代码的详细思路注解,请参照!", vbInformation, "提示"
End Sub
Private Sub asPopup7_Click(Cancel As Boolean)
formshow.Show 1
End Sub
Private Sub asPopup8_Click(Cancel As Boolean)
'这里就是对已经生成的记录进行清除,实现数据的在生成与在管理
Set ks1 = cnn.Execute("delete from 监考教师")
Set ks1 = cnn.Execute("delete from 安排")
Set ks1 = cnn.Execute("update 教室 set 已选='0'")
Set ks1 = cnn.Execute("delete from 生成")
MsgBox "清除完成!", vbInformation, "提示"
asPopup1.Enabled = True
asPopup2.Enabled = True
asPopup3.Enabled = True
asPopup4.Enabled = True
asPopup5.Enabled = True
asPopup6.Enabled = False
asPopup7.Enabled = False
asPopup8.Enabled = False
End Sub
Private Sub asPopup9_Click(Cancel As Boolean)
Dim fo2 As CTranslucentForm
Set fo2 = New CTranslucentForm
fo2.hWnd = user.hWnd
fo2.Alpha = 93 / 100 * 255
user.Show 1
End Sub
Private Sub Form_Load()
PBar1.Max = 100 '设定进度条最大值为100
'以下是通过判断安排表和生成表是否为空,来确定用户是否还可以操作
'一些日程设定,教室管理等内容
Set ks1 = cnn.Execute("select count(*) from 安排")
If ks1.Fields(0) <> 0 Then
asPopup1.Enabled = False
asPopup2.Enabled = False
asPopup3.Enabled = False
asPopup4.Enabled = False
asPopup5.Enabled = False
Set ks2 = cnn.Execute("select count(*) from 生成")
If ks2.Fields(0) <> 0 Then
asPopup6.Enabled = False
End If
Private Sub Timer1_Timer()
If PBar1.Value < 95 Then
Label1.Visible = True
Label1.Caption = "正在进行生成....."
PBar1.Value = PBar1.Value + 5
Else
Timer1.Interval = 0
Call sc
End If
End Sub
(3)查询窗体:
当我们进入查询窗体时 会进入如图10所示的界面,其中有开始执行按钮,输入自己想要查询的对象信息,即可达到查询效果
代码如下:
图11 查询窗体界面Dim n As Integer
Private Sub Form_Load()
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
Grid2.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
With Grid1 '以下是对表格控件进行一些颜色和字体等设置
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.DefaultFont.Name = "Tahoma"
.DefaultFont.SIZE = 8
.BackColorFixed = RGB(84, 201, 134) 'RGB(90, 158, 214)
.BackColorFixedSel = RGB(84, 201, 134) 'RGB(110, 180, 230)
.BackColorBkg = RGB(84, 201, 134) 'RGB(90, 158, 214)
.BackColorScrollBar = RGB(231, 235, 247)
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(239, 243, 255)
.GridColor = RGB(148, 190, 231)
.Column(0).Width = 0
End With
With Grid2
.DefaultFont.Name = "Tahoma"
.DefaultFont.SIZE = 8
.BackColorFixed = RGB(90, 158, 214)
.BackColorFixedSel = RGB(110, 180, 230)
.BackColorBkg = RGB(90, 158, 214)
.BackColorScrollBar = RGB(231, 235, 247)
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(239, 243, 255)
.GridColor = RGB(148, 190, 231)
.Column(0).Width = 0
End With
Me.BackColor = RGB(84, 201, 134)
'以下cellcombobox是控件grid 的一个属性,即是在表格单元格可以出现下拉框,
'下拉框中就是用户所需的快捷内容
Grid1.Column(1).CellType = cellComboBox
Grid1.Column(2).CellType = cellComboBox
Grid1.Column(3).CellType = cellComboBox
Grid1.Cell(0, 1).Text = "查询模式" '将表格内添入固定内容
Grid1.Cell(0, 2).Text = "查询段"
Grid1.Cell(0, 3).Text = "条件"
Grid1.Cell(0, 4).Text = "关键字"
Grid1.Cell(0, 5).Text = "附加条件"
Grid1.ComboBox(1).AddItem "精确查询" '这里是类似combo框的操作,也是把内容添入combo控件的记录集
Grid1.ComboBox(1).AddItem "模糊查询"
Grid1.ComboBox(2).AddItem "系名"
Grid1.ComboBox(2).AddItem "年级"
Grid1.ComboBox(2).AddItem "课程名"
Grid1.ComboBox(2).AddItem "教室号"
Grid1.ComboBox(2).AddItem "考试日期"
Grid1.ComboBox(2).AddItem "时间"
Grid1.ComboBox(2).AddItem "楼层"
Grid1.ComboBox(2).AddItem "教师"
Grid1.ComboBox(2).AddItem "教师监考次数"
Grid1.Cell(1, 1).Text = "精确查询"
End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long)
If Grid1.Cell(1, 1).Text <> "" Then
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页